OPEN-SOURCE SCRIPT
Telah dikemas kini

Confirmed Entry Grid Pro

231
//version=5
indicator("Confirmed Entry Grid Pro", overlay=true)

// === المتوسطات ===
ma9 = ta.sma(close, 9)
ma21 = ta.sma(close, 21)
ma200 = ta.sma(close, 200)

// === الاتجاه ===
trendBull = close > ma200
trendBear = close < ma200

// === الزخم ===
rsi = ta.rsi(close, 14)
rsiBull = rsi > 50
rsiBear = rsi < 50

// === الحجم ===
volMA = ta.sma(volume, 20)
volHigh = volume > volMA

// === شموع ابتلاعية ===
bullEngulf = close > open and open < close[1] and close > open[1]
bearEngulf = close < open and open > close[1] and close < open[1]

// === بولنجر باند ===
basis = ta.sma(close, 20)
dev = ta.stdev(close, 20)
upper = basis + 2 * dev
lower = basis - 2 * dev
bbBreakUp = close > upper
bbBreakDown = close < lower

// === دعم / مقاومة ديناميكية ===
support = ta.lowest(low, 20)
resistance = ta.highest(high, 20)
nearSupport = math.abs(close - support) / close < 0.015
nearResistance = math.abs(close - resistance) / close < 0.015

// === تقاطع المتوسطات ===
crossUp = ta.crossover(ma9, ma21)
crossDown = ta.crossunder(ma9, ma21)

// === ATR ===
atr = ta.atr(14)
atrActive = atr > ta.sma(atr, 14)

// === SMC: BOS + CHOCH ===
bosUp = high > high[1] and low > low[1]
bosDown = low < low[1] and high < high[1]
chochUp = close > high[2] and close[1] < high[2]
chochDown = close < low[2] and close[1] > low[2]
smcBuy = bosUp and chochUp
smcSell = bosDown and chochDown

// === مناطق السيولة ===
liqHigh = ta.highest(high, 30)[1]
liqLow = ta.lowest(low, 30)[1]
liquidityBuyZone = close < liqLow
liquiditySellZone = close > liqHigh

// === حساب النقاط لكل صفقة ===
buyScore = (trendBull ? 1 : 0) + (rsiBull ? 1 : 0) + (volHigh ? 1 : 0) + (bullEngulf ? 1 : 0) + (smcBuy ? 1 : 0) + (bbBreakUp ? 1 : 0) + (nearSupport ? 1 : 0) + (crossUp ? 1 : 0) + (atrActive ? 1 : 0) + (liquidityBuyZone ? 1 : 0)
sellScore = (trendBear ? 1 : 0) + (rsiBear ? 1 : 0) + (volHigh ? 1 : 0) + (bearEngulf ? 1 : 0) + (smcSell ? 1 : 0) + (bbBreakDown ? 1 : 0) + (nearResistance ? 1 : 0) + (crossDown ? 1 : 0) + (atrActive ? 1 : 0) + (liquiditySellZone ? 1 : 0)

// === شروط الإشارات مع منع التكرار خلال آخر 5 شموع ===
var int lastBuyBar = na
var int lastSellBar = na

canBuy = buyScore >= 5 and (na(lastBuyBar) or bar_index - lastBuyBar > 5)
canSell = sellScore >= 5 and (na(lastSellBar) or bar_index - lastSellBar > 5)

if canBuy
lastBuyBar := bar_index
if canSell
lastSellBar := bar_index

showBuy = canBuy
showSell = canSell

// === طول الخطوط ===
var int lineLen = 5

// === رسم الإشارات ===
plotshape(showBuy, title="BUY", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green)
plotshape(showSell, title="SELL", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)

// === خطوط الصفقة ===
var line[] buyLines = array.new_line(0)
var line[] sellLines = array.new_line(0)

