OPEN-SOURCE SCRIPT

My script

363
// version=6
indicator("ORB-FVG-Sweep Alert", overlay=true)

start = input.session("2300-2330", title="ORB session UTC")
level = input.float(2.0, "Min FVG size ($)")

// ---- ORB box ----
t = time(timeframe.period, start)
inRange = not na(t)
h = ta.valuewhen(inRange, high, 0)
l = ta.valuewhen(inRange, low, 0)
plot(inRange ? h : na, color=color.gray, style=plot.style_linebr)
plot(inRange ? l : na, color=color.gray, style=plot.style_linebr)

// ---- FVG detection (simplified) ----
fvg = (high[1] < low[3] and close[1] < open[1]) or (low[1] > high[3] and close[1] > open[1])
plotshape(fvg and math.abs(high[1]-low[3]) >= level, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, title="Bull FVG")
plotshape(fvg and math.abs(low[1]-high[3]) >= level, style=shape.triangledown,location=location.abovebar, color=color.red, size=size.tiny, title="Bear FVG")

// ---- Sweep of ORB high/low ----
sweepHigh = high > h and close < h and high[1] <= h
sweepLow = low < l and close > l and low[1] >= l
plotshape(sweepHigh, style=shape.arrowdown, location=location.abovebar, color=color.maroon, size=size.small, title="Sweep High")
plotshape(sweepLow, style=shape.arrowup, location=location.belowbar, color=color.green, size=size.small, title="Sweep Low")

// ---- Combined alert condition ----
alertcondition(sweepHigh and fvg, title="Short setup", message="ORB sweep+FVG short")
alertcondition(sweepLow and fvg, title="Long setup", message="ORB sweep+FVG long")

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。