OPEN-SOURCE SCRIPT

moh

55
//version=5
indicator("Test - Clean Base (Fixed Line 95)", overlay=true)

// إعداد بسيط
pivotLen = input.int(5, "Pivot lookback", minval=2)

// نحدد القمم والقيعان
ph = ta.pivothigh(high, pivotLen, pivotLen)
pl = ta.pivotlow(low, pivotLen, pivotLen)

// نرسم القمم والقيعان
if not na(ph)
label.new(bar_index - pivotLen, ph, "Top", yloc=yloc.abovebar, style=label.style_label_down, color=color.new(color.red,0))
if not na(pl)
label.new(bar_index - pivotLen, pl, "Bottom", yloc=yloc.belowbar, style=label.style_label_up, color=color.new(color.green,0))

// نرسم خطين ترند من آخر قمتين وآخر قاعين
lastPH1 = ta.valuewhen(not na(ph), ph, 0)
lastPH2 = ta.valuewhen(not na(ph), ph, 1)
lastPH1_x = ta.valuewhen(not na(ph), bar_index - pivotLen, 0)
lastPH2_x = ta.valuewhen(not na(ph), bar_index - pivotLen, 1)

lastPL1 = ta.valuewhen(not na(pl), pl, 0)
lastPL2 = ta.valuewhen(not na(pl), pl, 1)
lastPL1_x = ta.valuewhen(not na(pl), bar_index - pivotLen, 0)
lastPL2_x = ta.valuewhen(not na(pl), bar_index - pivotLen, 1)

// الخطأ كان هنا (سطر 95) بسبب تنسيق أو محرف غير ظاهر
if not na(lastPH1) and not na(lastPH2)
line.new(x1=lastPH2_x, y1=lastPH2, x2=lastPH1_x, y2=lastPH1, extend=extend.right, color=color.red, width=2)

if not na(lastPL1) and not na(lastPL2)
line.new(x1=lastPL2_x, y1=lastPL2, x2=lastPL1_x, y2=lastPL1, extend=extend.right, color=color.green, width=2)

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.