PROTECTED SOURCE SCRIPT
VIPDX

//version=5
indicator(title="VIPDX1", shorttitle="", overlay=true)
// التأكد من أن السوق هو XAUUSD فقط
isGold = syminfo.ticker == "XAUUSD"
// حساب شموع الهايكن آشي
haClose = (open + high + low + close) / 4
var float haOpen = na
haOpen := na(haOpen[1]) ? open : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))
// إعداد المعلمات
atr_len = input.int(3, "ATR Length", group="SuperTrend Settings")
fact = input.float(4, "SuperTrend Factor", group="SuperTrend Settings")
adxPeriod = input(2, title="ADX Filter Period", group="Filtering Settings")
adxThreshold = input(2, title="ADX Minimum Strength", group="Filtering Settings")
// حساب ATR
volatility = ta.atr(atr_len)
// حساب ADX يدويًا
upMove = high - high[1]
downMove = low[1] - low
plusDM = upMove > downMove and upMove > 0 ? upMove : 0
minusDM = downMove > upMove and downMove > 0 ? downMove : 0
smoothedPlusDM = ta.rma(plusDM, adxPeriod)
smoothedMinusDM = ta.rma(minusDM, adxPeriod)
smoothedATR = ta.rma(volatility, adxPeriod)
plusDI = (smoothedPlusDM / smoothedATR) * 100
minusDI = (smoothedMinusDM / smoothedATR) * 100
dx = math.abs(plusDI - minusDI) / (plusDI + minusDI) * 100
adx = ta.rma(dx, adxPeriod)
// حساب SuperTrend
pine_supertrend(factor, atr) =>
src = hl2
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
int _direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
_direction := 1
else if prevSuperTrend == prevUpperBand
_direction := close > upperBand ? -1 : 1
else
_direction := close < lowerBand ? 1 : -1
superTrend := _direction == -1 ? lowerBand : upperBand
[superTrend, _direction]
[ST, dir] = pine_supertrend(fact, volatility)
// فلتر التوقيت (من 8 صباحاً إلى 8 مساءً بتوقيت العراق UTC+3)
withinSession = time >= timestamp("Asia/Baghdad", year, month, dayofmonth, 8, 0) and time <= timestamp("Asia/Baghdad", year, month, dayofmonth, 20, 0)
// إشارات الدخول مع فلتر ADX والتوقيت
validTrend = adx > adxThreshold
longEntry = ta.crossunder(dir, 0) and isGold and validTrend and withinSession
shortEntry = ta.crossover(dir, 0) and isGold and validTrend and withinSession
// وقف الخسارة والهدف
pipSize = syminfo.mintick * 10
takeProfit = 150 * pipSize
stopLoss = 150 * pipSize
// حساب الأهداف والستوب بناءً على شمعة الدخول (haClose للشمعة الحالية)
longTP = haClose + takeProfit
longSL = haClose - stopLoss
shortTP = haClose - takeProfit
shortSL = haClose + stopLoss
// إشارات الدخول
plotshape(series=longEntry, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY")
plotshape(series=shortEntry, location=location.abovebar, color=color.red, style=shape.labeldown, title="SELL")
// رسم خطوط الأهداف ووقف الخسارة عند بداية الشمعة التالية للإشارة
if longEntry[1]
line.new(bar_index, haClose + takeProfit, bar_index + 10, haClose + takeProfit, color=color.green, width=2, style=line.style_dashed)
line.new(bar_index, haClose - stopLoss, bar_index + 10, haClose - stopLoss, color=color.red, width=2, style=line.style_dashed)
if shortEntry[1]
line.new(bar_index, haClose - takeProfit, bar_index + 10, haClose - takeProfit, color=color.green, width=2, style=line.style_dashed)
line.new(bar_index, haClose + stopLoss, bar_index + 10, haClose + stopLoss, color=color.red, width=2, style=line.style_dashed)
// إضافة تنبيهات
alertcondition(longEntry, title="Buy Alert", message="Gold Scalping - Buy Signal!")
alertcondition(shortEntry, title="Sell Alert", message="Gold Scalping - Sell Signal!")
indicator(title="VIPDX1", shorttitle="", overlay=true)
// التأكد من أن السوق هو XAUUSD فقط
isGold = syminfo.ticker == "XAUUSD"
// حساب شموع الهايكن آشي
haClose = (open + high + low + close) / 4
var float haOpen = na
haOpen := na(haOpen[1]) ? open : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))
// إعداد المعلمات
atr_len = input.int(3, "ATR Length", group="SuperTrend Settings")
fact = input.float(4, "SuperTrend Factor", group="SuperTrend Settings")
adxPeriod = input(2, title="ADX Filter Period", group="Filtering Settings")
adxThreshold = input(2, title="ADX Minimum Strength", group="Filtering Settings")
// حساب ATR
volatility = ta.atr(atr_len)
// حساب ADX يدويًا
upMove = high - high[1]
downMove = low[1] - low
plusDM = upMove > downMove and upMove > 0 ? upMove : 0
minusDM = downMove > upMove and downMove > 0 ? downMove : 0
smoothedPlusDM = ta.rma(plusDM, adxPeriod)
smoothedMinusDM = ta.rma(minusDM, adxPeriod)
smoothedATR = ta.rma(volatility, adxPeriod)
plusDI = (smoothedPlusDM / smoothedATR) * 100
minusDI = (smoothedMinusDM / smoothedATR) * 100
dx = math.abs(plusDI - minusDI) / (plusDI + minusDI) * 100
adx = ta.rma(dx, adxPeriod)
// حساب SuperTrend
pine_supertrend(factor, atr) =>
src = hl2
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
int _direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
_direction := 1
else if prevSuperTrend == prevUpperBand
_direction := close > upperBand ? -1 : 1
else
_direction := close < lowerBand ? 1 : -1
superTrend := _direction == -1 ? lowerBand : upperBand
[superTrend, _direction]
[ST, dir] = pine_supertrend(fact, volatility)
// فلتر التوقيت (من 8 صباحاً إلى 8 مساءً بتوقيت العراق UTC+3)
withinSession = time >= timestamp("Asia/Baghdad", year, month, dayofmonth, 8, 0) and time <= timestamp("Asia/Baghdad", year, month, dayofmonth, 20, 0)
// إشارات الدخول مع فلتر ADX والتوقيت
validTrend = adx > adxThreshold
longEntry = ta.crossunder(dir, 0) and isGold and validTrend and withinSession
shortEntry = ta.crossover(dir, 0) and isGold and validTrend and withinSession
// وقف الخسارة والهدف
pipSize = syminfo.mintick * 10
takeProfit = 150 * pipSize
stopLoss = 150 * pipSize
// حساب الأهداف والستوب بناءً على شمعة الدخول (haClose للشمعة الحالية)
longTP = haClose + takeProfit
longSL = haClose - stopLoss
shortTP = haClose - takeProfit
shortSL = haClose + stopLoss
// إشارات الدخول
plotshape(series=longEntry, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY")
plotshape(series=shortEntry, location=location.abovebar, color=color.red, style=shape.labeldown, title="SELL")
// رسم خطوط الأهداف ووقف الخسارة عند بداية الشمعة التالية للإشارة
if longEntry[1]
line.new(bar_index, haClose + takeProfit, bar_index + 10, haClose + takeProfit, color=color.green, width=2, style=line.style_dashed)
line.new(bar_index, haClose - stopLoss, bar_index + 10, haClose - stopLoss, color=color.red, width=2, style=line.style_dashed)
if shortEntry[1]
line.new(bar_index, haClose - takeProfit, bar_index + 10, haClose - takeProfit, color=color.green, width=2, style=line.style_dashed)
line.new(bar_index, haClose + stopLoss, bar_index + 10, haClose + stopLoss, color=color.red, width=2, style=line.style_dashed)
// إضافة تنبيهات
alertcondition(longEntry, title="Buy Alert", message="Gold Scalping - Buy Signal!")
alertcondition(shortEntry, title="Sell Alert", message="Gold Scalping - Sell Signal!")
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。