Hi all,

I'm trying to create a simple moving average indicator with 4 hour resolution. I have tried the following but I have been greeted with the error:

"During the algorithm initialization, the following exception has occurred: 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 SMA method. Please checkout the API documentation."

Any ideas on how to fix this?

class ForexMinuteTrading(QCAlgorithm): def Initialize(self): # Generic Initialization self.SetStartDate(2018, 10, 1) self.SetCash(100000) self.SetBrokerageModel(BrokerageName.FxcmBrokerage) self.symbols = ["EURUSD", "USDJPY", "AUDUSD"] # Order Related Variables self.buyOrders = {} self.stopLoss = {} self.takeProfit = {} self.high = {} # Indicator Related Variables self.duck1 = {} self.duck2 = {} self.duck3 = {} # Add Forex and the proper Indicators for symbol in self.symbols: self.AddForex(symbol, Resolution.Minute, Market.FXCM) fourHours = QuoteBarConsolidator(timedelta(hours=4)) fourHours.DataConsolidated += self.fourHoursConsolidator self.duck2[symbol] = self.SMA(symbol, 60, Resolution.Hour) self.duck3[symbol] = self.SMA(symbol, 60, Resolution.Minute) self.duck1[symbol] = self.SMA(symbol, 60, fourHours) self.SetBenchmark("EURUSD") self.SetWarmUp(100)

 

Author