Hi all, 

I've followed the 200-50 Momentum Universe tutorial to the letter and attempted to substitute the indicators for bollinger bands and keltner channels. When running the algorithm it returns algorithm has no attribute self.indicators. In adding this into the Initialize method it then returns, algorithm has no attribute time. Can anyone help me in fixing this? What am I doing wrong?

Thanks!

 

class KeltnerBollingerSelectionModel2(QCAlgorithm):
   
   def Initialize(self):
       self.indicators = {}
       
   def CoarseSelectionFunction(self, universe):
       selected = []
       universe = sorted(universe, key = lambda c: c.DollarVolume, reverse = True)
       universe = [c for c in universe][:100]
       
       for coarse in universe:
           symbol = coarse.Symbol
           
           if symbol not in self.indicators:
               self.indicators[symbol] = SelectionData()
               
           self.indicators[symbol].update(self.time, coarse.AdjustedPrice)
           
           if self.indicators[symbol].bollinger.UpperBand < self.indicators[symbol].keltner.UpperBand and \
               self.indicators[symbol].bollinger.LowerBand > self.indicators[symbol].keltner.LowerBand:
                   if self.indicators[symbol].is_ready():
                       selected.append(symbol)
       
       return selected

       
class SelectionData(object):
   def __init__(self):
       self.bollinger = BollingerBands(20, 2, movingAverageType = MovingAverageType.Simple)
       self.keltner = KeltnerChannels(20, 1.5, movingAverageType = MovingAverageType.Simple)
       
   def is_ready(self):
       return self.bollinger.IsReady and self.keltner.IsReady
       
   def update(self, time, price):
       self.bollinger.Update(time, price)
       self.keltner.Update(time, price)