if (showBuy)
entry = low
tpLevels = array.new_float(5)
array.set(tpLevels, 0, 0.618)
array.set(tpLevels, 1, 1.0)
array.set(tpLevels, 2, 1.272)
array.set(tpLevels, 3, 1.618)
array.set(tpLevels, 4, 2.0)
slLevel = -0.618
for i = 0 to 4
tp = entry + array.get(tpLevels, i) * atr
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
array.push(buyLines, line)
sl = entry + slLevel * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
array.push(buyLines, slLine)

if (showSell)
entry = high
tpLevels = array.new_float(5)
array.set(tpLevels, 0, -0.618)
array.set(tpLevels, 1, -1.0)
array.set(tpLevels, 2, -1.272)
array.set(tpLevels, 3, -1.618)
array.set(tpLevels, 4, -2.0)
slLevel = 0.618
for i = 0 to 4
tp = entry + array.get(tpLevels, i) * atr
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
array.push(sellLines, line)
sl = entry + slLevel * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
array.push(sellLines, slLine)

// === نسبة المخاطرة ===
label.new(bar_index, showBuy ? low : na, "Risk: 38.2%", style=label.style_label_left, textcolor=color.white, size=size.tiny, color=color.gray)
label.new(bar_index, showSell ? high : na, "Risk: 38.2%", style=label.style_label_left, textcolor=color.white, size=size.tiny, color=color.gray)
Nota Keluaran
//version=5
indicator("Confirmed Entry Grid Pro", overlay=true)

// === المتوسطات ===
ma9 = ta.sma(close, 9)
ma21 = ta.sma(close, 21)
ma200 = ta.sma(close, 200)

// === الاتجاه ===
trendBull = close > ma200
trendBear = close < ma200

// === الزخم ===
rsi = ta.rsi(close, 14)
rsiBull = rsi > 50
rsiBear = rsi < 50

// === الحجم ===
volMA = ta.sma(volume, 20)
volHigh = volume > volMA

// === شموع ابتلاعية ===
bullEngulf = close > open and open < close[1] and close > open[1]
bearEngulf = close < open and open > close[1] and close < open[1]

// === بولنجر باند ===
basis = ta.sma(close, 20)
dev = ta.stdev(close, 20)
upper = basis + 2 * dev
lower = basis - 2 * dev
bbBreakUp = close > upper
bbBreakDown = close < lower

// === دعم / مقاومة ديناميكية ===
support = ta.lowest(low, 20)
resistance = ta.highest(high, 20)
nearSupport = math.abs(close - support) / close < 0.015
nearResistance = math.abs(close - resistance) / close < 0.015

// === تقاطع المتوسطات ===
crossUp = ta.crossover(ma9, ma21)
crossDown = ta.crossunder(ma9, ma21)

// === ATR ===
atr = ta.atr(14)
atrActive = atr > ta.sma(atr, 14)

// === SMC: BOS + CHOCH ===
bosUp = high > high[1] and low > low[1]
bosDown = low < low[1] and high < high[1]
chochUp = close > high[2] and close[1] < high[2]
chochDown = close < low[2] and close[1] > low[2]
smcBuy = bosUp and chochUp
smcSell = bosDown and chochDown

// === مناطق السيولة ===
liqHigh = ta.highest(high, 30)[1]
liqLow = ta.lowest(low, 30)[1]
liquidityBuyZone = close < liqLow
liquiditySellZone = close > liqHigh

// === حساب النقاط لكل صفقة ===
buyScore = (trendBull ? 1 : 0) + (rsiBull ? 1 : 0) + (volHigh ? 1 : 0) + (bullEngulf ? 1 : 0) + (smcBuy ? 1 : 0) + (bbBreakUp ? 1 : 0) + (nearSupport ? 1 : 0) + (crossUp ? 1 : 0) + (atrActive ? 1 : 0) + (liquidityBuyZone ? 1 : 0)
sellScore = (trendBear ? 1 : 0) + (rsiBear ? 1 : 0) + (volHigh ? 1 : 0) + (bearEngulf ? 1 : 0) + (smcSell ? 1 : 0) + (bbBreakDown ? 1 : 0) + (nearResistance ? 1 : 0) + (crossDown ? 1 : 0) + (atrActive ? 1 : 0) + (liquiditySellZone ? 1 : 0)

