Pine script 获取TradingView脚本上特定条的日期

Pine script 获取TradingView脚本上特定条的日期,pine-script,Pine Script,我正在写一个指标,我需要把它“锚定”到某个感兴趣的日期。基本上是一个锚定的VWAP,在这里我试图自动找到“锚定”指标的容易感兴趣的区域 基本上,我试图在回望期内获得最高值和最低值(在本例中为365),并尝试“访问”该条的日期,因此我可以在该条中初始化t(时间) 我可以通过单独的输入来完成这项工作,但不确定如何通过访问以前栏中的时间/日期信息来完成。谢谢 h1 = highest(high, 365) time(h1) (?) *this is wrong* start = t == time

我正在写一个指标,我需要把它“锚定”到某个感兴趣的日期。基本上是一个锚定的VWAP,在这里我试图自动找到“锚定”指标的容易感兴趣的区域

基本上,我试图在回望期内获得最高值和最低值(在本例中为365),并尝试“访问”该条的日期,因此我可以在该条中初始化t(时间)

我可以通过单独的输入来完成这项工作,但不确定如何通过访问以前栏中的时间/日期信息来完成。谢谢

h1 = highest(high, 365)
time(h1) (?)  *this is wrong* 
start = t == time 

您需要使用
highestbar()
,它返回最高点的偏移量。它返回负值,因此我们需要更改其符号:

//@version=4
study("")
// Get bar index of highest high.
highIndex = -highestbars(high, 365)
// Get time at highest high.
t = time[highIndex]
plot(highIndex, "Index of highest high")
// Plot day of the month of highest high's bar.
plot(dayofmonth(t), "Day of the month", color.red)

您需要使用
highestbar()
,它返回最高点的偏移量。它返回负值,因此我们需要更改其符号:

//@version=4
study("")
// Get bar index of highest high.
highIndex = -highestbars(high, 365)
// Get time at highest high.
t = time[highIndex]
plot(highIndex, "Index of highest high")
// Plot day of the month of highest high's bar.
plot(dayofmonth(t), "Day of the month", color.red)