Hi all,

As part of a test strategy, I am trying to use to On Balance Volume to confirm a breakout using a rolling window to check if the previous days OBV is either greater or lower than the current OBV. This results in:

Runtime Error: TypeError : Cannot get managed object  at Update    sd.obvWindow[1] < sd.obv.Current.Value: ===   at Python.Runtime.PyObject.Invoke(PyTuple args in Alpha6.py:line 31 TypeError : Cannot get managed objec

Am I using this indicator correctly? I don't understand why it cannot retrieve the value when I've implemented it in the same way as my other indicators. Code it below

Thanks!

class Donchian6(AlphaModel):
   
   def __init__(self, lowerBand = 55, upperBand = 55, emaPeriod = 100, resolution = Resolution.Daily):
       self.lowerBand = lowerBand
       self.upperBand = upperBand
       self.resolution = resolution
       self.emaPeriod = emaPeriod
       
       self.insightPeriod = Time.Multiply(Extensions.ToTimeSpan(resolution), upperBand)
       self.symbolData = {}

       resolutionString = Extensions.GetEnumString(resolution, Resolution)
       self.Name = '{}({},{},{})'.format(self.__class__.__name__, lowerBand, upperBand, resolutionString)
       

   def Update(self, algorithm, data):
       
       insights = []
       for key, sd in self.symbolData.items():
           if sd.donchian.IsReady and \
               sd.donchianWindow.IsReady and \
               sd._donchian["UpperBand"].IsReady and \
               sd._donchian["LowerBand"].IsReady and \
               sd.obv.IsReady and\
               sd.obvWindow.IsReady:
               
               if sd._donchian["UpperBand"][1] < sd.Security.Close and \
                   sd.Security.Close > sd.ema.Current.Value and \
                   sd.obvWindow[1] < sd.obv.Current.Value:
                       
                   insights.append(Insight.Price(sd.Security.Symbol, self.insightPeriod, InsightDirection.Up))
               
               if sd._donchian["LowerBand"][1] > sd.Security.Close and \
                   sd.Security.Close < sd.ema.Current.Value and \
                   sd.obvWindow[1] > sd.obv.Current.Value:
                   
                   insights.append(Insight.Price(sd.Security.Symbol, self.insightPeriod, InsightDirection.Down))    
           
       return insights
       
   def OnSecuritiesChanged(self, algorithm, changes):
       for added in changes.AddedSecurities:
           self.symbolData[added.Symbol] = SymbolData(algorithm, added, self.upperBand, self.lowerBand, self.emaPeriod, self.resolution)
       
       for removed in changes.RemovedSecurities:
           data = self.symbolData.pop(removed.Symbol, None)
           if data is not None:
               algorithm.SubscriptionManager.RemoveConsolidator(removed.Symbol, data.Consolidator)
               
class SymbolData:
   def __init__(self, algorithm, security, lowerBand, upperBand, emaPeriod, resolution):
       self.Security = security
       self.donchian = DonchianChannel(upperBand, lowerBand)
       self._donchian = {}
       
       self.Consolidator = algorithm.ResolveConsolidator(security.Symbol, resolution)
       algorithm.RegisterIndicator(security.Symbol, self.donchian, self.Consolidator)
       
       self.donchian.Updated += self.DonchianUpdated
       
       self.donchianWindow = RollingWindow[IndicatorDataPoint](2)
       self._donchian["UpperBand"] = RollingWindow[float](2)
       self._donchian["LowerBand"] = RollingWindow[float](2)
       
       self.ema = ExponentialMovingAverage(emaPeriod)
       self.ConsolidatorEMA = algorithm.ResolveConsolidator(security.Symbol, resolution)
       algorithm.RegisterIndicator(security.Symbol, self.ema, self.ConsolidatorEMA)
       
       self.obv = OnBalanceVolume()
       self.ConsolidatorOBV = algorithm.ResolveConsolidator(security.Symbol, resolution)
       algorithm.RegisterIndicator(security.Symbol, self.obv, self.ConsolidatorOBV)
       
       self.obv.Updated += self.OBVUpdated
       
       self.obvWindow = RollingWindow[IndicatorDataPoint](2)
       

       
   def DonchianUpdated(self, sender, updated):
       self.donchianWindow.Add(updated)
       
       self._donchian["UpperBand"].Add(self.donchian.UpperBand.Current.Value)
       self._donchian["LowerBand"].Add(self.donchian.LowerBand.Current.Value)
       
   def OBVUpdated(self, sender, updated):
       self.obvWindow.Add(updated)