// === شروط الإشارات مع منع التكرار خلال آخر 5 شموع ===
var int lastBuyBar = na
var int lastSellBar = na

canBuy = buyScore >= 5 and (na(lastBuyBar) or bar_index - lastBuyBar > 3)
canSell = sellScore >= 5 and (na(lastSellBar) or bar_index - lastSellBar > 3)

if canBuy
lastBuyBar := bar_index
if canSell
lastSellBar := bar_index

showBuy = canBuy
showSell = canSell

// === طول الخطوط ===
var int lineLen = 5

// === رسم الإشارات ===
plotshape(showBuy, title="BUY", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green)
plotshape(showSell, title="SELL", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)

// === خطوط الصفقة ===
var line[] buyLines = array.new_line(0)
var line[] sellLines = array.new_line(0)

if (showBuy)
entry = low
label.new(bar_index, entry, "Entry\n" + str.tostring(entry, format.mintick), style=label.style_label_left, textcolor=color.white, size=size.normal)
tpLevels = array.new_float(5)
array.set(tpLevels, 0, 0.618)
array.set(tpLevels, 1, 1.0)
array.set(tpLevels, 2, 1.272)
array.set(tpLevels, 3, 1.618)
array.set(tpLevels, 4, 2.0)
slLevel = -0.618
for i = 0 to 4
fibLabel = "TP" + str.tostring(i + 1) + " - Fib " + str.tostring(array.get(tpLevels, i))
tp = entry + array.get(tpLevels, i) * atr
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
label.new(bar_index + lineLen, tp, fibLabel + " (TP" + str.tostring(i + 1) + ")\n" + str.tostring(tp, format.mintick), style=label.style_label_right, textcolor=color.lime, size=size.normal)
array.push(buyLines, line)
sl = entry + slLevel * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
label.new(bar_index + lineLen, sl, "SL\n" + str.tostring(sl, format.mintick), style=label.style_label_right, textcolor=color.red, size=size.normal)
array.push(buyLines, slLine)

if (showSell)
entry = high
label.new(bar_index, entry, "Entry\n" + str.tostring(entry, format.mintick), style=label.style_label_left, textcolor=color.white, size=size.normal)
tpLevels = array.new_float(5)
array.set(tpLevels, 0, -0.618)
array.set(tpLevels, 1, -1.0)
array.set(tpLevels, 2, -1.272)
array.set(tpLevels, 3, -1.618)
array.set(tpLevels, 4, -2.0)
slLevel = 0.618
for i = 0 to 4
fibLabel = "TP" + str.tostring(i + 1) + " - Fib " + str.tostring(math.abs(array.get(tpLevels, i)))
tp = entry + array.get(tpLevels, i) * atr
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
label.new(bar_index + lineLen, tp, fibLabel + " (TP" + str.tostring(i + 1) + ")\n" + str.tostring(tp, format.mintick), style=label.style_label_right, textcolor=color.green, size=size.normal)
array.push(sellLines, line)
sl = entry + slLevel * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
label.new(bar_index + lineLen, sl, "SL\n" + str.tostring(sl, format.mintick), style=label.style_label_right, textcolor=color.red, size=size.normal)
array.push(sellLines, slLine)

// === متابعة نتائج الصفقة ===

// تحقق نجاح الصفقة (وصل أول TP)
buyHitTP = showBuy and high >= low + 0.618 * atr
sellHitTP = showSell and low <= high - 0.618 * atr

