1

4
//version=5
indicator("Fibonacci Strategy with RSI & MACD", overlay=true)

// إعدادات فيبوناتشي
fib_high = ta.highest(high, 50)
fib_low = ta.lowest(low, 50)
diff = fib_high - fib_low

// مستويات فيبوناتشي
fib_236 = fib_high - diff * 0.236
fib_382 = fib_high - diff * 0.382
fib_500 = fib_high - diff * 0.500
fib_618 = fib_high - diff * 0.618
fib_786 = fib_high - diff * 0.786

// رسم مستويات فيبوناتشي
hline(fib_236, "23.6%", color=color.blue)
hline(fib_382, "38.2%", color=color.orange)
hline(fib_500, "50.0%", color=color.green)
hline(fib_618, "61.8%", color=color.red)
hline(fib_786, "78.6%", color=color.purple)

// إعدادات RSI
rsi_length = input(14, title="RSI Length")
rsi_overbought = input(70, title="RSI Overbought Level")
rsi_oversold = input(30, title="RSI Oversold Level")
rsi = ta.rsi(close, rsi_length)

// إعدادات MACD
[macd_line, signal_line, _] = ta.macd(close, 12, 26, 9)

// إشارات الدخول
long_condition = close > fib_618 and rsi < rsi_overbought and macd_line > signal_line
short_condition = close < fib_382 and rsi > rsi_oversold and macd_line < signal_line

// تحديد حد الربح ووقف الخسارة
take_profit_percent = input(1.5, title="Take Profit (%)") / 100
stop_loss_percent = input(1.0, title="Stop Loss (%)") / 100

take_profit_long = close * (1 + take_profit_percent)
stop_loss_long = close * (1 - stop_loss_percent)

take_profit_short = close * (1 - take_profit_percent)
stop_loss_short = close * (1 + stop_loss_percent)

// رسم إشارات الدخول
if (long_condition)
label.new(bar_index, high, text="شراء 🟢", style=label.style_circle, color=color.green, textcolor=color.white)
line.new(bar_index, close, bar_index + 20, take_profit_long, color=color.green, width=2)
line.new(bar_index, close, bar_index + 20, stop_loss_long, color=color.red, width=2)

if (short_condition)
label.new(bar_index, low, text="بيع 🔴", style=label.style_circle, color=color.red, textcolor=color.white)
line.new(bar_index, close, bar_index + 20, take_profit_short, color=color.red, width=2)
line.new(bar_index, close, bar_index + 20, stop_loss_short, color=color.green, width=2)

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.