OPEN-SOURCE SCRIPT
EMRVA

//version=5
indicator("EMRVA", overlay=true)
// === الإعدادات ===
emaLength = input.int(200, "EMA Length")
rsiLength = input.int(14, "RSI Length")
volLength = input.int(20, "Volume MA Length")
adxLength = input.int(14, "ADX Length")
adxFilter = input.int(20, "ADX Minimum Value") // فلتر الاتجاه
// === EMA200 ===
ema200 = ta.ema(close, emaLength)
plot(ema200, color=color.orange, linewidth=2, title="EMA 200")
// === MACD ===
macdLine = ta.ema(close, 12) - ta.ema(close, 26)
signalLine = ta.ema(macdLine, 9)
// === RSI ===
rsi = ta.rsi(close, rsiLength)
// === Volume Confirmation ===
volMA = ta.sma(volume, volLength)
volCond = volume > volMA
// === ADX Manual Calculation ===
upMove = high - high[1]
downMove = low[1] - low
plusDM = na(upMove) ? na : (upMove > downMove and upMove > 0 ? upMove : 0)
minusDM = na(downMove) ? na : (downMove > upMove and downMove > 0 ? downMove : 0)
tr = ta.rma(ta.tr, adxLength)
plusDI = 100 * ta.rma(plusDM, adxLength) / tr
minusDI = 100 * ta.rma(minusDM, adxLength) / tr
dx = 100 * math.abs(plusDI - minusDI) / (plusDI + minusDI)
adx = ta.rma(dx, adxLength)
adxCond = adx > adxFilter
// === شروط الدخول والخروج ===
longCond = close > ema200 and macdLine > signalLine and rsi > 50 and volCond and adxCond
shortCond = close < ema200 and macdLine < signalLine and rsi < 50 and volCond and adxCond
// === منطق الإشارة عند بداية الاتجاه فقط ===
var inLong = false
var inShort = false
buySignal = longCond and not inLong
sellSignal = shortCond and not inShort
if buySignal
inLong := true
inShort := false
if sellSignal
inShort := true
inLong := false
// === إشارات ثابتة ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar,
color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar,
color=color.red, style=shape.labeldown, text="SELL")
// === تنبيهات ===
alertcondition(buySignal, title="Buy Alert", message="📈 إشارة شراء مؤكدة مع فلتر ADX")
alertcondition(sellSignal, title="Sell Alert", message="📉 إشارة بيع مؤكدة مع فلتر ADX")
// === رسم ADX للتأكيد ===
plot(adx, title="ADX", color=color.blue)
hline(adxFilter, "ADX Filter", color=color.red)
indicator("EMRVA", overlay=true)
// === الإعدادات ===
emaLength = input.int(200, "EMA Length")
rsiLength = input.int(14, "RSI Length")
volLength = input.int(20, "Volume MA Length")
adxLength = input.int(14, "ADX Length")
adxFilter = input.int(20, "ADX Minimum Value") // فلتر الاتجاه
// === EMA200 ===
ema200 = ta.ema(close, emaLength)
plot(ema200, color=color.orange, linewidth=2, title="EMA 200")
// === MACD ===
macdLine = ta.ema(close, 12) - ta.ema(close, 26)
signalLine = ta.ema(macdLine, 9)
// === RSI ===
rsi = ta.rsi(close, rsiLength)
// === Volume Confirmation ===
volMA = ta.sma(volume, volLength)
volCond = volume > volMA
// === ADX Manual Calculation ===
upMove = high - high[1]
downMove = low[1] - low
plusDM = na(upMove) ? na : (upMove > downMove and upMove > 0 ? upMove : 0)
minusDM = na(downMove) ? na : (downMove > upMove and downMove > 0 ? downMove : 0)
tr = ta.rma(ta.tr, adxLength)
plusDI = 100 * ta.rma(plusDM, adxLength) / tr
minusDI = 100 * ta.rma(minusDM, adxLength) / tr
dx = 100 * math.abs(plusDI - minusDI) / (plusDI + minusDI)
adx = ta.rma(dx, adxLength)
adxCond = adx > adxFilter
// === شروط الدخول والخروج ===
longCond = close > ema200 and macdLine > signalLine and rsi > 50 and volCond and adxCond
shortCond = close < ema200 and macdLine < signalLine and rsi < 50 and volCond and adxCond
// === منطق الإشارة عند بداية الاتجاه فقط ===
var inLong = false
var inShort = false
buySignal = longCond and not inLong
sellSignal = shortCond and not inShort
if buySignal
inLong := true
inShort := false
if sellSignal
inShort := true
inLong := false
// === إشارات ثابتة ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar,
color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar,
color=color.red, style=shape.labeldown, text="SELL")
// === تنبيهات ===
alertcondition(buySignal, title="Buy Alert", message="📈 إشارة شراء مؤكدة مع فلتر ADX")
alertcondition(sellSignal, title="Sell Alert", message="📉 إشارة بيع مؤكدة مع فلتر ADX")
// === رسم ADX للتأكيد ===
plot(adx, title="ADX", color=color.blue)
hline(adxFilter, "ADX Filter", color=color.red)
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。