I have been trying to write a class to make a custom SMA envelope indicator and store it in a rolling window, however Im having some difficulty calling the SMA method froum outside the main class, I suspect I may be going about this the wrong way. Any help would be appreciated.

 

class ENV(): #this is our custom sma envelope class def __init__(self, symbol, period, deviation): #deviation is in percentage self.upperRollingWindow = RollingWindow[float](20) self.lowerRollingWindow = RollingWindow[float](20) self.deviation = deviation/100 self.envSma = QCAlgorithm.SMA(symbol, period, Resolution.Hour) def EnvUpperRollingWindow(self): #this function returns the rolling window return self.upperRollingWindow def EnvLowerRollingWindow(self): return self.lowerRollingWindow def UpdateEnvelope(self): self.upperRollingWindow.Add(self.Upper()) self.lowerRollingWindow.Add(self.Lower()) def Upper(self): #gives the upper envelope upperEnv = self.envSma.Current.Value + (self.envSma.Current.Value*self.deviation) return upperEnv def Lower(self): #lower envelope lowerEnv = self.envSma.Current.Value - (self.envSma.Current.Value*self.deviation) return lowerEnv