husvar
husvar

Reputation: 393

Add Technical Indicator to chart.Posn

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)')

Upvotes: 3

Views: 1161

Answers (1)

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

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)')

enter image description here

Upvotes: 3

Related Questions