OPEN-SOURCE SCRIPT

Money Moves Breakout PRO – By Money Moves

350
//version=5
indicator("Money Moves Breakout PRO – By Money Moves", overlay=true, max_boxes_count=2)

// ------ USER SETTINGS ------
sessionStartHour = input.int(11, "London Start Hour (IST)", minval=0, maxval=23)
sessionStartMin = input.int(30, "London Start Min (IST)", minval=0, maxval=59)
boxMinutes = input.int(15, "Box Candle Minutes", minval=1, maxval=5000)
showBox = input(true, "Show Breakout Box")
emaLength = input.int(20, "EMA Length")
useVolumeConfirm = input(true, "Use Volume Confirmation")

ist_offset = 5.5 // IST = UTC+5:30
barTime = time + int(ist_offset * 3600000)
boxStartSec = sessionStartHour * 3600 + sessionStartMin * 60
boxEndSec = boxStartSec + boxMinutes * 60
currentSecOfDay = ((barTime % 86400000) / 1000)

// ----- LONDON BOX -----
isBox = currentSecOfDay >= boxStartSec and currentSecOfDay < boxEndSec
isBoxPrev = currentSecOfDay[1] >= boxStartSec and currentSecOfDay[1] < boxEndSec
boxStartBar = not isBoxPrev and isBox
boxEndBar = isBoxPrev and not isBox

var float boxHigh = na
var float boxLow = na
var int boxBarIdx = na
var box sessionBox = na

if boxStartBar
boxHigh := high
boxLow := low
boxBarIdx := bar_index
if isBox and not na(boxHigh)
boxHigh := math.max(boxHigh, high)
boxLow := math.min(boxLow, low)
if boxEndBar and showBox
sessionBox := box.new(left=boxBarIdx, right=bar_index, top=boxHigh, bottom=boxLow, border_color=color.rgb(255, 226, 59), bgcolor=color.new(#ebff3b, 66))

// --- EMA & Volume ---
emaValue = ta.ema(close, emaLength)
avgVol = ta.sma(volume, 1000)
volCond = useVolumeConfirm ? (volume > avgVol) : true

// --- Only first breakout + Confirmation ---
var bool brokenHigh = false
var bool brokenLow = false

firstBreakUp = false
firstBreakDn = false

if boxEndBar
brokenHigh := false
brokenLow := false

// Upar ka breakout: close boxHigh se upar, EMA 20 ke upar, volume confirmation
if not isBox and not isBoxPrev and not na(boxHigh[1]) and not brokenHigh and close > boxHigh[1] and close > emaValue and volCond
firstBreakUp := true
brokenHigh := true

// Niche ka breakout: close boxLow se niche, EMA 20 ke niche, volume confirmation
if not isBox and not isBoxPrev and not na(boxLow[1]) and not brokenLow and close < boxLow[1] and close < emaValue and volCond
firstBreakDn := true
brokenLow := true

plotshape(firstBreakUp, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.normal, text="BUY")
plotshape(firstBreakDn, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.normal, text="SELL")

// Show EMA on chart for visual trend confirmation
plot(emaValue, color=color.blue, linewidth=2, title="EMA 20")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.