OPEN-SOURCE SCRIPT
💼 Momentum SNR VIP

//version=5
indicator("Momentum", overlay=true)
// === SNR Detection ===
lookback = input.int(20, "Lookback for S/R", minval=5)
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
// Plot SNR Zones
plotshape(pivotHigh, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plotshape(pivotLow, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.small)
// === Price Action Detection ===
// Bullish Engulfing
bullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open <= close[1]
// Bearish Engulfing
bearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open >= close[1]
// Pin Bar Bullish
bullishPinBar = close > open and (low - math.min(open, close)) > 1.5 * (math.abs(close - open))
// Pin Bar Bearish
bearishPinBar = close < open and (math.max(open, close) - high) > 1.5 * (math.abs(close - open))
// === Combined Signal at SNR ===
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)
buySignal = (bullishEngulfing or bullishPinBar) and supportZone
sellSignal = (bearishEngulfing or bearishPinBar) and resistanceZone
// Plot Buy/Sell Arrows
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")
// === SL & TP Calculation ===
rr_ratio = input.float(2.0, "Risk Reward Ratio", minval=0.5, step=0.5)
buySL = low
buyTP = close + (close - low) * rr_ratio
sellSL = high
sellTP = close - (high - close) * rr_ratio
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP : na, title="Buy TP", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP : na, title="Sell TP", color=color.green, style=plot.style_linebr, linewidth=1)
// === Alerts ===
alertcondition(buySignal, title="Buy Alert", message="GOLD: Potential BUY @ SNR Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="GOLD: Potential SELL @ SNR Zone + Price Action")
indicator("Momentum", overlay=true)
// === SNR Detection ===
lookback = input.int(20, "Lookback for S/R", minval=5)
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
// Plot SNR Zones
plotshape(pivotHigh, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plotshape(pivotLow, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.small)
// === Price Action Detection ===
// Bullish Engulfing
bullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open <= close[1]
// Bearish Engulfing
bearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open >= close[1]
// Pin Bar Bullish
bullishPinBar = close > open and (low - math.min(open, close)) > 1.5 * (math.abs(close - open))
// Pin Bar Bearish
bearishPinBar = close < open and (math.max(open, close) - high) > 1.5 * (math.abs(close - open))
// === Combined Signal at SNR ===
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)
buySignal = (bullishEngulfing or bullishPinBar) and supportZone
sellSignal = (bearishEngulfing or bearishPinBar) and resistanceZone
// Plot Buy/Sell Arrows
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")
// === SL & TP Calculation ===
rr_ratio = input.float(2.0, "Risk Reward Ratio", minval=0.5, step=0.5)
buySL = low
buyTP = close + (close - low) * rr_ratio
sellSL = high
sellTP = close - (high - close) * rr_ratio
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP : na, title="Buy TP", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP : na, title="Sell TP", color=color.green, style=plot.style_linebr, linewidth=1)
// === Alerts ===
alertcondition(buySignal, title="Buy Alert", message="GOLD: Potential BUY @ SNR Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="GOLD: Potential SELL @ SNR Zone + Price Action")
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.