我正在检索每日关闭数据的指示器,以便在较低的时间框架内使用(1HR/15分钟),并且希望这个指标值只在每天蜡烛关闭时更新。我试图通过创建一个使用"barstate.isrealtime“的函数来解决这个问题,但是它似乎不起作用。我很想听听你对此是否有任何解决办法:)
f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src[barstate.isrealtime ? 1 : 0])
period = input(50)
getStatus(ticker) =>
securityClose = f_secureSecurity(ticker, 'D', close)
norm_price= normalize(securityClose,0,1)
benchmark = f_secureSecurity("USD", 'D', close)
relative_strength = (norm_price / benchmark)
relative_strength_ratio = 100 + ((relative_strength - sma(relative_strength, period)) / stdev(relative_strength, period))
momentum = mom(securityClose,10)
momentum_rolling_mean = sma(momentum,period)
momentum_rolling_std = stdev(momentum,period)
relative_strength_momentum = 100 + ((momentum - momentum_rolling_mean)/momentum_rolling_std)
smoothed_RS_Ratio = sma(relative_strength_ratio,10)
smoothed_RS_Momentum_Ratio = sma(relative_strength_momentum,10)
r_status = smoothed_RS_Ratio
r_status发布于 2022-08-09 19:30:36
您可以直接使用close[1]在您的security(),所以它将始终参考以前的每日收盘价。
f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)https://stackoverflow.com/questions/73294328
复制相似问题