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 في المنطقة المسموحة.")
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。