发布于 2021-05-23 08:39:58
newDay = change(time("D")) != 0
sd = stdev(close, 20)
sdDailyClose = valuewhen(newDay, sd[1], 0)这将为您提供前一天的收盘价。
如果您想要eod的值,您需要知道时间范围和会话的结束时间。假设下午3:30关闭(15:30)
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如果你只打算在5m图表上使用它,你可以将它简化为
var float closingSD = na
sd = stdev(close, 20)
closingBarTime = timestamp(year, month, dayofmonth, 15, 25)
if time >= closingBarTime and barstate.isconfirmed
closingSD := sdhttps://stackoverflow.com/questions/67637915
复制相似问题