我如何获得枢轴编号的枢轴?

时间:2020-06-27 13:27:47

标签: pine-script

我如下图所示在条形图上方绘制了枢轴。我想在条形图上绘制枢轴的枢轴,但我没有正确的bar_index来绘制它。请帮忙,非常感谢。

//@version=4
study(title="Pivot of pivots",overlay=true,max_bars_back=500)
length=input(defval=2)
llength=input(defval=2)
pH = pivothigh(high,llength,length)
ph1=valuewhen(pH,bar_index[length],0)
ph2=valuewhen(pH,bar_index[length],1)
ph3=valuewhen(pH,bar_index[length],2)
ph4=valuewhen(pH,bar_index[length],3)
ph5=valuewhen(pH,bar_index[length],4)
pH1=pivothigh(fixnan(pH),llength,length)
ph1_1=valuewhen(pH1,bar_index[length],0)
plotshape(title='Pivot',series=bar_index==ph1+length?high[length]:na,location=location.abovebar,style=shape.circle,size=size.tiny,color=color.red,offset=-1*length)
plotshape(title='Pivot of pivots', series=bar_index==ph1_1+length?high[length]:na,size=size.tiny, style=shape.cross,location=location.belowbar, color=color.yellow,offset=-1*(bar_index-ph1_1))

circle is pivot.cross is pivot of pivots.I cannot to get correct position of pivot of pivots

0 个答案:

没有答案