OPEN-SOURCE SCRIPT
Pro Trend Buy/Sell/Exit [Copilot]

//version=5
indicator("Pro Trend Buy/Sell/Exit [Copilot]", overlay=true, max_labels_count=500)
// إعدادات قابلة للتخصيص
emaLength = input.int(55, "EMA Length")
rsiLength = input.int(14, "RSI Length")
rsiOverbought = input.float(70, "RSI Overbought")
rsiOversold = input.float(30, "RSI Oversold")
macdFastLen = input.int(12, "MACD Fast Length")
macdSlowLen = input.int(26, "MACD Slow Length")
macdSignalLen = input.int(9, "MACD Signal Length")
supertrendFactor = input.float(3, "Supertrend Factor")
supertrendATRlen = input.int(10, "Supertrend ATR Length")
showBuySellLabels = input.bool(true, "Show Buy/Sell Labels")
showExitLabels = input.bool(true, "Show Exit Labels")
// المؤشرات
ema = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
macdLine = ta.ema(close, macdFastLen) - ta.ema(close, macdSlowLen)
macdSignal = ta.ema(macdLine, macdSignalLen)
[supertrend, direction] = ta.supertrend(supertrendFactor, supertrendATRlen)
// حساب DMI (بديل ADX)
len = input.int(14, "DMI Length")
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plusDI = 100 * ta.rma(plusDM, len) / trur
minusDI = 100 * ta.rma(minusDM, len) / trur
adx = ta.rma(math.abs(plusDI - minusDI) / (plusDI + minusDI) * 100, len)
// شروط الترند
trendUp = close > ema and adx > 25 and macdLine > macdSignal and direction == 1
trendDown = close < ema and adx > 25 and macdLine < macdSignal and direction == -1
// إشارات الدخول
buySignal = trendUp and ta.crossover(macdLine, macdSignal) and rsi > rsiOversold
sellSignal = trendDown and ta.crossunder(macdLine, macdSignal) and rsi < rsiOverbought
// إشارات الخروج
exitLong = buySignal[1] and (ta.crossunder(close, ema) or adx < 20 or ta.crossunder(rsi, 50) or direction == -1)
exitShort = sellSignal[1] and (ta.crossover(close, ema) or adx < 20 or ta.crossover(rsi, 50) or direction == 1)
// رسم الإشارات على الرسم البياني
plotshape(buySignal and showBuySellLabels, style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", size=size.large)
plotshape(sellSignal and showBuySellLabels, style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", size=size.large)
plotshape(exitLong and showExitLabels, style=shape.xcross, location=location.abovebar, color=color.orange, text="Exit Long", size=size.large)
plotshape(exitShort and showExitLabels, style=shape.xcross, location=location.belowbar, color=color.purple, text="Exit Short", size=size.large)
// إشعارات للبوت
alertcondition(buySignal, title="Buy Signal", message="BUY Signal on {{ticker}} at {{close}}")
alertcondition(sellSignal, title="Sell Signal", message="SELL Signal on {{ticker}} at {{close}}")
alertcondition(exitLong, title="Exit Long", message="EXIT LONG on {{ticker}} at {{close}}")
alertcondition(exitShort, title="Exit Short", message="EXIT SHORT on {{ticker}} at {{close}}")
indicator("Pro Trend Buy/Sell/Exit [Copilot]", overlay=true, max_labels_count=500)
// إعدادات قابلة للتخصيص
emaLength = input.int(55, "EMA Length")
rsiLength = input.int(14, "RSI Length")
rsiOverbought = input.float(70, "RSI Overbought")
rsiOversold = input.float(30, "RSI Oversold")
macdFastLen = input.int(12, "MACD Fast Length")
macdSlowLen = input.int(26, "MACD Slow Length")
macdSignalLen = input.int(9, "MACD Signal Length")
supertrendFactor = input.float(3, "Supertrend Factor")
supertrendATRlen = input.int(10, "Supertrend ATR Length")
showBuySellLabels = input.bool(true, "Show Buy/Sell Labels")
showExitLabels = input.bool(true, "Show Exit Labels")
// المؤشرات
ema = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
macdLine = ta.ema(close, macdFastLen) - ta.ema(close, macdSlowLen)
macdSignal = ta.ema(macdLine, macdSignalLen)
[supertrend, direction] = ta.supertrend(supertrendFactor, supertrendATRlen)
// حساب DMI (بديل ADX)
len = input.int(14, "DMI Length")
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plusDI = 100 * ta.rma(plusDM, len) / trur
minusDI = 100 * ta.rma(minusDM, len) / trur
adx = ta.rma(math.abs(plusDI - minusDI) / (plusDI + minusDI) * 100, len)
// شروط الترند
trendUp = close > ema and adx > 25 and macdLine > macdSignal and direction == 1
trendDown = close < ema and adx > 25 and macdLine < macdSignal and direction == -1
// إشارات الدخول
buySignal = trendUp and ta.crossover(macdLine, macdSignal) and rsi > rsiOversold
sellSignal = trendDown and ta.crossunder(macdLine, macdSignal) and rsi < rsiOverbought
// إشارات الخروج
exitLong = buySignal[1] and (ta.crossunder(close, ema) or adx < 20 or ta.crossunder(rsi, 50) or direction == -1)
exitShort = sellSignal[1] and (ta.crossover(close, ema) or adx < 20 or ta.crossover(rsi, 50) or direction == 1)
// رسم الإشارات على الرسم البياني
plotshape(buySignal and showBuySellLabels, style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", size=size.large)
plotshape(sellSignal and showBuySellLabels, style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", size=size.large)
plotshape(exitLong and showExitLabels, style=shape.xcross, location=location.abovebar, color=color.orange, text="Exit Long", size=size.large)
plotshape(exitShort and showExitLabels, style=shape.xcross, location=location.belowbar, color=color.purple, text="Exit Short", size=size.large)
// إشعارات للبوت
alertcondition(buySignal, title="Buy Signal", message="BUY Signal on {{ticker}} at {{close}}")
alertcondition(sellSignal, title="Sell Signal", message="SELL Signal on {{ticker}} at {{close}}")
alertcondition(exitLong, title="Exit Long", message="EXIT LONG on {{ticker}} at {{close}}")
alertcondition(exitShort, title="Exit Short", message="EXIT SHORT on {{ticker}} at {{close}}")
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.