OPEN-SOURCE SCRIPT
My script

/version=5
indicator("dvp - Engulfing Strategy", overlay=true)
// Moving Averages
sma1 = input.int(6,"Trend SMA")
ema1 = input.int(3,"Engulf EMA")
sma6 = ta.sma(close, sma1)
ema3 = ta.ema(close, ema1)
// Helper candles
c3 = close[2] < open[2] // 3 days ago was a red candle
c2 = close[1] > open[1] // 2 days ago was a green candle
engulfed = (low[1] < low[2]) and (high[1] > high[2]) // bullish engulfing
c0_bull = close > open // current candle is green
close_above_c2high = close > high[1]
c3_below_sma6 = close[2] < sma6[2]
c0_above_ema3 = close > ema3
// Bullish Engulfing Conditions
bullishSignal = c3 and c2 and engulfed and c0_bull and close_above_c2high and c3_below_sma6 and c0_above_ema3
// Plotting text for bullish engulfing
plotshape(bullishSignal, title="Bullish Engulfing", location=location.belowbar, color=color.green, style=shape.labelup, text="BuE")
// Optional: Bearish Engulfing Detection
c3_bear = close[2] > open[2] // 3 days ago green
c2_bear = close[1] < open[1] // 2 days ago red
engulfed_bear = (high[1] > high[2]) and (low[1] < low[2])
c0_bear = close < open // current red
close_below_c2low = close < low[1]
c3_above_sma6 = close[2] > sma6[2]
c0_below_ema3 = close < ema3
bearishSignal = c3_bear and c2_bear and engulfed_bear and c0_bear and close_below_c2low and c3_above_sma6 and c0_below_ema3
plotshape(bearishSignal, title="Bearish Engulfing", location=location.abovebar, color=color.red, style=shape.labeldown, text="BeU")
// Plotting Moving Averages
plot(sma6, color=color.orange, title="SMA 6")
plot(ema3, color=color.blue, title="EMA 3")
```
indicator("dvp - Engulfing Strategy", overlay=true)
// Moving Averages
sma1 = input.int(6,"Trend SMA")
ema1 = input.int(3,"Engulf EMA")
sma6 = ta.sma(close, sma1)
ema3 = ta.ema(close, ema1)
// Helper candles
c3 = close[2] < open[2] // 3 days ago was a red candle
c2 = close[1] > open[1] // 2 days ago was a green candle
engulfed = (low[1] < low[2]) and (high[1] > high[2]) // bullish engulfing
c0_bull = close > open // current candle is green
close_above_c2high = close > high[1]
c3_below_sma6 = close[2] < sma6[2]
c0_above_ema3 = close > ema3
// Bullish Engulfing Conditions
bullishSignal = c3 and c2 and engulfed and c0_bull and close_above_c2high and c3_below_sma6 and c0_above_ema3
// Plotting text for bullish engulfing
plotshape(bullishSignal, title="Bullish Engulfing", location=location.belowbar, color=color.green, style=shape.labelup, text="BuE")
// Optional: Bearish Engulfing Detection
c3_bear = close[2] > open[2] // 3 days ago green
c2_bear = close[1] < open[1] // 2 days ago red
engulfed_bear = (high[1] > high[2]) and (low[1] < low[2])
c0_bear = close < open // current red
close_below_c2low = close < low[1]
c3_above_sma6 = close[2] > sma6[2]
c0_below_ema3 = close < ema3
bearishSignal = c3_bear and c2_bear and engulfed_bear and c0_bear and close_below_c2low and c3_above_sma6 and c0_below_ema3
plotshape(bearishSignal, title="Bearish Engulfing", location=location.abovebar, color=color.red, style=shape.labeldown, text="BeU")
// Plotting Moving Averages
plot(sma6, color=color.orange, title="SMA 6")
plot(ema3, color=color.blue, title="EMA 3")
```
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.