OPEN-SOURCE SCRIPT
moh

//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)
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)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.