Alii
2025-01-31
Category: None

//@version=5
indicator("Custom Lux Algo-like Indicator", overlay=true)

// تنظیمات EMA
ema_length = input.int(20, title="EMA Length")
ema_value = ta.ema(close, ema_length)

// تنظیمات RSI
rsi_length = input.int(14, title="RSI Length")
rsi_value = ta.rsi(close, rsi_length)

// رسم EMA
plot(ema_value, color=color.blue, title="EMA")

// نمایش RSI در یک پنجره جداگانه
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
plot(rsi_value, color=color.purple, title="RSI")

// سیگنال‌های خرید و فروش
buy_signal = ta.crossover(rsi_value, 30) and close > ema_value
sell_signal = ta.crossunder(rsi_value, 70) or close < ema_value

plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// هشدارها
alertcondition(buy_signal, title="Buy Alert", message="BUY Signal Detected!")
alertcondition(sell_signal, title="Sell Alert", message="SELL Signal Detected!")