// تحقق فشل الصفقة (ضرب SL)
buyHitSL = showBuy and low <= low - 0.618 * atr
sellHitSL = showSell and high >= high + 0.618 * atr

// رسم الإشارة
plotshape(buyHitTP, title="Buy Success", style=shape.labelup, location=location.abovebar, color=color.green, size=size.small)
plotshape(sellHitTP, title="Sell Success", style=shape.labelup, location=location.abovebar, color=color.green, size=size.small)

plotshape(buyHitSL, title="Buy Failed", style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small)
plotshape(sellHitSL, title="Sell Failed", style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small)
Nota Keluaran
Q//version=5
indicator("Confirmed Entry Grid Pro", overlay=true,
max_lines_count=500, max_labels_count=500,
title="Confirmed Entry Grid Pro")

// === إعدادات المستخدم ===
showImpulse = input.bool(true, "Show Impulse Wave")
showShrinkWarning = input.bool(true, "Shrink Warning")
minConfirmations = input.int(5, "Minimum Confirmations", minval=3, maxval=10)

// === المتوسطات ===
Nota Keluaran
//version=5
indicator("Confirmed Entry Grid Pro", overlay=true,
max_lines_count=500, max_labels_count=500,
title="Confirmed Entry Grid Pro")

// === إعدادات المستخدم ===
showImpulse = input.bool(true, "Show Impulse Wave")
showShrinkWarning = input.bool(true, "Shrink Warning")
minConfirmations = input.int(5, "Minimum Confirmations", minval=3, maxval=10)

// === المتوسطات ===
ma9 = ta.sma(close, 9)
ma21 = ta.sma(close, 21)
ma200 = ta.sma(close, 200)

// === الاتجاه ===
trendBull = close > ma200
trendBear = close < ma200

// === الزخم ===
rsi = ta.rsi(close, 14)
rsiBull = rsi > 50
rsiBear = rsi < 50

// === الحجم ===
volMA = ta.sma(volume, 20)
volHigh = volume > volMA

// === شموع ابتلاعية ===
bullEngulf = close > open and open < close[1] and close > open[1]
bearEngulf = close < open and open > close[1] and close < open[1]

// === بولنجر باند ===
basis = ta.sma(close, 20)
dev = ta.stdev(close, 20)
upper = basis + 2 * dev
lower = basis - 2 * dev
bbBreakUp = close > upper
bbBreakDown = close < lower

// === دعم / مقاومة ديناميكية ===
support = ta.lowest(low, 20)
resistance = ta.highest(high, 20)
nearSupport = math.abs(close - support) / close < 0.015
nearResistance = math.abs(close - resistance) / close < 0.015

// === تقاطع المتوسطات ===
crossUp = ta.crossover(ma9, ma21)
crossDown = ta.crossunder(ma9, ma21)

// === ATR ===
atr = ta.atr(14)
atrActive = atr > ta.sma(atr, 14)

// === SMC: BOS + CHOCH + Impulsive Wave ===
bosUp = high > high[1] and low > low[1]
bosDown = low < low[1] and high < high[1]
chochUp = close > high[2] and close[1] < high[2]
chochDown = close < low[2] and close[1] > low[2]
smcBuy = bosUp and chochUp
smcSell = bosDown and chochDown

// === الموجة الدافعة (مؤشر اختياري لإشارة دخول قوية)
impulseWaveSell = close <= close[1] and close[1] <= close[2] and close[2] <= close[3] and close < open
impulseWave = close >= close[1] and close[1] >= close[2] and close[2] >= close[3] and close > open

// === مناطق السيولة ===
liqHigh = ta.highest(high, 30)[1]
liqLow = ta.lowest(low, 30)[1]
liquidityBuyZone = close < liqLow
liquiditySellZone = close > liqHigh

