OPEN-SOURCE SCRIPT
Golden Cross RSI Daily Helper (US Stocks)

//version=5
indicator("Golden Cross RSI Daily Helper (US Stocks)", overlay=true, timeframe="D", timeframe_gaps=true)
//========= الإعدادات الأساسية =========//
emaFastLen = input.int(50, "EMA سريع (اتجاه قصير المدى)")
emaSlowLen = input.int(200, "EMA بطيء (اتجاه طويل المدى)")
rsiLen = input.int(14, "فترة RSI")
rsiMin = input.float(40.0, "حد RSI الأدنى للدخول", 0.0, 100.0)
rsiMax = input.float(60.0, "حد RSI الأعلى للدخول", 0.0, 100.0)
slBufferPerc = input.float(1.5, "نسبة البفر لوقف الخسارة (%) أسفل/أعلى EMA200", 0.1, 5.0)
rrRatio = input.float(2.0, "نسبة العائد إلى المخاطرة (R:R)", 1.0, 5.0)
//========= حساب المؤشرات =========//
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
rsiVal = ta.rsi(close, rsiLen)
// اتجاه السوق
trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow
// ارتداد السعر من EMA50 أو EMA200 تقريبياً
bounceFromEmaFast = close > emaFast and low <= emaFast
bounceFromEmaSlow = close > emaSlow and low <= emaSlow
bounceLong = bounceFromEmaFast or bounceFromEmaSlow
bounceFromEmaFastShort = close < emaFast and high >= emaFast
bounceFromEmaSlowShort = close < emaSlow and high >= emaSlow
bounceShort = bounceFromEmaFastShort or bounceFromEmaSlowShort
// فلتر RSI
rsiOk = rsiVal >= rsiMin and rsiVal <= rsiMax
//========= شروط الدخول =========//
// شراء
longSignal = trendUp and bounceLong and rsiOk
// بيع
shortSignal = trendDown and bounceShort and rsiOk
//========= حساب وقف الخسارة والأهداف =========//
// نستخدم سعر إغلاق شمعة الإشارة كسعر دخول افتراضي
entryPriceLong = close
entryPriceShort = close
// وقف الخسارة حسب EMA200 + البفر
slLong = emaSlow * (1.0 - slBufferPerc / 100.0)
slShort = emaSlow * (1.0 + slBufferPerc / 100.0)
// المسافة بين الدخول ووقف الخسارة
riskLong = math.max(entryPriceLong - slLong, syminfo.mintick)
riskShort = math.max(slShort - entryPriceShort, syminfo.mintick)
// هدف الربح حسب R:R
tpLong = entryPriceLong + rrRatio * riskLong
tpShort = entryPriceShort - rrRatio * riskShort
//========= الرسم على الشارت =========//
// رسم المتوسطات
plot(emaFast, title="EMA 50", color=color.new(color.blue, 0), linewidth=2)
plot(emaSlow, title="EMA 200", color=color.new(color.orange, 0), linewidth=2)
// تلوين الخلفية حسب الاتجاه
bgcolor(trendUp ? color.new(color.green, 92) : trendDown ? color.new(color.red, 92) : na)
// إشارة شراء
plotshape(
longSignal,
title = "إشارة شراء",
style = shape.triangleup,
location = location.belowbar,
size = size.large,
color = color.new(color.green, 0),
text = "BUY")
// إشارة بيع
plotshape(
shortSignal,
title = "إشارة بيع",
style = shape.triangledown,
location = location.abovebar,
size = size.large,
color = color.new(color.red, 0),
text = "SELL")
// رسم SL و TP عند ظهور الإشارة
slPlotLong = longSignal ? slLong : na
tpPlotLong = longSignal ? tpLong : na
slPlotShort = shortSignal ? slShort : na
tpPlotShort = shortSignal ? tpShort : na
plot(slPlotLong, title="وقف خسارة شراء", color=color.new(color.red, 0), style=plot.style_linebr)
plot(tpPlotLong, title="هدف شراء", color=color.new(color.green, 0), style=plot.style_linebr)
plot(slPlotShort, title="وقف خسارة بيع", color=color.new(color.red, 0), style=plot.style_linebr)
plot(tpPlotShort, title="هدف بيع", color=color.new(color.green, 0), style=plot.style_linebr)
//========= إعداد التنبيهات =========//
alertcondition(longSignal, title="تنبيه إشارة شراء", message="إشارة شراء: ترند صاعد + ارتداد من EMA + RSI في المنطقة المسموحة.")
alertcondition(shortSignal, title="تنبيه إشارة بيع", message="إشارة بيع: ترند هابط + ارتداد من EMA + RSI في المنطقة المسموحة.")
indicator("Golden Cross RSI Daily Helper (US Stocks)", overlay=true, timeframe="D", timeframe_gaps=true)
//========= الإعدادات الأساسية =========//
emaFastLen = input.int(50, "EMA سريع (اتجاه قصير المدى)")
emaSlowLen = input.int(200, "EMA بطيء (اتجاه طويل المدى)")
rsiLen = input.int(14, "فترة RSI")
rsiMin = input.float(40.0, "حد RSI الأدنى للدخول", 0.0, 100.0)
rsiMax = input.float(60.0, "حد RSI الأعلى للدخول", 0.0, 100.0)
slBufferPerc = input.float(1.5, "نسبة البفر لوقف الخسارة (%) أسفل/أعلى EMA200", 0.1, 5.0)
rrRatio = input.float(2.0, "نسبة العائد إلى المخاطرة (R:R)", 1.0, 5.0)
//========= حساب المؤشرات =========//
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
rsiVal = ta.rsi(close, rsiLen)
// اتجاه السوق
trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow
// ارتداد السعر من EMA50 أو EMA200 تقريبياً
bounceFromEmaFast = close > emaFast and low <= emaFast
bounceFromEmaSlow = close > emaSlow and low <= emaSlow
bounceLong = bounceFromEmaFast or bounceFromEmaSlow
bounceFromEmaFastShort = close < emaFast and high >= emaFast
bounceFromEmaSlowShort = close < emaSlow and high >= emaSlow
bounceShort = bounceFromEmaFastShort or bounceFromEmaSlowShort
// فلتر RSI
rsiOk = rsiVal >= rsiMin and rsiVal <= rsiMax
//========= شروط الدخول =========//
// شراء
longSignal = trendUp and bounceLong and rsiOk
// بيع
shortSignal = trendDown and bounceShort and rsiOk
//========= حساب وقف الخسارة والأهداف =========//
// نستخدم سعر إغلاق شمعة الإشارة كسعر دخول افتراضي
entryPriceLong = close
entryPriceShort = close
// وقف الخسارة حسب EMA200 + البفر
slLong = emaSlow * (1.0 - slBufferPerc / 100.0)
slShort = emaSlow * (1.0 + slBufferPerc / 100.0)
// المسافة بين الدخول ووقف الخسارة
riskLong = math.max(entryPriceLong - slLong, syminfo.mintick)
riskShort = math.max(slShort - entryPriceShort, syminfo.mintick)
// هدف الربح حسب R:R
tpLong = entryPriceLong + rrRatio * riskLong
tpShort = entryPriceShort - rrRatio * riskShort
//========= الرسم على الشارت =========//
// رسم المتوسطات
plot(emaFast, title="EMA 50", color=color.new(color.blue, 0), linewidth=2)
plot(emaSlow, title="EMA 200", color=color.new(color.orange, 0), linewidth=2)
// تلوين الخلفية حسب الاتجاه
bgcolor(trendUp ? color.new(color.green, 92) : trendDown ? color.new(color.red, 92) : na)
// إشارة شراء
plotshape(
longSignal,
title = "إشارة شراء",
style = shape.triangleup,
location = location.belowbar,
size = size.large,
color = color.new(color.green, 0),
text = "BUY")
// إشارة بيع
plotshape(
shortSignal,
title = "إشارة بيع",
style = shape.triangledown,
location = location.abovebar,
size = size.large,
color = color.new(color.red, 0),
text = "SELL")
// رسم SL و TP عند ظهور الإشارة
slPlotLong = longSignal ? slLong : na
tpPlotLong = longSignal ? tpLong : na
slPlotShort = shortSignal ? slShort : na
tpPlotShort = shortSignal ? tpShort : na
plot(slPlotLong, title="وقف خسارة شراء", color=color.new(color.red, 0), style=plot.style_linebr)
plot(tpPlotLong, title="هدف شراء", color=color.new(color.green, 0), style=plot.style_linebr)
plot(slPlotShort, title="وقف خسارة بيع", color=color.new(color.red, 0), style=plot.style_linebr)
plot(tpPlotShort, title="هدف بيع", color=color.new(color.green, 0), style=plot.style_linebr)
//========= إعداد التنبيهات =========//
alertcondition(longSignal, title="تنبيه إشارة شراء", message="إشارة شراء: ترند صاعد + ارتداد من EMA + RSI في المنطقة المسموحة.")
alertcondition(shortSignal, title="تنبيه إشارة بيع", message="إشارة بيع: ترند هابط + ارتداد من EMA + RSI في المنطقة المسموحة.")
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.