Plot 是否有办法获得所选条的高/低值?

Plot 是否有办法获得所选条的高/低值?,plot,pine-script,Plot,Pine Script,使用Pine脚本,我想在微观层面上可视化轴心点(高点和低点),根据以下轴心高点条件显示3个小节: (high[1] > high[0]) and (high[1] > high[2]) 下一步,我想设想以下条件下的高阶枢轴高点: (pivothigh[1] > pivothigh[0]) and (pivothigh[1] > pivothigh[2]) 最后,我想对另一个层次进行同样的处理。 第一步已经完成,但是,我的第二个目标有问题。如何获得微观水平枢轴高点的枢轴

使用Pine脚本,我想在微观层面上可视化轴心点(高点和低点),根据以下轴心高点条件显示3个小节:

(high[1] > high[0]) and (high[1] > high[2])
下一步,我想设想以下条件下的高阶枢轴高点:

(pivothigh[1] > pivothigh[0]) and (pivothigh[1] > pivothigh[2])
最后,我想对另一个层次进行同样的处理。 第一步已经完成,但是,我的第二个目标有问题。如何获得微观水平枢轴高点的枢轴高点

study("Pivot points")

//Define the width to look for pivot highs
leftBars = input(1)
rightBars= input(1)

pivhigh = pivothigh(high,leftBars,rightBars)

//plotting the pivot highs on the micro level (however, with an additional offset)
plotshape(pivhigh, style = shape.xcross, location = location.abovebar, color=color.green, offset = -rightBars)

可以使用数组存储和计算数据透视,并在数据透视出现时将数据透视高/低值添加到高阶数组中

var float[] first_order_pvhs = array.new_float()
var float[] second_order_pvhs = array.new_float()
var float[] third_order_pvhs = array.new_float()

if high[1] > high[0] and high[1] > high[2]
    array.unshift(first_order_pvhs, high[1])

pvh1_0 = array.get(first_order_pvhs, 0)
pvh1_1 = array.get(first_order_pvhs, 1)
pvh1_2 = array.get(first_order_pvhs, 2)

if pvh1_1 > pvh1_0 and pvh1_1 > pvh1_2
    array.unshift(second_order_pvhs, pvh1_1)

pvh2_0 = array.get(second_order_pvhs, 0)
pvh2_1 = array.get(second_order_pvhs, 1)
pvh2_2 = array.get(second_order_pvhs, 2)

if pvh2_1 > pvh2_0 and pvh2_1 > pvh2_2
    array.unshift(third_order_pvhs, pvh2_1)

您可以在这里看到我的实现:

非常感谢您的大力支持!你的解决方案很好用!