PROTECTED SOURCE SCRIPT

EMA Pullback Entry Strategy with Stop-Loss and Take-Profit

61
//version=5
indicator("EMA Pullback Entry Strategy with Stop-Loss and Take-Profit", overlay=true)

// Input parameters
ema50Length = input.int(50, title="EMA 50 Length")
ema100Length = input.int(100, title="EMA 100 Length")
ema200Length = input.int(200, title="EMA 200 Length")
stopLossPerc = input.float(1.0, title="Stop-Loss (%)", step=0.1) / 100
takeProfitPerc = input.float(2.0, title="Take-Profit (%)", step=0.1) / 100

// EMA Calculations
ema50 = ta.ema(close, ema50Length)
ema100 = ta.ema(close, ema100Length)
ema200 = ta.ema(close, ema200Length)

// Plot EMAs
plot(ema50, color=color.blue, title="EMA 50", linewidth=2)
plot(ema100, color=color.orange, title="EMA 100", linewidth=2)
plot(ema200, color=color.red, title="EMA 200", linewidth=2)

// Pullback Condition
pullbackCondition = ta.crossunder(low, ema50) or ta.crossunder(low, ema100) or ta.crossunder(low, ema200)

// Entry Condition
entryCondition = close > ema50 and pullbackCondition

// Stop-Loss and Take-Profit Levels
stopLossLevel = close * (1 - stopLossPerc)
takeProfitLevel = close * (1 + takeProfitPerc)

// Plot Entry Signals
plotshape(series=entryCondition, title="Entry Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy", offset=-1)

// Plot Stop-Loss and Take-Profit Levels
plot(stopLossLevel, color=color.red, title="Stop-Loss", linewidth=2, style=plot.style_linebr)
plot(takeProfitLevel, color=color.green, title="Take-Profit", linewidth=2, style=plot.style_linebr)

// Alerts
alertcondition(entryCondition, title="Entry Alert", message="Entry Signal Detected")

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.