//@version=5
indicator("EMA Cross with RSI Confirmation", overlay=true)
// ورودیهای قابل تنظیم
fastLength = input.int(9, title="Fast EMA Period", minval=1)
slowLength = input.int(21, title="Slow EMA Period", minval=1)
rsiLength = input.int(14, title="RSI Period", minval=1)
rsiOverbought = input.int(70, title="RSI Overbought Level", minval=1, maxval=100)
rsiOversold = input.int(30, title="RSI Oversold Level", minval=1, maxval=100)
// محاسبهEMA وRSI
fastEMA = ta.ema(close, fastLength)
slowEMA = ta.ema(close, slowLength)
rsi = ta.rsi(close, rsiLength)
// سیگنال خرید و فروش
buySignal = ta.crossover(fastEMA, slowEMA) and rsi < rsiOverbought
sellSignal = ta.crossunder(fastEMA, slowEMA) and rsi > rsiOversold
// رسم سیگنالها روی چارت
plotshape(buySignal, title="Buy Signal", location=location.belowbar,
color=color.green, style=shape.labelup, text="BUY", size=size.small)
plotshape(sellSignal, title="Sell Signal", location=location.abovebar,
color=color.red, style=shape.labeldown, text="SELL", size=size.small)
// رسمEMAها روی چارت
plot(fastEMA, title="Fast EMA", color=color.blue, linewidth=2)
plot(slowEMA, title="Slow EMA", color=color.red, linewidth=2)