OPEN-SOURCE SCRIPT

High/Low Targets - Abu Ayd

244
سكربت
//version=5
indicator("High/Low Targets - Abu Ayd", overlay = true, max_lines_count = 200, ع")
widthLow = input.int(2, "سماكة خط القاع", minval=1, maxval=5)

colorHigh = input.color(color.purple, "لون خط القمة")
widthHigh = input.int(2, "سماكة خط القمة", minval=1, maxval=5)

colorUp = input.color(color.green, "لون أهداف الصعود")
widthUp = input.int(1, "سماكة أهداف الصعود", minval=1, maxval=5)

colorDown = input.color(color.red, "لون أهداف الهبوط")
widthDown = input.int(1, "سماكة أهداف الهبوط", minval=1, maxval=5)

//========= مكان كتابة الأهداف =========//
labelPosition = input.string("يمين", "مكان كتابة الأهداف", options=["يمين", "وسط", "يسار"])
offsetBars = input.int(5, "المسافة أفقياً للكتابة", minval=1, maxval=50)

//========= عدد الأهداف =========//
targetsUpNum = input.int(5, "عدد أهداف الصعود", minval=1, maxval=20)
targetsDownNum = input.int(5, "عدد أهداف الهبوط", minval=1, maxval=20)

//========= حساب القاع والقمة =========//
srcLow = request.security(syminfo.tickerid, tf == "" ? timeframe.period : tf, ta.lowest(low, lookback))
srcHigh = request.security(syminfo.tickerid, tf == "" ? timeframe.period : tf, ta.highest(high, lookback))

// قاع أمس
yLow = request.security(syminfo.tickerid, "D", low[1])
yHigh = request.security(syminfo.tickerid, "D", high[1])
yOpen = request.security(syminfo.tickerid, "D", open[1])
yClose = request.security(syminfo.tickerid, "D", close[1])
yBodyLow = math.min(yOpen, yClose)
yLowerWick = yBodyLow - yLow
yRange = yHigh - yLow
isValidYesterdayLow = yLowerWick > yRange * wickRatio

// اختيار القاع
lowPoint =
mode == "Manual" ? manualLow :
(mode == "Auto" and useYesterdayLow and isValidYesterdayLow) ? yLow :
srcLow

// اختيار القمة
highPoint = mode == "Auto" ? srcHigh : manualHigh

//========= دالة لحساب مكان الليبل =========//
f_getXoffset(_pos) =>
_pos == "يمين" ? bar_index + offsetBars : _pos == "يسار" ? bar_index - offsetBars : bar_index

//========= أهداف القاع =========//
if mode == "Manual" or (mode == "Auto" and showLowAuto and not na(lowPoint))
// أهداف فوق القاع
for i = 1 to targetsUpNum
levelUp = lowPoint + stepUp * i
line.new(bar_index, levelUp, bar_index+1, levelUp, color=colorUp, width=widthUp, extend=extend.right)
if barstate.islast
label.new(f_getXoffset(labelPosition), levelUp, "🎯 " + str.tostring(levelUp),
textcolor=color.white, color=colorUp, style=label.style_label_left,
xloc=xloc.bar_index, yloc=yloc.price)

// أهداف تحت القاع إذا اخترنا "فوق وتحت"
if lowTargetsMode == "فوق وتحت"
for i = 1 to targetsDownNum
levelDownFromLow = lowPoint - stepDown * i
line.new(bar_index, levelDownFromLow, bar_index+1, levelDownFromLow, color=colorDown, width=widthDown, extend=extend.right)
if barstate.islast
label.new(f_getXoffset(labelPosition), levelDownFromLow, "🎯 " + str.tostring(levelDownFromLow),
textcolor=color.white, color=colorDown, style=label.style_label_left,
xloc=xloc.bar_index, yloc=yloc.price)

//========= أهداف القمة =========//
if mode == "Manual" or (mode == "Auto" and showHighAuto)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.