OPEN-SOURCE SCRIPT

Bo3li.trading Scalper

407
//version=6

indicator(

title = "Bo3li.trading Scalper",

shorttitle = "Bo3li.trading",

overlay = true,

max_lines_count = 100,

max_labels_count = 100,

max_boxes_count = 20

)

//====================================================

// إعدادات الدعم والمقاومة ومناطق العرض والطلب

//====================================================

pivotLeft = input.int(

5,

"قوة المنطقة من اليسار",

minval = 1,

group = "الدعم والمقاومة"

)

pivotRight = input.int(

5,

"قوة المنطقة من اليمين",

minval = 1,

group = "الدعم والمقاومة"

)

atrLength = input.int(

14,

"فترة ATR",

minval = 1,

group = "الدعم والمقاومة"

)

zoneSizeATR = input.float(

0.30,

"سُمك منطقة العرض والطلب",

minval = 0.05,

step = 0.05,

group = "الدعم والمقاومة"

)

showZones = input.bool(

true,

"إظهار مناطق العرض والطلب",

group = "الدعم والمقاومة"

)

showSupportResistance = input.bool(

true,

"إظهار خطوط الدعم والمقاومة",

group = "الدعم والمقاومة"

)

//====================================================

// إعدادات فلتر الدخول

//====================================================

useTrendFilter = input.bool(

true,

"استخدام فلتر الاتجاه",

group = "فلتر الدخول"

)

emaFastLength = input.int(

20,

"EMA السريع",

minval = 1,

group = "فلتر الدخول"

)

emaSlowLength = input.int(

50,

"EMA البطيء",

minval = 1,

group = "فلتر الدخول"

)

useRSIFilter = input.bool(

true,

"استخدام فلتر RSI",

group = "فلتر الدخول"

)

rsiLength = input.int(

14,

"فترة RSI",

minval = 1,

group = "فلتر الدخول"

)

buyRSILevel = input.int(

52,

"أقل RSI للشراء",

minval = 1,

maxval = 99,

group = "فلتر الدخول"

)

sellRSILevel = input.int(

48,

"أعلى RSI للبيع",

minval = 1,

maxval = 99,

group = "فلتر الدخول"

)

//====================================================

// إعدادات الأهداف ووقف الخسارة

//====================================================

// على الذهب:

// 1 Pip = 0.10 دولار من حركة السعر

// 50 Pip = 5 دولارات

// 100 Pip = 10 دولارات

// 150 Pip = 15 دولاراً

pipSize = input.float(

0.10,

"قيمة Pip بالسعر",

minval = 0.00001,

step = 0.01,

tooltip = "للذهب: 100 Pip تساوي حركة 10 دولارات",

group = "الأهداف ووقف الخسارة"

)

tpStepPips = input.int(

50,

"المسافة بين كل TP",

minval = 1,

group = "الأهداف ووقف الخسارة"

)

slPips = input.int(

50,

"SL بالـ Pip",

minval = 1,

group = "الأهداف ووقف الخسارة"

)

tp1Pips = tpStepPips

tp2Pips = tpStepPips * 2

tp3Pips = tpStepPips * 3

projectionBars = input.int(

40,

"طول خطوط الصفقة",

minval = 5,

maxval = 200,

group = "الأهداف ووقف الخسارة"

)

//====================================================

// إعدادات المظهر

//====================================================

showEMAs = input.bool(

true,

"إظهار المتوسطات",

group = "المظهر"

)

showSignals = input.bool(

true,

"إظهار إشارات الشراء والبيع",

group = "المظهر"

)

showWatermark = input.bool(

true,

"إظهار Bo3li.trading بالخلفية",

group = "المظهر"

)

//====================================================

// الحسابات

//====================================================

atrValue = ta.atr(atrLength)

zoneThickness = atrValue * zoneSizeATR

emaFast = ta.ema(close, emaFastLength)

emaSlow = ta.ema(close, emaSlowLength)

rsiValue = ta.rsi(close, rsiLength)

pivotHigh = ta.pivothigh(

high,

pivotLeft,

pivotRight

)

pivotLow = ta.pivotlow(

low,

pivotLeft,

pivotRight

)

//====================================================

// تخزين آخر دعم ومقاومة

//====================================================

var float resistancePrice = na

var float supportPrice = na

var float supplyTop = na

var float supplyBottom = na

var float demandTop = na

var float demandBottom = na

if not na(pivotHigh)

resistancePrice := pivotHigh

supplyTop := pivotHigh

supplyBottom := pivotHigh - zoneThickness

if not na(pivotLow)

supportPrice := pivotLow

demandTop := pivotLow + zoneThickness

demandBottom := pivotLow

//====================================================

// مناطق العرض والطلب

//====================================================

var box supplyBox = na

var box demandBox = na

var label supplyLabel = na

var label demandLabel = na

if not na(pivotHigh)

if not na(supplyBox)

box.delete(supplyBox)

