Plot 如何获取pinescript中先前最高值的值?

Plot 如何获取pinescript中先前最高值的值?,plot,user-defined-functions,pine-script,trading,algorithmic-trading,Plot,User Defined Functions,Pine Script,Trading,Algorithmic Trading,正在尝试获取pinescript中先前最高值的值,但此代码为我提供了当前最高值的先前条 myper=input(50, "LENGTH") y1 = highest(high,myper) yy = valuewhen(high>y1[1],high,0) plot(yy[1], linewidth=2, color=#00FF00, title="alt") 有人能帮忙吗?这是因为您在plot()函数中使用了yy系列的上一个值([1]) //@v

正在尝试获取pinescript中先前最高值的值,但此代码为我提供了当前最高值的先前条

myper=input(50, "LENGTH")
y1 = highest(high,myper)
yy = valuewhen(high>y1[1],high,0)
plot(yy[1], linewidth=2, color=#00FF00, title="alt")

有人能帮忙吗?

这是因为您在
plot()
函数中使用了
yy
系列的上一个值(
[1]

//@version=4
study("My Script")
myper=input(50, "LENGTH")
y1 = highest(high,myper)
yy = valuewhen(high>y1[1],high,0)
plot(yy, linewidth=2, color=#00FF00, title="alt")