【发布时间】:2015-07-21 14:28:52
【问题描述】:
我是 quantmod 的新手,我想知道我可以添加的指标在计算中是否存在滞后。
例如,RSI 会根据过去 14 天(不含当天还是包含当天)计算 RSI?如果我想获得最后一天的 RSI,我应该将带有 lag 函数的代码包装为下面的第二行代码吗?
# The 14-period relative strength index calculated off the open
RSI_14 <- RSI(Op(Data),n=14)
# The 14-period relative strength index calculated off the prior day's open
RSI_14_lastDay <- lag(RSI(Op(Data),n=14),K=1)
【问题讨论】:
-
仅供参考,大部分指标计算都在TTR,而不是quantmod。