// === حساب النقاط لكل صفقة ===
buyScore = (trendBull ? 1 : 0) + (rsiBull ? 1 : 0) + (volHigh ? 1 : 0) + (bullEngulf ? 1 : 0) + (smcBuy ? 1 : 0) + (bbBreakUp ? 1 : 0) + (nearSupport ? 1 : 0) + (crossUp ? 1 : 0) + (atrActive ? 1 : 0) + (liquidityBuyZone ? 1 : 0)
sellScore = (trendBear ? 1 : 0) + (rsiBear ? 1 : 0) + (volHigh ? 1 : 0) + (bearEngulf ? 1 : 0) + (smcSell ? 1 : 0) + (bbBreakDown ? 1 : 0) + (nearResistance ? 1 : 0) + (crossDown ? 1 : 0) + (atrActive ? 1 : 0) + (liquiditySellZone ? 1 : 0)

// === شروط الإشارات مع منع التكرار خلال آخر 5 شموع ===
var int lastBuyBar = na
var int lastSellBar = na

canBuy = buyScore >= 5 and impulseWave and (na(lastBuyBar) or bar_index - lastBuyBar > 3)
canSell = sellScore >= 5 and impulseWaveSell and (na(lastSellBar) or bar_index - lastSellBar > 3)

if canBuy
lastBuyBar := bar_index
if canSell
lastSellBar := bar_index

showBuy = canBuy and buyScore >= minConfirmations
showSell = canSell and sellScore >= minConfirmations

// === طول الخطوط ===
var int lineLen = 5

// === رسم الإشارات ===
plotshape(showBuy, title="BUY", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green)
plotshape(showImpulse and impulseWave, title="Impulsive Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.lime, text="IB")
plotshape(showSell, title="SELL", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)
plotshape(showImpulse and impulseWaveSell, title="Impulsive Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.maroon, text="IS")

// === خطوط الصفقة ===
var line[] buyLines = array.new_line(0)
var line[] sellLines = array.new_line(0)

if (showBuy)
entry = close
label.new(bar_index, entry, "Entry\n" + str.tostring(entry, format.mintick), style=label.style_label_left, textcolor=color.white, size=size.normal)
tpLevels = array.from(0.618, 1.0, 1.272, 1.618, 2.0)
for i = 0 to array.size(tpLevels) - 1
fib = array.get(tpLevels, i)
tp = entry + fib * atr
fibLabel = "TP" + str.tostring(i + 1) + " - Fib " + str.tostring(fib)
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
label.new(bar_index + lineLen, tp, fibLabel + "\n" + str.tostring(tp, format.mintick), style=label.style_label_right, textcolor=color.lime, size=size.normal)
array.push(buyLines, line)
sl = entry - 0.618 * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
label.new(bar_index + lineLen, sl, "SL\n" + str.tostring(sl, format.mintick), style=label.style_label_right, textcolor=color.red, size=size.normal)
array.push(buyLines, slLine)

if (showSell)
entry = close
label.new(bar_index, entry, "Entry\n" + str.tostring(entry, format.mintick), style=label.style_label_left, textcolor=color.white, size=size.normal)
tpLevels = array.from(-0.618, -1.0, -1.272, -1.618, -2.0)
for i = 0 to array.size(tpLevels) - 1
fib = array.get(tpLevels, i)
tp = entry + fib * atr
fibLabel = "TP" + str.tostring(i + 1) + " - Fib " + str.tostring(math.abs(fib))
line = line.new(bar_index, tp, bar_index + lineLen, tp, color=color.green)
label.new(bar_index + lineLen, tp, fibLabel + "\n" + str.tostring(tp, format.mintick), style=label.style_label_right, textcolor=color.green, size=size.normal)
array.push(sellLines, line)
sl = entry + 0.618 * atr
slLine = line.new(bar_index, sl, bar_index + lineLen, sl, color=color.red)
label.new(bar_index + lineLen, sl, "SL\n" + str.tostring(sl, format.mintick), style=label.style_label_right, textcolor=color.red, size=size.normal)
array.push(sellLines, slLine)

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.