OPEN-SOURCE SCRIPT

Intraday S/R Breaks (Clean)

466
//version=5
indicator("Intraday S/R Breaks (Clean)", overlay=true)

length = input.int(6, title="Volume MA Period")
showLines = input.bool(true, title="Show S/R Lines?")
showZones = input.bool(false, title="Show Zones?")

// Volume logic
volMA = ta.sma(volume, length)

// Fractal logic (basic 5-bar high/low with volume filter)
isFractalUp = high[2] > high[3] and high[2] > high[1] and high[3] > high[4] and high[1] > high[0] and volume[2] > volMA[2]
isFractalDown = low[2] < low[3] and low[2] < low[1] and low[3] < low[4] and low[1] < low[0] and volume[2] > volMA[2]

var float resistance = na
var float support = na

if isFractalUp
resistance := high[2]
if isFractalDown
support := low[2]

// Plot lines/zones
resLine = showLines and not na(resistance) ? line.new(x1=bar_index[2], y1=resistance, x2=bar_index, y2=resistance, extend=extend.right, color=color.red, width=1) : na
supLine = showLines and not na(support) ? line.new(x1=bar_index[2], y1=support, x2=bar_index, y2=support, extend=extend.right, color=color.green, width=1) : na

// Alerts
resBreak = ta.crossover(close, resistance)
supBreak = ta.crossunder(close, support)

alertcondition(resBreak, title="Resistance Break", message="Resistance Break!")
alertcondition(supBreak, title="Support Break", message="Support Break!")

if resBreak
label.new(bar_index, high, "📈 RESISTANCE BROKEN", style=label.style_label_down, color=color.red, textcolor=color.white)

if supBreak
label.new(bar_index, low, "📉 SUPPORT BROKEN", style=label.style_label_up, color=color.green, textcolor=color.white)

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.