Pine script 如何从5m图表中获取指标最后值

Pine script 如何从5m图表中获取指标最后值,pine-script,Pine Script,嗨,我可以只获得当天的指标收盘值,以便为第二天进行计算吗?(示例:如图所示的标准偏差值) 多谢各位 这将为您提供前一天的收盘价 如果您想要eod的值,您需要知道时间范围和会话的结束时间。假设下午3:30关门(15:30) 如果你只打算在5m图表上使用这个,你可以把它减少到这个 var float closingSD = na sd = stdev(close, 20) closingBarTime = timestamp(year, month, dayofmonth, 15, 25) if

嗨,我可以只获得当天的指标收盘值,以便为第二天进行计算吗?(示例:如图所示的标准偏差值)

多谢各位

这将为您提供前一天的收盘价

如果您想要eod的值,您需要知道时间范围和会话的结束时间。假设下午3:30关门(15:30)

如果你只打算在5m图表上使用这个,你可以把它减少到这个

var float closingSD = na
sd = stdev(close, 20)
closingBarTime = timestamp(year, month, dayofmonth, 15, 25)
if time >= closingBarTime and barstate.isconfirmed
    closingSD := sd
var float closingSD = na
var int minutes = timeframe.isintraday ? 30 - timeframe.multiplier : na
sd = stdev(close, 20)
closingBarTime = timestamp(year, month, dayofmonth, 15, minutes)
if time >= closingBarTime and barstate.isconfirmed
    closingSD := sd
var float closingSD = na
sd = stdev(close, 20)
closingBarTime = timestamp(year, month, dayofmonth, 15, 25)
if time >= closingBarTime and barstate.isconfirmed
    closingSD := sd