OPEN-SOURCE SCRIPT
ashknany.trading

//version=6
indicator(
"ashknany.trading",
shorttitle = "ashknany.trading",
overlay = true,
max_lines_count = 500,
max_labels_count = 500,
max_boxes_count = 100,
max_bars_back = 5000
)
//=====================================================================
// الإعدادات
//=====================================================================
// إعدادات النقاط والأهداف
pipValue = input.float(0.10, "قيمة الـ Pip بالسعر", step = 0.01, minval = 0.001, group = "🎯 الأهداف ووقف الخسارة")
targetPips = input.int(40, "المسافة بين الأهداف Pip", minval = 1, group = "🎯 الأهداف ووقف الخسارة")
stopPips = input.int(40, "وقف الخسارة Pip", minval = 1, group = "🎯 الأهداف ووقف الخسارة")
lineBars = input.int(60, "طول خطوط الصفقة", minval = 10, maxval = 300, group = "🎯 الأهداف ووقف الخسارة")
// إعدادات الدعم والمقاومة
pivotLength = input.int(8, "قوة الدعم والمقاومة", minval = 2, maxval = 50, group = "📊 الدعم والمقاومة")
showSR = input.bool(true, "إظهار الدعم والمقاومة", group = "📊 الدعم والمقاومة")
// إعدادات الأوردر بلوك
obLookback = input.int(15, "البحث عن الأوردر بلوك", minval = 3, maxval = 50, group = "📦 الأوردر بلوك")
showOB = input.bool(true, "إظهار مناطق الأوردر بلوك", group = "📦 الأوردر بلوك")
useBodyOnly = input.bool(false, "استخدام جسم الشمعة فقط", group = "📦 الأوردر بلوك")
// إعدادات الفيبوناتشي
showFib = input.bool(true, "إظهار مستويات الفيبوناتشي", group = "📐 الفيبوناتشي")
useFibFilter = input.bool(true, "اشتراط توافق الدخول مع الفيبوناتشي", group = "📐 الفيبوناتشي")
// فلتر الاتجاه
emaLength = input.int(50, "طول EMA", minval = 1, group = "⚙️ فلتر الاتجاه")
useEMAFilter = input.bool(true, "استخدام فلتر الاتجاه EMA", group = "⚙️ فلتر الاتجاه")
showEMA = input.bool(true, "إظهار EMA", group = "⚙️ فلتر الاتجاه")
// إعدادات الإشارات
cooldownBars = input.int(10, "الفاصل بين الإشارات", minval = 1, group = "🔔 إشارات الدخول")
confirmClose = input.bool(true, "انتظار إغلاق الشمعة", group = "🔔 إشارات الدخول")
//=====================================================================
// الحسابات الأساسية
//=====================================================================
targetDistance = targetPips * pipValue
stopDistance = stopPips * pipValue
emaTrend = ta.ema(close, emaLength)
atrValue = ta.atr(14)
plot(
showEMA ? emaTrend : na,
title = "EMA",
color = color.new(color.blue, 20),
linewidth = 2
)
//=====================================================================
// الدعم والمقاومة
//=====================================================================
pivotHigh = ta.pivothigh(high, pivotLength, pivotLength)
pivotLow = ta.pivotlow(low, pivotLength, pivotLength)
var float resistanceLevel = na
var float supportLevel = na
var int resistanceBar = na
var int supportBar = na
if not na(pivotHigh)
resistanceLevel := pivotHigh
resistanceBar := bar_index - pivotLength
if not na(pivotLow)
supportLevel := pivotLow
supportBar := bar_index - pivotLength
plot(
showSR ? resistanceLevel : na,
title = "المقاومة",
color = color.orange,
linewidth = 2,
style = plot.style_stepline
)
plot(
showSR ? supportLevel : na,
title = "الدعم",
color = color.orange,
linewidth = 2,
style = plot.style_stepline
)
//=====================================================================
// كسر الهيكل
//=====================================================================
bullishBreak =
not na(resistanceLevel) and
close > resistanceLevel and
close[1] <= resistanceLevel
bearishBreak =
not na(supportLevel) and
close < supportLevel and
close[1] >= supportLevel
//=====================================================================
// اكتشاف الأوردر بلوك
// آخر شمعة هابطة قبل الكسر الصاعد
// وآخر شمعة صاعدة قبل الكسر الهابط
//=====================================================================
var float bullishOBHigh = na
var float bullishOBLow = na
var int bullishOBBar = na
var float bearishOBHigh = na
var float bearishOBLow = na
var int bearishOBBar = na
var box bullishOBBox = na
var box bearishOBBox = na
if bullishBreak
float foundBullHigh = na
float foundBullLow = na
int foundBullBar = na
for i = 1 to obLookback
if na(foundBullBar) and close < open
foundBullHigh := useBodyOnly ? open : high
foundBullLow := useBodyOnly ? close : low
foundBullBar := bar_index - i
if not na(foundBullBar)
bullishOBHigh := foundBullHigh
bullishOBLow := foundBullLow
bullishOBBar := foundBullBar
if not na(bullishOBBox)
box.delete(bullishOBBox)
if showOB
bullishOBBox := box.new(
left = bullishOBBar,
top = bullishOBHigh,
right = bar_index + 100,
bottom = bullishOBLow,
border_color = color.new(color.green, 10),
bgcolor = color.new(color.green, 85),
extend = extend.right,
text = "أوردر بلوك شراء",
text_color = color.green,
text_size = size.small
)
if bearishBreak
float foundBearHigh = na
float foundBearLow = na
int foundBearBar = na
for i = 1 to obLookback
if na(foundBearBar) and close > open
foundBearHigh := useBodyOnly ? close : high
foundBearLow := useBodyOnly ? open : low
foundBearBar := bar_index - i
if not na(foundBearBar)
bearishOBHigh := foundBearHigh
bearishOBLow := foundBearLow
bearishOBBar := foundBearBar
if not na(bearishOBBox)
box.delete(bearishOBBox)
if showOB
bearishOBBox := box.new(
left = bearishOBBar,
top = bearishOBHigh,
right = bar_index + 100,
bottom = bearishOBLow,
border_color = color.new(color.red, 10),
bgcolor = color.new(color.red, 85),
extend = extend.right,
text = "أوردر بلوك بيع",
text_color = color.red,
text_size = size.small
)
// إبطال الأوردر بلوك عند كسره
bullOBInvalid =
not na(bullishOBLow) and
close < bullishOBLow
bearOBInvalid =
not na(bearishOBHigh) and
close > bearishOBHigh
if bullOBInvalid
bullishOBHigh := na
bullishOBLow := na
if not na(bullishOBBox)
box.delete(bullishOBBox)
bullishOBBox := na
if bearOBInvalid
bearishOBHigh := na
bearishOBLow := na
if not na(bearishOBBox)
box.delete(bearishOBBox)
bearishOBBox := na
//=====================================================================
// الفيبوناتشي بين آخر قمة وآخر قاع
//=====================================================================
validSwing =
not na(resistanceLevel) and
not na(supportLevel) and
resistanceLevel > supportLevel
swingRange = validSwing ? resistanceLevel - supportLevel : na
// اتجاه آخر حركة بحسب آخر Pivot
lastSwingBullish =
validSwing and
not na(supportBar) and
not na(resistanceBar) and
resistanceBar > supportBar
lastSwingBearish =
validSwing and
not na(supportBar) and
not na(resistanceBar) and
supportBar > resistanceBar
bullFib50 =
validSwing ?
resistanceLevel - swingRange * 0.50 :
na
bullFib618 =
validSwing ?
resistanceLevel - swingRange * 0.618 :
na
bearFib50 =
validSwing ?
supportLevel + swingRange * 0.50 :
na
bearFib618 =
validSwing ?
supportLevel + swingRange * 0.618 :
na
fib50Level =
lastSwingBullish ? bullFib50 :
lastSwingBearish ? bearFib50 :
na
fib618Level =
lastSwingBullish ? bullFib618 :
lastSwingBearish ? bearFib618 :
na
fib50Plot = plot(
showFib ? fib50Level : na,
title = "Fibonacci 50%",
color = color.new(color.purple, 10),
linewidth = 1,
style = plot.style_stepline
)
fib618Plot = plot(
showFib ? fib618Level : na,
title = "Fibonacci 61.8%",
color = color.new(color.fuchsia, 10),
linewidth = 2,
style = plot.style_stepline
)
fill(
fib50Plot,
fib618Plot,
color = showFib ? color.new(color.purple, 90) : na,
title = "منطقة الفيبوناتشي"
)
//=====================================================================
// شروط الدخول
//=====================================================================
// ملامسة منطقة الأوردر بلوك
bullOBTouch =
not na(bullishOBHigh) and
not na(bullishOBLow) and
low <= bullishOBHigh and
high >= bullishOBLow
bearOBTouch =
not na(bearishOBHigh) and
not na(bearishOBLow) and
high >= bearishOBLow and
low <= bearishOBHigh
// وجود السعر داخل منطقة فيبوناتشي
bullFibZone =
lastSwingBullish and
not na(bullFib50) and
not na(bullFib618) and
low <= math.max(bullFib50, bullFib618) and
high >= math.min(bullFib50, bullFib618)
bearFibZone =
lastSwingBearish and
not na(bearFib50) and
not na(bearFib618) and
high >= math.min(bearFib50, bearFib618) and
low <= math.max(bearFib50, bearFib618)
// فلتر الاتجاه
bullTrendOK = not useEMAFilter or close > emaTrend
bearTrendOK = not useEMAFilter or close < emaTrend
// فلتر الفيبوناتشي
bullFibOK = not useFibFilter or bullFibZone
bearFibOK = not useFibFilter or bearFibZone
// شمعة تأكيد
bullishCandle =
close > open and
close > (high + low) / 2
bearishCandle =
close < open and
close < (high + low) / 2
// منع تكرار الإشارة داخل نفس المنطقة
newBullTouch = bullOBTouch and not bullOBTouch[1]
newBearTouch = bearOBTouch and not bearOBTouch[1]
var int lastSignalBar = na
cooldownOK =
na(lastSignalBar) or
bar_index - lastSignalBar >= cooldownBars
barConfirmed =
not confirmClose or
barstate.isconfirmed
buySignal =
newBullTouch and
bullTrendOK and
bullFibOK and
bullishCandle and
cooldownOK and
barConfirmed
sellSignal =
newBearTouch and
bearTrendOK and
bearFibOK and
bearishCandle and
cooldownOK and
barConfirmed
//=====================================================================
// خطوط وبيانات آخر صفقة
//=====================================================================
var line entryLine = na
var line tp1Line = na
var line tp2Line = na
var line slLine = na
var label entryLabel = na
var label tp1Label = na
var label tp2Label = na
var label slLabel = na
deleteTradeObjects() =>
if not na(entryLine)
line.delete(entryLine)
if not na(tp1Line)
line.delete(tp1Line)
if not na(tp2Line)
line.delete(tp2Line)
if not na(slLine)
line.delete(slLine)
if not na(entryLabel)
label.delete(entryLabel)
if not na(tp1Label)
label.delete(tp1Label)
if not na(tp2Label)
label.delete(tp2Label)
if not na(slLabel)
label.delete(slLabel)
//=====================================================================
// صفقة الشراء
//=====================================================================
if buySignal
lastSignalBar := bar_index
deleteTradeObjects()
float buyEntry = close
float buyTP1 = buyEntry + targetDistance
float buyTP2 = buyEntry + targetDistance * 2
float buySL = buyEntry - stopDistance
entryLine := line.new(
bar_index,
buyEntry,
bar_index + lineBars,
buyEntry,
color = color.blue,
width = 3
)
tp1Line := line.new(
bar_index,
buyTP1,
bar_index + lineBars,
buyTP1,
color = color.green,
width = 2,
style = line.style_dashed
)
tp2Line := line.new(
bar_index,
buyTP2,
bar_index + lineBars,
buyTP2,
color = color.green,
width = 2,
style = line.style_dashed
)
slLine := line.new(
bar_index,
buySL,
bar_index + lineBars,
buySL,
color = color.red,
width = 2,
style = line.style_dashed
)
entryLabel := label.new(
bar_index + lineBars,
buyEntry,
"دخول شراء\n" + str.tostring(buyEntry, format.mintick),
style = label.style_label_left,
color = color.blue,
textcolor = color.white
)
tp1Label := label.new(
bar_index + lineBars,
buyTP1,
"TP1 - 40 PIP\n" + str.tostring(buyTP1, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
tp2Label := label.new(
bar_index + lineBars,
buyTP2,
"TP2 - 80 PIP\n" + str.tostring(buyTP2, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
slLabel := label.new(
bar_index + lineBars,
buySL,
"SL\n" + str.tostring(buySL, format.mintick),
style = label.style_label_left,
color = color.red,
textcolor = color.white
)
//=====================================================================
// صفقة البيع
//=====================================================================
if sellSignal
lastSignalBar := bar_index
deleteTradeObjects()
float sellEntry = close
float sellTP1 = sellEntry - targetDistance
float sellTP2 = sellEntry - targetDistance * 2
float sellSL = sellEntry + stopDistance
entryLine := line.new(
bar_index,
sellEntry,
bar_index + lineBars,
sellEntry,
color = color.blue,
width = 3
)
tp1Line := line.new(
bar_index,
sellTP1,
bar_index + lineBars,
sellTP1,
color = color.green,
width = 2,
style = line.style_dashed
)
tp2Line := line.new(
bar_index,
sellTP2,
bar_index + lineBars,
sellTP2,
color = color.green,
width = 2,
style = line.style_dashed
)
slLine := line.new(
bar_index,
sellSL,
bar_index + lineBars,
sellSL,
color = color.red,
width = 2,
style = line.style_dashed
)
entryLabel := label.new(
bar_index + lineBars,
sellEntry,
"دخول بيع\n" + str.tostring(sellEntry, format.mintick),
style = label.style_label_left,
color = color.blue,
textcolor = color.white
)
tp1Label := label.new(
bar_index + lineBars,
sellTP1,
"TP1 - 40 PIP\n" + str.tostring(sellTP1, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
tp2Label := label.new(
bar_index + lineBars,
sellTP2,
"TP2 - 80 PIP\n" + str.tostring(sellTP2, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
slLabel := label.new(
bar_index + lineBars,
sellSL,
"SL\n" + str.tostring(sellSL, format.mintick),
style = label.style_label_left,
color = color.red,
textcolor = color.white
)
//=====================================================================
// علامات الشراء والبيع
//=====================================================================
plotshape(
buySignal,
title = "شراء",
text = "شراء",
style = shape.labelup,
location = location.belowbar,
color = color.green,
textcolor = color.white,
size = size.small
)
plotshape(
sellSignal,
title = "بيع",
text = "بيع",
style = shape.labeldown,
location = location.abovebar,
color = color.red,
textcolor = color.white,
size = size.small
)
// علامات كسر الهيكل
plotshape(
bullishBreak,
title = "كسر مقاومة",
style = shape.circle,
location = location.belowbar,
color = color.new(color.green, 30),
size = size.tiny
)
plotshape(
bearishBreak,
title = "كسر دعم",
style = shape.circle,
location = location.abovebar,
color = color.new(color.red, 30),
size = size.tiny
)
//=====================================================================
// التنبيهات
//=====================================================================
alertcondition(
buySignal,
title = "ashknany.trading - شراء",
message = "إشارة شراء جديدة من مؤشر ashknany.trading"
)
alertcondition(
sellSignal,
title = "ashknany.trading - بيع",
message = "إشارة بيع جديدة من مؤشر ashknany.trading"
)
//=====================================================================
// اسم المؤشر في خلفية التشارت
//=====================================================================
var table watermark = table.new(
position.middle_center,
1,
1
)
if barstate.islast
table.cell(
watermark,
0,
0,
"ashknany.trading",
text_color = color.new(color.gray, 82),
text_size = size.huge,
bgcolor = color.new(color.white, 100)
)
indicator(
"ashknany.trading",
shorttitle = "ashknany.trading",
overlay = true,
max_lines_count = 500,
max_labels_count = 500,
max_boxes_count = 100,
max_bars_back = 5000
)
//=====================================================================
// الإعدادات
//=====================================================================
// إعدادات النقاط والأهداف
pipValue = input.float(0.10, "قيمة الـ Pip بالسعر", step = 0.01, minval = 0.001, group = "🎯 الأهداف ووقف الخسارة")
targetPips = input.int(40, "المسافة بين الأهداف Pip", minval = 1, group = "🎯 الأهداف ووقف الخسارة")
stopPips = input.int(40, "وقف الخسارة Pip", minval = 1, group = "🎯 الأهداف ووقف الخسارة")
lineBars = input.int(60, "طول خطوط الصفقة", minval = 10, maxval = 300, group = "🎯 الأهداف ووقف الخسارة")
// إعدادات الدعم والمقاومة
pivotLength = input.int(8, "قوة الدعم والمقاومة", minval = 2, maxval = 50, group = "📊 الدعم والمقاومة")
showSR = input.bool(true, "إظهار الدعم والمقاومة", group = "📊 الدعم والمقاومة")
// إعدادات الأوردر بلوك
obLookback = input.int(15, "البحث عن الأوردر بلوك", minval = 3, maxval = 50, group = "📦 الأوردر بلوك")
showOB = input.bool(true, "إظهار مناطق الأوردر بلوك", group = "📦 الأوردر بلوك")
useBodyOnly = input.bool(false, "استخدام جسم الشمعة فقط", group = "📦 الأوردر بلوك")
// إعدادات الفيبوناتشي
showFib = input.bool(true, "إظهار مستويات الفيبوناتشي", group = "📐 الفيبوناتشي")
useFibFilter = input.bool(true, "اشتراط توافق الدخول مع الفيبوناتشي", group = "📐 الفيبوناتشي")
// فلتر الاتجاه
emaLength = input.int(50, "طول EMA", minval = 1, group = "⚙️ فلتر الاتجاه")
useEMAFilter = input.bool(true, "استخدام فلتر الاتجاه EMA", group = "⚙️ فلتر الاتجاه")
showEMA = input.bool(true, "إظهار EMA", group = "⚙️ فلتر الاتجاه")
// إعدادات الإشارات
cooldownBars = input.int(10, "الفاصل بين الإشارات", minval = 1, group = "🔔 إشارات الدخول")
confirmClose = input.bool(true, "انتظار إغلاق الشمعة", group = "🔔 إشارات الدخول")
//=====================================================================
// الحسابات الأساسية
//=====================================================================
targetDistance = targetPips * pipValue
stopDistance = stopPips * pipValue
emaTrend = ta.ema(close, emaLength)
atrValue = ta.atr(14)
plot(
showEMA ? emaTrend : na,
title = "EMA",
color = color.new(color.blue, 20),
linewidth = 2
)
//=====================================================================
// الدعم والمقاومة
//=====================================================================
pivotHigh = ta.pivothigh(high, pivotLength, pivotLength)
pivotLow = ta.pivotlow(low, pivotLength, pivotLength)
var float resistanceLevel = na
var float supportLevel = na
var int resistanceBar = na
var int supportBar = na
if not na(pivotHigh)
resistanceLevel := pivotHigh
resistanceBar := bar_index - pivotLength
if not na(pivotLow)
supportLevel := pivotLow
supportBar := bar_index - pivotLength
plot(
showSR ? resistanceLevel : na,
title = "المقاومة",
color = color.orange,
linewidth = 2,
style = plot.style_stepline
)
plot(
showSR ? supportLevel : na,
title = "الدعم",
color = color.orange,
linewidth = 2,
style = plot.style_stepline
)
//=====================================================================
// كسر الهيكل
//=====================================================================
bullishBreak =
not na(resistanceLevel) and
close > resistanceLevel and
close[1] <= resistanceLevel
bearishBreak =
not na(supportLevel) and
close < supportLevel and
close[1] >= supportLevel
//=====================================================================
// اكتشاف الأوردر بلوك
// آخر شمعة هابطة قبل الكسر الصاعد
// وآخر شمعة صاعدة قبل الكسر الهابط
//=====================================================================
var float bullishOBHigh = na
var float bullishOBLow = na
var int bullishOBBar = na
var float bearishOBHigh = na
var float bearishOBLow = na
var int bearishOBBar = na
var box bullishOBBox = na
var box bearishOBBox = na
if bullishBreak
float foundBullHigh = na
float foundBullLow = na
int foundBullBar = na
for i = 1 to obLookback
if na(foundBullBar) and close < open
foundBullHigh := useBodyOnly ? open : high
foundBullLow := useBodyOnly ? close : low
foundBullBar := bar_index - i
if not na(foundBullBar)
bullishOBHigh := foundBullHigh
bullishOBLow := foundBullLow
bullishOBBar := foundBullBar
if not na(bullishOBBox)
box.delete(bullishOBBox)
if showOB
bullishOBBox := box.new(
left = bullishOBBar,
top = bullishOBHigh,
right = bar_index + 100,
bottom = bullishOBLow,
border_color = color.new(color.green, 10),
bgcolor = color.new(color.green, 85),
extend = extend.right,
text = "أوردر بلوك شراء",
text_color = color.green,
text_size = size.small
)
if bearishBreak
float foundBearHigh = na
float foundBearLow = na
int foundBearBar = na
for i = 1 to obLookback
if na(foundBearBar) and close > open
foundBearHigh := useBodyOnly ? close : high
foundBearLow := useBodyOnly ? open : low
foundBearBar := bar_index - i
if not na(foundBearBar)
bearishOBHigh := foundBearHigh
bearishOBLow := foundBearLow
bearishOBBar := foundBearBar
if not na(bearishOBBox)
box.delete(bearishOBBox)
if showOB
bearishOBBox := box.new(
left = bearishOBBar,
top = bearishOBHigh,
right = bar_index + 100,
bottom = bearishOBLow,
border_color = color.new(color.red, 10),
bgcolor = color.new(color.red, 85),
extend = extend.right,
text = "أوردر بلوك بيع",
text_color = color.red,
text_size = size.small
)
// إبطال الأوردر بلوك عند كسره
bullOBInvalid =
not na(bullishOBLow) and
close < bullishOBLow
bearOBInvalid =
not na(bearishOBHigh) and
close > bearishOBHigh
if bullOBInvalid
bullishOBHigh := na
bullishOBLow := na
if not na(bullishOBBox)
box.delete(bullishOBBox)
bullishOBBox := na
if bearOBInvalid
bearishOBHigh := na
bearishOBLow := na
if not na(bearishOBBox)
box.delete(bearishOBBox)
bearishOBBox := na
//=====================================================================
// الفيبوناتشي بين آخر قمة وآخر قاع
//=====================================================================
validSwing =
not na(resistanceLevel) and
not na(supportLevel) and
resistanceLevel > supportLevel
swingRange = validSwing ? resistanceLevel - supportLevel : na
// اتجاه آخر حركة بحسب آخر Pivot
lastSwingBullish =
validSwing and
not na(supportBar) and
not na(resistanceBar) and
resistanceBar > supportBar
lastSwingBearish =
validSwing and
not na(supportBar) and
not na(resistanceBar) and
supportBar > resistanceBar
bullFib50 =
validSwing ?
resistanceLevel - swingRange * 0.50 :
na
bullFib618 =
validSwing ?
resistanceLevel - swingRange * 0.618 :
na
bearFib50 =
validSwing ?
supportLevel + swingRange * 0.50 :
na
bearFib618 =
validSwing ?
supportLevel + swingRange * 0.618 :
na
fib50Level =
lastSwingBullish ? bullFib50 :
lastSwingBearish ? bearFib50 :
na
fib618Level =
lastSwingBullish ? bullFib618 :
lastSwingBearish ? bearFib618 :
na
fib50Plot = plot(
showFib ? fib50Level : na,
title = "Fibonacci 50%",
color = color.new(color.purple, 10),
linewidth = 1,
style = plot.style_stepline
)
fib618Plot = plot(
showFib ? fib618Level : na,
title = "Fibonacci 61.8%",
color = color.new(color.fuchsia, 10),
linewidth = 2,
style = plot.style_stepline
)
fill(
fib50Plot,
fib618Plot,
color = showFib ? color.new(color.purple, 90) : na,
title = "منطقة الفيبوناتشي"
)
//=====================================================================
// شروط الدخول
//=====================================================================
// ملامسة منطقة الأوردر بلوك
bullOBTouch =
not na(bullishOBHigh) and
not na(bullishOBLow) and
low <= bullishOBHigh and
high >= bullishOBLow
bearOBTouch =
not na(bearishOBHigh) and
not na(bearishOBLow) and
high >= bearishOBLow and
low <= bearishOBHigh
// وجود السعر داخل منطقة فيبوناتشي
bullFibZone =
lastSwingBullish and
not na(bullFib50) and
not na(bullFib618) and
low <= math.max(bullFib50, bullFib618) and
high >= math.min(bullFib50, bullFib618)
bearFibZone =
lastSwingBearish and
not na(bearFib50) and
not na(bearFib618) and
high >= math.min(bearFib50, bearFib618) and
low <= math.max(bearFib50, bearFib618)
// فلتر الاتجاه
bullTrendOK = not useEMAFilter or close > emaTrend
bearTrendOK = not useEMAFilter or close < emaTrend
// فلتر الفيبوناتشي
bullFibOK = not useFibFilter or bullFibZone
bearFibOK = not useFibFilter or bearFibZone
// شمعة تأكيد
bullishCandle =
close > open and
close > (high + low) / 2
bearishCandle =
close < open and
close < (high + low) / 2
// منع تكرار الإشارة داخل نفس المنطقة
newBullTouch = bullOBTouch and not bullOBTouch[1]
newBearTouch = bearOBTouch and not bearOBTouch[1]
var int lastSignalBar = na
cooldownOK =
na(lastSignalBar) or
bar_index - lastSignalBar >= cooldownBars
barConfirmed =
not confirmClose or
barstate.isconfirmed
buySignal =
newBullTouch and
bullTrendOK and
bullFibOK and
bullishCandle and
cooldownOK and
barConfirmed
sellSignal =
newBearTouch and
bearTrendOK and
bearFibOK and
bearishCandle and
cooldownOK and
barConfirmed
//=====================================================================
// خطوط وبيانات آخر صفقة
//=====================================================================
var line entryLine = na
var line tp1Line = na
var line tp2Line = na
var line slLine = na
var label entryLabel = na
var label tp1Label = na
var label tp2Label = na
var label slLabel = na
deleteTradeObjects() =>
if not na(entryLine)
line.delete(entryLine)
if not na(tp1Line)
line.delete(tp1Line)
if not na(tp2Line)
line.delete(tp2Line)
if not na(slLine)
line.delete(slLine)
if not na(entryLabel)
label.delete(entryLabel)
if not na(tp1Label)
label.delete(tp1Label)
if not na(tp2Label)
label.delete(tp2Label)
if not na(slLabel)
label.delete(slLabel)
//=====================================================================
// صفقة الشراء
//=====================================================================
if buySignal
lastSignalBar := bar_index
deleteTradeObjects()
float buyEntry = close
float buyTP1 = buyEntry + targetDistance
float buyTP2 = buyEntry + targetDistance * 2
float buySL = buyEntry - stopDistance
entryLine := line.new(
bar_index,
buyEntry,
bar_index + lineBars,
buyEntry,
color = color.blue,
width = 3
)
tp1Line := line.new(
bar_index,
buyTP1,
bar_index + lineBars,
buyTP1,
color = color.green,
width = 2,
style = line.style_dashed
)
tp2Line := line.new(
bar_index,
buyTP2,
bar_index + lineBars,
buyTP2,
color = color.green,
width = 2,
style = line.style_dashed
)
slLine := line.new(
bar_index,
buySL,
bar_index + lineBars,
buySL,
color = color.red,
width = 2,
style = line.style_dashed
)
entryLabel := label.new(
bar_index + lineBars,
buyEntry,
"دخول شراء\n" + str.tostring(buyEntry, format.mintick),
style = label.style_label_left,
color = color.blue,
textcolor = color.white
)
tp1Label := label.new(
bar_index + lineBars,
buyTP1,
"TP1 - 40 PIP\n" + str.tostring(buyTP1, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
tp2Label := label.new(
bar_index + lineBars,
buyTP2,
"TP2 - 80 PIP\n" + str.tostring(buyTP2, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
slLabel := label.new(
bar_index + lineBars,
buySL,
"SL\n" + str.tostring(buySL, format.mintick),
style = label.style_label_left,
color = color.red,
textcolor = color.white
)
//=====================================================================
// صفقة البيع
//=====================================================================
if sellSignal
lastSignalBar := bar_index
deleteTradeObjects()
float sellEntry = close
float sellTP1 = sellEntry - targetDistance
float sellTP2 = sellEntry - targetDistance * 2
float sellSL = sellEntry + stopDistance
entryLine := line.new(
bar_index,
sellEntry,
bar_index + lineBars,
sellEntry,
color = color.blue,
width = 3
)
tp1Line := line.new(
bar_index,
sellTP1,
bar_index + lineBars,
sellTP1,
color = color.green,
width = 2,
style = line.style_dashed
)
tp2Line := line.new(
bar_index,
sellTP2,
bar_index + lineBars,
sellTP2,
color = color.green,
width = 2,
style = line.style_dashed
)
slLine := line.new(
bar_index,
sellSL,
bar_index + lineBars,
sellSL,
color = color.red,
width = 2,
style = line.style_dashed
)
entryLabel := label.new(
bar_index + lineBars,
sellEntry,
"دخول بيع\n" + str.tostring(sellEntry, format.mintick),
style = label.style_label_left,
color = color.blue,
textcolor = color.white
)
tp1Label := label.new(
bar_index + lineBars,
sellTP1,
"TP1 - 40 PIP\n" + str.tostring(sellTP1, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
tp2Label := label.new(
bar_index + lineBars,
sellTP2,
"TP2 - 80 PIP\n" + str.tostring(sellTP2, format.mintick),
style = label.style_label_left,
color = color.green,
textcolor = color.white
)
slLabel := label.new(
bar_index + lineBars,
sellSL,
"SL\n" + str.tostring(sellSL, format.mintick),
style = label.style_label_left,
color = color.red,
textcolor = color.white
)
//=====================================================================
// علامات الشراء والبيع
//=====================================================================
plotshape(
buySignal,
title = "شراء",
text = "شراء",
style = shape.labelup,
location = location.belowbar,
color = color.green,
textcolor = color.white,
size = size.small
)
plotshape(
sellSignal,
title = "بيع",
text = "بيع",
style = shape.labeldown,
location = location.abovebar,
color = color.red,
textcolor = color.white,
size = size.small
)
// علامات كسر الهيكل
plotshape(
bullishBreak,
title = "كسر مقاومة",
style = shape.circle,
location = location.belowbar,
color = color.new(color.green, 30),
size = size.tiny
)
plotshape(
bearishBreak,
title = "كسر دعم",
style = shape.circle,
location = location.abovebar,
color = color.new(color.red, 30),
size = size.tiny
)
//=====================================================================
// التنبيهات
//=====================================================================
alertcondition(
buySignal,
title = "ashknany.trading - شراء",
message = "إشارة شراء جديدة من مؤشر ashknany.trading"
)
alertcondition(
sellSignal,
title = "ashknany.trading - بيع",
message = "إشارة بيع جديدة من مؤشر ashknany.trading"
)
//=====================================================================
// اسم المؤشر في خلفية التشارت
//=====================================================================
var table watermark = table.new(
position.middle_center,
1,
1
)
if barstate.islast
table.cell(
watermark,
0,
0,
"ashknany.trading",
text_color = color.new(color.gray, 82),
text_size = size.huge,
bgcolor = color.new(color.white, 100)
)
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.