PROTECTED SOURCE SCRIPT

Algo V4 – Predictive SMC

18
//version=5
indicator("Algo V4 – Predictive SMC", overlay=true)

// — Inputs —
emaLen = input.int(20, "EMA Length", minval=1)
structureLen = input.int(20, "Structure Lookback", minval=5)
showFVG = input.bool(true, "Show Fair Value Gaps")
showZones = input.bool(true, "Show Supply/Demand Zones")

// — EMA Trend Filter —
ema = ta.ema(close, emaLen)
plot(ema, color=color.new(color.gray, 70), title="EMA")

// — Structure Highs/Lows —
swingHigh = ta.highest(high, structureLen)
swingLow = ta.lowest(low, structureLen)

// — CHOCH Detection —
chochUp = low < low[1] and high < high[1]
chochDown = high > high[1] and low > low[1]

// — FVG Detection —
fvgBuy = low > high[2]
fvgSell = high < low[2]

// — Supply/Demand Zones (simple method) —
demand = ta.lowest(low, 3)
supply = ta.highest(high, 3)

// — Plot Zones —
if showZones
line.new(bar_index - 3, demand, bar_index, demand, color=color.new(color.green, 80), extend=extend.none)
line.new(bar_index - 3, supply, bar_index, supply, color=color.new(color.red, 80), extend=extend.none)

// — Plot FVG Boxes —
if showFVG
if fvgBuy
box.new(bar_index[2], high[2], bar_index, low, bgcolor=color.new(color.green, 90), border_color=color.green)
if fvgSell
box.new(bar_index[2], low[2], bar_index, high, bgcolor=color.new(color.red, 90), border_color=color.red)

// — BUY Signal Logic —
buySignal = chochUp and fvgBuy and close > ema and low <= demand
plotshape(buySignal, location=location.belowbar, style=shape.triangleup, color=color.lime, size=size.small, title="Buy Arrow")

// — SELL Signal Logic —
sellSignal = chochDown and fvgSell and close < ema and high >= supply
plotshape(sellSignal, location=location.abovebar, style=shape.triangledown, color=color.red, size=size.small, title="Sell Arrow")

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.