I'd like to set the index of bar_index[] based on ta.pivothigh in a dynamic way.
// PivotHigh Check
leftBars= input(4)
rightBars = input(4)
ph = ta.pivothigh(leftBars, rightBars)
plot(ph, style=plot.style_circles, linewidth=3, color=#ffffff, offset=-rightBars)
// Draw the line
upperLine = line.new(bar_index[10], high[10], bar_index[20], high[20], color=#ffffff, width = 2)
As you can see the numbers 10 and 20 aren't written in a dyinamic way, because I wrote the index of bar_index and high. Is it possible to return the value of each circles made by ta.pivothigh in order to fill the index automatically?