如何绘制以前的枢轴点线?

How to plot previous pivot point lines?

我试图将所有先前的枢轴高点和低点绘制为线,但我只能在图表上显示一组枢轴线。有人可以帮我绘制所有以前的轴心线吗?

//@version=4
study("Pivot Points Auto v2", shorttitle="Pivot Points Auto v2", overlay=true)

pvtLenL = input(50, minval=1, title="Pivot Length Left Hand Side")
pvtLenR = input(50, minval=1, title="Pivot Length Right Hand Side")
LineColor = input(title="Line Color", type=input.color, defval=color.white)
LineWidth = input(title="Line Width", type=input.integer, defval=1)

pvthi = pivothigh(high, pvtLenL, pvtLenR)
pvtlo = pivotlow(low, pvtLenL, pvtLenR)
 
pvthis = fixnan(pvthi)
pvtlos = fixnan(pvtlo)

line.new(x1=bar_index[10], y1=pvthis, x2=bar_index, y2=pvthis, extend=extend.both, color=LineColor, width=LineWidth)
line.new(x1=bar_index[10], y1=pvtlos, x2=bar_index, y2=pvtlos, extend=extend.both, color=LineColor, width=LineWidth)

//@version=4
study("Pivot Points Auto v2", shorttitle="Pivot Points Auto v2", overlay=true)

pvtLenL = input(50, minval=1, title="Pivot Length Left Hand Side")
pvtLenR = input(50, minval=1, title="Pivot Length Right Hand Side")
LineColor = input(title="Line Color", type=input.color, defval=color.white)
LineWidth = input(title="Line Width", type=input.integer, defval=1)

pvthi = pivothigh(high, pvtLenL, pvtLenR)
pvtlo = pivotlow(low, pvtLenL, pvtLenR)
 
pvthis = fixnan(pvthi)
pvtlos = fixnan(pvtlo)

plot(pvthis, color=color.green, style=plot.style_stepline)
plot(pvtlos, color=color.red, style=plot.style_stepline)

编辑 1.

//@version=4
study("Pivot Points Auto v2", shorttitle="Pivot Points Auto v2", overlay=true)

pvtLenL = input(50, minval=1, title="Pivot Length Left Hand Side")
pvtLenR = input(50, minval=1, title="Pivot Length Right Hand Side")
LineColor = input(title="Line Color", type=input.color, defval=color.white)
LineWidth = input(title="Line Width", type=input.integer, defval=1)

pvthi = pivothigh(high, pvtLenL, pvtLenR)
pvtlo = pivotlow(low, pvtLenL, pvtLenR)
 
pvthis = fixnan(pvthi)
pvtlos = fixnan(pvtlo)

if change(pvthis)
    line.new(x1=bar_index[10], y1=pvthis, x2=bar_index, y2=pvthis, extend=extend.right, color=LineColor, width=LineWidth)

if change(pvtlos)
    line.new(x1=bar_index[10], y1=pvtlos, x2=bar_index, y2=pvtlos, extend=extend.right, color=LineColor, width=LineWidth)