//version=5
strategy("Dobro Signal 2.0", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === تنظیمات اندیکاتورها ===
rsiLength = input.int(14, title="RSI Length")
macdFast = input.int(12, title="MACD Fast")
macdSlow = input.int(26, title="MACD Slow")
macdSignal = input.int(9, title="MACD Signal")
bbLength = input.int(20, title="Bollinger Length")
bbMult = input.float(2.0, title="Bollinger Multiplier")
emaFast = ta.ema(close, 50)
emaSlow = ta.ema(close, 200)
// === Bollinger Bands ===
basis = ta.sma(close, bbLength)
dev = bbMult * ta.stdev(close, bbLength)
upper = basis + dev
lower = basis - dev
// === MACD & RSI ===
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)
rsi = ta.rsi(close, rsiLength)
// === شرایط ورود لانگ ===
longCondition = close < lower and macdLine > signalLine and rsi < 45 and emaFast > emaSlow
if (longCondition)
strategy.entry("Long", strategy.long)
// نسبت ریسک به ریوارد: 1 به 3 (مثلاً 2٪ SL و 6٪ TP)
strategy.exit("Take Profit Long", from_entry="Long", profit=6, loss=2)
// === شرایط ورود شورت ===
shortCondition = close > upper and macdLine < signalLine and rsi > 55 and emaFast < emaSlow
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit Short", from_entry="Short", profit=6, loss=2)
// === نمایش روی چارت ===
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === آلارم هشدار برای ورودها ===
alertcondition(longCondition, title="Buy Alert", message="Dobro Signal 2.0: Buy signal!")
alertcondition(shortCondition, title="Sell Alert", message="Dobro Signal 2.0: Sell signal!")
// === میانگینها و باندها برای کمک بصری ===
plot(emaFast, color=color.orange, title="EMA 50")
plot(emaSlow, color=color.blue, title="EMA 200")
plot(upper, color=color.purple, title="BB Upper")
plot(lower, color=color.purple, title="BB Lower")
strategy("Dobro Signal 2.0", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === تنظیمات اندیکاتورها ===
rsiLength = input.int(14, title="RSI Length")
macdFast = input.int(12, title="MACD Fast")
macdSlow = input.int(26, title="MACD Slow")
macdSignal = input.int(9, title="MACD Signal")
bbLength = input.int(20, title="Bollinger Length")
bbMult = input.float(2.0, title="Bollinger Multiplier")
emaFast = ta.ema(close, 50)
emaSlow = ta.ema(close, 200)
// === Bollinger Bands ===
basis = ta.sma(close, bbLength)
dev = bbMult * ta.stdev(close, bbLength)
upper = basis + dev
lower = basis - dev
// === MACD & RSI ===
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)
rsi = ta.rsi(close, rsiLength)
// === شرایط ورود لانگ ===
longCondition = close < lower and macdLine > signalLine and rsi < 45 and emaFast > emaSlow
if (longCondition)
strategy.entry("Long", strategy.long)
// نسبت ریسک به ریوارد: 1 به 3 (مثلاً 2٪ SL و 6٪ TP)
strategy.exit("Take Profit Long", from_entry="Long", profit=6, loss=2)
// === شرایط ورود شورت ===
shortCondition = close > upper and macdLine < signalLine and rsi > 55 and emaFast < emaSlow
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit Short", from_entry="Short", profit=6, loss=2)
// === نمایش روی چارت ===
plotshape(longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === آلارم هشدار برای ورودها ===
alertcondition(longCondition, title="Buy Alert", message="Dobro Signal 2.0: Buy signal!")
alertcondition(shortCondition, title="Sell Alert", message="Dobro Signal 2.0: Sell signal!")
// === میانگینها و باندها برای کمک بصری ===
plot(emaFast, color=color.orange, title="EMA 50")
plot(emaSlow, color=color.blue, title="EMA 200")
plot(upper, color=color.purple, title="BB Upper")
plot(lower, color=color.purple, title="BB Lower")
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.