Hi all,

I'm attempting to obtain BollingerBand's UpperBand and LowerBand properties from an IndicatorDataPoint  object provided by the update method of my consolidator.  I've tried a number of approaches, and perhaps this is due to my shortcomings with Python, but haven't had any luck obtaining these properties from BollingerBands.

The error I get is:

AttributeError : 'IndicatorDataPoint' object has no attribute 'UpperBand'

I would greatly appreciate guidance, or if this is possible.  Thanks in advance.

 

class BBConsolidatorTest(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 5, 1) 
        self.SetEndDate(datetime.now()) 
        self.SetCash(1000000) 

        future = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Tick)
        future.SetFilter(lambda x: x.FrontMonth().OnlyApplyFilterAtMarketOpen())

        self.symbol = None
        self.consolidators = dict()
        self.quoteBarWindow = RollingWindow[QuoteBar](100)

        self.BBIndicator = BollingerBands(12, 2, MovingAverageType.Simple)
        self.BBIndicator.Updated += self.BBUpdated
        self.BBWindow = RollingWindow[IndicatorDataPoint](4)

    def OnDataConsolidated(self, sender, quoteBar):
        self.Debug(str(self.BBWindow[0].UpperBand.Value))
        self.Debug(str(self.BBWindow[0].LowerBand.Value))

    def OnData(self, slice):
        return

    def BBUpdated(self, sender, updated):
        self.BBWindow.Add(updated)

    def OnSecuritiesChanged(self, changes):
        if len(changes.RemovedSecurities) > 0:
            if self.symbol is not None and self.consolidator is not None:
                self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)
                self.BBIndicator.Reset()

        self.symbol = changes.AddedSecurities[0].Symbol

        # Create a new consolidator and register the indicators to it
        consolidator = TickQuoteBarConsolidator(900)
        consolidator.DataConsolidated += self.OnDataConsolidated
        self.SubscriptionManager.AddConsolidator(self.symbol, consolidator)
        self.consolidators[self.symbol] = consolidator
        self.RegisterIndicator(self.symbol, self.BBIndicator, consolidator)

Author