OPEN-SOURCE SCRIPT

Momentum SNR VIP [3 TP + Max 50 Pip SL]

98
//version=6
indicator("Momentum SNR VIP [3 TP + Max 50 Pip SL]", overlay=true)

// === Settings ===
pip = input.float(0.0001, "Pip Size", step=0.0001)
sl_pip = 50 * pip
tp1_pip = 40 * pip
tp2_pip = 70 * pip
tp3_pip = 100 * pip
lookback = input.int(20, "Lookback for S/R", minval=5)

// === SNR ===
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)

plotshape(supportZone, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.tiny)
plotshape(resistanceZone, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)

// === Price Action ===
bullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open <= close[1]
bearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open >= close[1]
bullishPinBar = close < open and (low - math.min(open, close)) > 1.5 * math.abs(close - open)
bearishPinBar = close > open and (high - math.max(open, close)) > 1.5 * math.abs(close - open)
buySignal = supportZone and (bullishEngulfing or bullishPinBar)
sellSignal = resistanceZone and (bearishEngulfing or bearishPinBar)

// === SL & TP ===
rawBuySL = low - 10 * pip
buySL = math.max(close - sl_pip, rawBuySL)
buyTP1 = close + tp1_pip
buyTP2 = close + tp2_pip
buyTP3 = close + tp3_pip

rawSellSL = high + 10 * pip
sellSL = math.min(close + sl_pip, rawSellSL)
sellTP1 = close - tp1_pip
sellTP2 = close - tp2_pip
sellTP3 = close - tp3_pip

// === Plot Lines ===
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP1 : na, title="Buy TP1", color=color.green, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP2 : na, title="Buy TP2", color=color.green, style=plot.style_line, linewidth=1)
plot(buySignal ? buyTP3 : na, title="Buy TP3", color=color.green, style=plot.style_line, linewidth=1)

plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP1 : na, title="Sell TP1", color=color.green, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP2 : na, title="Sell TP2", color=color.green, style=plot.style_line, linewidth=1)
plot(sellSignal ? sellTP3 : na, title="Sell TP3", color=color.green, style=plot.style_line, linewidth=1)

// === Floating Labels on Right Side ===
if buySignal
label.new(x=bar_index + 50, y=buySL, text="SL", style=label.style_label_right, color=color.red, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP1, text="TP1", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP2, text="TP2", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=buyTP3, text="TP3", style=label.style_label_right, color=color.green, textcolor=color.white)

if sellSignal
label.new(x=bar_index + 50, y=sellSL, text="SL", style=label.style_label_right, color=color.red, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP1, text="TP1", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP2, text="TP2", style=label.style_label_right, color=color.green, textcolor=color.white)
label.new(x=bar_index + 50, y=sellTP3, text="TP3", style=label.style_label_right, color=color.green, textcolor=color.white)

// === Signal Markers ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// === Alerts ===
alertcondition(buySignal, title="Buy Alert", message="🟢 BUY at Support Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="🟡 SELL at Resistance Zone + Price Action")

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.