//@version=6
indicator("Edge Algo Pro Clean + SR Optimized Labels", overlay=true,
max_lines_count=500, max_labels_count=500)
//======================
// إعدادات المستخدم
//======================
entryBuffer = [Link](0.0, "Entry Price (Buffer)")
stopLossBuffer = [Link](0.0, "Stop Loss Price (Buffer)")
takeProfit1Buffer = [Link](0.0, "Take Profit 1")
takeProfit2Buffer = [Link](0.0, "Take Profit 2")
takeProfit3Buffer = [Link](0.0, "Take Profit 3")
rsiPeriod = [Link](14, "RSI Period")
macdFast = [Link](12, "MACD Fast")
macdSlow = [Link](26, "MACD Slow")
macdSignal = [Link](9, "MACD Signal")
candleStrength = [Link](0.5, "Candle Strength Filter")
// ألوان خطوطTP/SL
entryColor = [Link]([Link],0)
slColor = [Link]([Link],0)
tpColor1 = [Link]([Link],0)
tpColor2 = [Link]([Link],0)
tpColor3 = [Link]([Link],0)
// ألوان الدعم والمقاومة
srColor = [Link]([Link],80)
//======================
// المؤشرات
//======================
rsiValue = [Link](close, rsiPeriod)
[macdLine, signalLine, _] = [Link](close, macdFast, macdSlow, macdSignal)
bullishCandle = close > open and (close-open) > candleStrength*(high-low)
bearishCandle = open > close and (open-close) > candleStrength*(high-low)
//======================
// إشارات الدخول والخروج
//======================
longSignal = (rsiValue < 35 and macdLine > signalLine and bullishCandle)
shortSignal = (rsiValue > 65 and macdLine < signalLine and bearishCandle)
//======================
// أسعار ديناميكية
//======================
entryPrice = entryBuffer != 0.0 ? entryBuffer : close
stopLoss = stopLossBuffer != 0.0 ? stopLossBuffer : (longSignal ?
entryPrice*0.985 : entryPrice*1.015)
takeProfit1 = takeProfit1Buffer != 0.0 ? takeProfit1Buffer : (longSignal ?
entryPrice*1.02 : entryPrice*0.98)
takeProfit2 = takeProfit2Buffer != 0.0 ? takeProfit2Buffer : (longSignal ?
entryPrice*1.04 : entryPrice*0.96)
takeProfit3 = takeProfit3Buffer != 0.0 ? takeProfit3Buffer : (longSignal ?
entryPrice*1.06 : entryPrice*0.94)
//======================
// رسم إشاراتBUY/SELL فقط عند تحقق الشروط
//======================
plotshape(longSignal, title="Buy Signal", location=[Link],
color=[Link]([Link],0), style=[Link], size=[Link],
text="BUY")
plotshape(shortSignal, title="Sell Signal", location=[Link],
color=[Link]([Link],0), style=[Link], size=[Link],
text="SELL")
//======================
// رسم خطوطTP/SL ممتدة من اليسار إلى اليمين بدون تكرار
//======================
var line entryLine = na
var line slLine = na
var line tp1Line = na
var line tp2Line = na
var line tp3Line = na
if [Link]
[Link](entryLine)
[Link](slLine)
[Link](tp1Line)
[Link](tp2Line)
[Link](tp3Line)
entryLine := [Link](bar_index-100, entryPrice, bar_index+100, entryPrice,
color=entryColor, width=2)
slLine := [Link](bar_index-100, stopLoss, bar_index+100, stopLoss,
color=slColor, width=2)
tp1Line := [Link](bar_index-100, takeProfit1, bar_index+100, takeProfit1,
color=tpColor1, width=2)
tp2Line := [Link](bar_index-100, takeProfit2, bar_index+100, takeProfit2,
color=tpColor2, width=2)
tp3Line := [Link](bar_index-100, takeProfit3, bar_index+100, takeProfit3,
color=tpColor3, width=2)
//======================
// رسم مستطيالت الدعم والمقاومة
//======================
var box srBox = na
if [Link]
[Link](srBox)
srTop = [Link](high, 20)
srBottom = [Link](low, 20)
srBox := [Link](left=bar_index-20, top=srTop, right=bar_index,
bottom=srBottom, bgcolor=srColor)
//======================
// عرض الأسعار مرة واحدة فقط لكل خط
//======================
var label entryLbl = na
var label slLbl = na
var label tp1Lbl = na
var label tp2Lbl = na
var label tp3Lbl = na
if [Link]
if na(entryLbl)
entryLbl := [Link](bar_index, entryPrice, "Entry:
"+[Link](entryPrice), color=entryColor, textcolor=[Link],
style=label.style_label_left)
if na(slLbl)
slLbl := [Link](bar_index, stopLoss, "SL: "+[Link](stopLoss),
color=slColor, textcolor=[Link], style=label.style_label_left)
if na(tp1Lbl)
tp1Lbl := [Link](bar_index, takeProfit1, "TP1:
"+[Link](takeProfit1), color=tpColor1, textcolor=[Link],
style=label.style_label_left)
if na(tp2Lbl)
tp2Lbl := [Link](bar_index, takeProfit2, "TP2:
"+[Link](takeProfit2), color=tpColor2, textcolor=[Link],
style=label.style_label_left)
if na(tp3Lbl)
tp3Lbl := [Link](bar_index, takeProfit3, "TP3:
"+[Link](takeProfit3), color=tpColor3, textcolor=[Link],
style=label.style_label_left)
//======================
// تنبيهات
//======================
alertcondition(longSignal, title="Buy Alert", message="Edge Algo Pro Clean
Optimized: )"!فرصة شراء
alertcondition(shortSignal, title="Sell Alert", message="Edge Algo Pro Clean
Optimized: )"!فرصة بيع