我想在图表上绘制昨天最后一个柱状收盘时间新的一天开始了。
我不能使用request.security(syminfo.tickerid, 'D', close[1], lookahead=enter code herebarmerge.lookahead_on)
,因为它返回结算,而不是最后一个蜡烛关闭。
我也试过这个:
var float last_close = na
closing_time = (hour == 18) and (minute == 30)
last_close := closing_time ? close : last_close // Get the new close if it is 18:30, keep the old value otherwise
我只想在新的一天开始的时候画出这幅画,我怎么能做到呢?
函数ta.change(time("D"))
将在当天的第一个bar返回true
。您可以使用它在每个新的一天获得以前的条close
:
var float yestrdayClose = na
if ta.change(time("D"))
yestrdayClose := close[1]