Add Technical Indicator to chart.Posn

烈酒焚心 提交于 2019-12-12 12:54:51

问题


For some reason I cannot add a ROC signal to a blotter chart. In the documentation it should be allowed. I want to create a new chart bellow with this indicator. Can someone help?

# plot performance for symbol
chart.Posn(strategy_AbsMom, Symbol = 'SPY', Dates = '1998::',theme=myTheme)
chart.Posn(strategy_AbsMom, Symbol = 'SPY', Dates = '1998::',theme=myTheme,
           TA='addROC(n=lookback,col=4)')

回答1:


chart.Posn uses chart_Series (not chartSeries) internally, so you have to use add_* functions (not add*). Here's an example of adding a simple moving average to a chart.Posn chart:

require(blotter)
demo(amzn_test, ask=FALSE)
chart.Posn("amzn_port", "amzn", TA='add_SMA(n=5, col=4)')



来源:https://stackoverflow.com/questions/32549654/add-technical-indicator-to-chart-posn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!