1
2025-02-16
Category: None

//@version=5
indicator("ربات ترید پیشرفته", overlay=true)

//---- تنظیمات اندیکاتورها ----
// Moving Average
fastMA = ta.sma(close, 9)
slowMA = ta.sma(close, 21)
plot(fastMA, color=color.blue, title="MA سریع")
plot(slowMA, color=color.red, title="MA کند")

// MACD
  = ta.macd(close, 12, 26, 9)
plot(macdLine, color=color.green, title="MACD")
plot(signalLine, color=color.orange, title="سیگنال MACD")

// RSI
rsiValue = ta.rsi(close, 14)
oversold = 30
overbought = 70

// الگوی کندل Engulfing
bullishEngulfing = (close  < open ) and (close > open) and (close > open ) and (open < close )
bearishEngulfing = (close  > open ) and (close < open) and (close < open ) and (open > close )

//---- شرایط سیگنال ----
// سیگنال خرید:
buyCondition = 
  (fastMA > slowMA) and 
  (macdLine > signalLine) and 
  (rsiValue < oversold) and 
  bullishEngulfing

// سیگنال فروش:
sellCondition = 
  (fastMA < slowMA) and 
  (macdLine < signalLine) and 
  (rsiValue > overbought) and 
  bearishEngulfing

//---- نمایش سیگنالها ----
plotshape(buyCondition, title="خرید", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellCondition, title="فروش", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")