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")
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
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.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
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.