简体   繁体   中英

How to plot previous pivot point lines?

I'm trying to plot all previous pivot highs and lows as lines but I can only get one set of pivot lines to show on the chart. Can someone help me plot all the previous pivot lines please?

//@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)

Edit 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM