I was following the example given in the docs:

# request the daily equity data
self.AddEquity("SPY", Resolution.Daily)
# define a 10-period RSI indicator with indicator constructor
self.rsi = RelativeStrengthIndex(10, MovingAverageType.Simple)
# register the daily data of "SPY" to automatically update the indicator
self.RegisterIndicator("SPY", self.rsi, Resolution.Daily)

https://www.quantconnect.com/docs/algorithm-reference/indicators#Indicators-Indicator-Ready

And on the same lines, I added this code

self.adx = self.ADX(self.symbol, self.adx_period)

self.RegisterIndicator(self.symbol, self.adx, Resolution.Daily)

 

However, this returns an error

Runtime Error: This is a forward only indicator: ADX(IWM_min) Input: 2017-02-01 00:00:00Z Previous: 2017-02-02 09:30:00Z (Open Stacktrace)

(the date 2017-02-01 is because the start date is 2017-01-01)

 

But when I added this code

self.adx = self.ADX(self.symbol, self.adx_period, Resolution.Daily), I start getting values of ADX - which do not seem to be entirely accurate, but that is another story

This also produces some output of ADX

self.adx = self.ADX(self.symbol, self.adx_period, Resolution.Daily)

self.RegisterIndicator(self.symbol, self.adx, Resolution.Daily)

 

So which one is the recommended usage?

Author