if not na(supplyLabel)

label.delete(supplyLabel)

if showZones

supplyBox := box.new(

left = bar_index - pivotRight,

top = supplyTop,

right = bar_index,

bottom = supplyBottom,

border_color = color.new(color.red, 25),

border_width = 1,

bgcolor = color.new(color.red, 88),

extend = extend.right

)

supplyLabel := label.new(

x = bar_index - pivotRight,

y = supplyTop,

text = "منطقة عرض",

style = label.style_label_down,

color = color.new(color.red, 10),

textcolor = color.white,

size = size.small

)

if not na(pivotLow)

if not na(demandBox)

box.delete(demandBox)

if not na(demandLabel)

label.delete(demandLabel)

if showZones

demandBox := box.new(

left = bar_index - pivotRight,

top = demandTop,

right = bar_index,

bottom = demandBottom,

border_color = color.new(color.green, 25),

border_width = 1,

bgcolor = color.new(color.green, 88),

extend = extend.right

)

demandLabel := label.new(

x = bar_index - pivotRight,

y = demandBottom,

text = "منطقة طلب",

style = label.style_label_up,

color = color.new(color.green, 10),

textcolor = color.white,

size = size.small

)

if not showZones

if not na(supplyBox)

box.delete(supplyBox)

supplyBox := na

if not na(demandBox)

box.delete(demandBox)

demandBox := na

if not na(supplyLabel)

label.delete(supplyLabel)

supplyLabel := na

if not na(demandLabel)

label.delete(demandLabel)

demandLabel := na

//====================================================

// خطوط الدعم والمقاومة البرتقالية

//====================================================

plot(

showSupportResistance ? resistancePrice : na,

title = "المقاومة",

color = color.orange,

linewidth = 2,

style = plot.style_stepline

)

plot(

showSupportResistance ? supportPrice : na,

title = "الدعم",

color = color.orange,

linewidth = 2,

style = plot.style_stepline

)

//====================================================

// المتوسطات المتحركة

//====================================================

plot(

showEMAs ? emaFast : na,

title = "EMA السريع",

color = color.aqua,

linewidth = 1

)

plot(

showEMAs ? emaSlow : na,

title = "EMA البطيء",

color = color.purple,

linewidth = 2

)

//====================================================

// شروط الدخول

//====================================================

bullTrend = emaFast > emaSlow and close > emaFast

bearTrend = emaFast < emaSlow and close < emaFast

bullRSI = rsiValue >= buyRSILevel

bearRSI = rsiValue <= sellRSILevel

buyTrendAllowed = not useTrendFilter or bullTrend

sellTrendAllowed = not useTrendFilter or bearTrend

buyRSIAllowed = not useRSIFilter or bullRSI

sellRSIAllowed = not useRSIFilter or bearRSI

// الشراء بعد كسر المقاومة والإغلاق فوقها

rawBuySignal =

not na(resistancePrice) and

ta.crossover(close, resistancePrice)

// البيع بعد كسر الدعم والإغلاق تحته

rawSellSignal =

not na(supportPrice) and

ta.crossunder(close, supportPrice)

buySignal =

barstate.isconfirmed and

rawBuySignal and

buyTrendAllowed and

buyRSIAllowed

sellSignal =

barstate.isconfirmed and

rawSellSignal and

sellTrendAllowed and

sellRSIAllowed

//====================================================

// خطوط الصفقة

//====================================================

var line entryLine = na

var line tp1Line = na

var line tp2Line = na

var line tp3Line = na

var line slLine = na

var label entryLabel = na

var label tp1Label = na

var label tp2Label = na

var label tp3Label = na

var label slLabel = na

//====================================================

// صفقة شراء

//====================================================

if buySignal

if not na(entryLine)

line.delete(entryLine)

if not na(tp1Line)

line.delete(tp1Line)

if not na(tp2Line)

line.delete(tp2Line)

if not na(tp3Line)

line.delete(tp3Line)

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(tp3Label)

label.delete(tp3Label)

if not na(slLabel)

label.delete(slLabel)

float entryPrice = close

float tp1Price = entryPrice + tp1Pips * pipSize

float tp2Price = entryPrice + tp2Pips * pipSize

float tp3Price = entryPrice + tp3Pips * pipSize

float slPrice = entryPrice - slPips * pipSize

entryLine := line.new(

x1 = bar_index,

y1 = entryPrice,

x2 = bar_index + projectionBars,

y2 = entryPrice,

color = color.blue,

width = 3

)

tp1Line := line.new(

x1 = bar_index,

y1 = tp1Price,

x2 = bar_index + projectionBars,

y2 = tp1Price,

color = color.green,

width = 2,

style = line.style_dashed

)

tp2Line := line.new(

x1 = bar_index,

y1 = tp2Price,

x2 = bar_index + projectionBars,

y2 = tp2Price,

color = color.green,

width = 2,

style = line.style_dashed

)

