Hi.  I'm working on Warming Up Indicators for securities in my Opening Watchlist.

 

I was able to warmup the EMA, I did this the same way it was presented in BootCamp (working code below).

@ OnData
	for i in self.opening_watchlist:
    	history = self.History(i, 270, Resolution.Daily)
    	self.indicators[i] = DailyWarmup(history)



@ DailyWarmup:
	def __init__(self, history):
        self.ema = ExponentialMovingAverage(200)

		for bar in history.itertuples():
         	self.ema.Update(bar.Index[1], bar.close)

 

However, when I tried to update the ATR in a similar way, I got errors (faulty code below).

@ DailyWarmup:
    def __init__(self, history):	
    	self.ema = ExponentialMovingAverage(200)
        self.atr = AverageTrueRange(14)

        for bar in history.itertuples():
            self.ema.Update(bar.Index[1], bar.close)
            self.atr.Update(bar.Index[1])  # I tried variations of this, including bar.high and bar.low
            

 

Here is the Error the code above threw:


Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'pandas._libs.tslibs.timestamps.Timestamp'>) method. Please checkout the API documentation.
  at __init__
    self.atr.Update(bar.Index[1])
  File "main.py" in main.py:line 277

 

What do I need to do to Warmup the ATR here?  I will be doing VWAP next.

 

Thank you,

Cesare