Pine Script / TradingView - 在日线图上获取特定时间的收盘价?

Pine Script / TradingView - Get Close Price of particular hour on Daily Chart?

我正在使用日线图,想获得股票代码在特定时间(假设 15:00 EST)的收盘价,我该怎么做?

我知道我能做到:

TimePrice := (hour== 15 and minute == 0) ? close : TimePrice

但这似乎只适用于半小时或更快的图表。

有没有办法在使用日线图的同时获取特定时间的收盘价?

未完全测试,但您可以试试这个:

//@version=5
indicator("Show close price at 15:00",overlay=true)

tnow  = timenow
t1500 = timestamp(year(time) , month(time) , dayofmonth(time) , 15 ,  0, 0) 
t1530 = timestamp(year(time) , month(time) , dayofmonth(time) , 15 , 30, 0) 
index = tnow>t1530? 2: tnow>t1500? 1 : na

close30 = index>=0 ? request.security(syminfo.tickerid, "30", close[index]) : na

a = array.new_float(1)
array.set(a, 0, close30)
close1500 = array.get(a, 0)[0]

var table msgDisplay = table.new(position.bottom_right, 1, 1)
table.cell(msgDisplay,  0,  0, str.tostring(close1500), bgcolor = color.yellow)