tp3Line := line.new(

x1 = bar_index,

y1 = tp3Price,

x2 = bar_index + projectionBars,

y2 = tp3Price,

color = color.green,

width = 2

)

slLine := line.new(

x1 = bar_index,

y1 = slPrice,

x2 = bar_index + projectionBars,

y2 = slPrice,

color = color.red,

width = 2

)

entryLabel := label.new(

x = bar_index + projectionBars,

y = entryPrice,

text = "دخول شراء",

style = label.style_label_left,

color = color.blue,

textcolor = color.white

)

tp1Label := label.new(

x = bar_index + projectionBars,

y = tp1Price,

text = "TP1 - " + str.tostring(tp1Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

tp2Label := label.new(

x = bar_index + projectionBars,

y = tp2Price,

text = "TP2 - " + str.tostring(tp2Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

tp3Label := label.new(

x = bar_index + projectionBars,

y = tp3Price,

text = "TP3 - " + str.tostring(tp3Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

slLabel := label.new(

x = bar_index + projectionBars,

y = slPrice,

text = "SL - " + str.tostring(slPips) + " Pip",

style = label.style_label_left,

color = color.red,

textcolor = color.white

)

//====================================================

// صفقة بيع

//====================================================

if sellSignal

if not na(entryLine)

line.delete(entryLine)

if not na(tp1Line)

line.delete(tp1Line)

if not na(tp2Line)

line.delete(tp2Line)

if not na(tp3Line)

line.delete(tp3Line)

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(tp3Label)

label.delete(tp3Label)

if not na(slLabel)

label.delete(slLabel)

float entryPrice = close

float tp1Price = entryPrice - tp1Pips * pipSize

float tp2Price = entryPrice - tp2Pips * pipSize

float tp3Price = entryPrice - tp3Pips * pipSize

float slPrice = entryPrice + slPips * pipSize

entryLine := line.new(

x1 = bar_index,

y1 = entryPrice,

x2 = bar_index + projectionBars,

y2 = entryPrice,

color = color.blue,

width = 3

)

tp1Line := line.new(

x1 = bar_index,

y1 = tp1Price,

x2 = bar_index + projectionBars,

y2 = tp1Price,

color = color.green,

width = 2,

style = line.style_dashed

)

tp2Line := line.new(

x1 = bar_index,

y1 = tp2Price,

x2 = bar_index + projectionBars,

y2 = tp2Price,

color = color.green,

width = 2,

style = line.style_dashed

)

tp3Line := line.new(

x1 = bar_index,

y1 = tp3Price,

x2 = bar_index + projectionBars,

y2 = tp3Price,

color = color.green,

width = 2

)

slLine := line.new(

x1 = bar_index,

y1 = slPrice,

x2 = bar_index + projectionBars,

y2 = slPrice,

color = color.red,

width = 2

)

entryLabel := label.new(

x = bar_index + projectionBars,

y = entryPrice,

text = "دخول بيع",

style = label.style_label_left,

color = color.blue,

textcolor = color.white

)

tp1Label := label.new(

x = bar_index + projectionBars,

y = tp1Price,

text = "TP1 - " + str.tostring(tp1Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

tp2Label := label.new(

x = bar_index + projectionBars,

y = tp2Price,

text = "TP2 - " + str.tostring(tp2Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

tp3Label := label.new(

x = bar_index + projectionBars,

y = tp3Price,

text = "TP3 - " + str.tostring(tp3Pips) + " Pip",

style = label.style_label_left,

color = color.green,

textcolor = color.white

)

slLabel := label.new(

x = bar_index + projectionBars,

y = slPrice,

text = "SL - " + str.tostring(slPips) + " Pip",

style = label.style_label_left,

color = color.red,

textcolor = color.white

)

//====================================================

// إشارات الدخول

//====================================================

plotshape(

showSignals and buySignal,

title = "إشارة شراء",

text = "شراء",

style = shape.labelup,

location = location.belowbar,

color = color.green,

textcolor = color.white,

size = size.small

)

plotshape(

showSignals and sellSignal,

title = "إشارة بيع",

text = "بيع",

style = shape.labeldown,

location = location.abovebar,

color = color.red,

textcolor = color.white,

size = size.small

)

//====================================================

// خلفية Bo3li.trading

//====================================================

var table watermark = table.new(

position.middle_center,

1,

1

)

if barstate.islast

table.cell(

watermark,

0,

0,

showWatermark ? "Bo3li.trading" : "",

text_color = color.new(color.gray, 82),

text_size = size.huge,

bgcolor = color.new(color.white, 100)

)

//====================================================

// التنبيهات

//====================================================

alertcondition(

buySignal,

title = "Bo3li.trading - شراء",

message = "إشارة شراء من مؤشر Bo3li.trading بعد كسر المقاومة"

)

alertcondition(

sellSignal,

title = "Bo3li.trading - بيع",

message = "إشارة بيع من مؤشر Bo3li.trading بعد كسر الدعم"

)

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.