Hello All,

I am having trouble with, what I would think, a very simple problem. I am trying to compare the current price of the TQQQ with the current value of the 50 day Exponential Moving Average (EMA50) of the TQQQ.

class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): # Set the cash we'd like to use for our backtest # This is ignored in live trading self.SetCash(100000) # Start and end dates for the backtest. # These are ignored in live trading. self.SetStartDate(2015,1,1) self.SetEndDate(2017,12,31) # Assets predetermined self.tqqq = self.AddEquity("TQQQ", Resolution.Daily).Symbol # Indicators self.emaSmaller = self.EMA("TQQQ", 50, Resolution.Daily) def OnData(self, slice): if not self.Portfolio.Invested: self.Debug("Working after PortfolioInvested") if float(self.Securities["TQQQ"].Price) > self.emaSmaller: self.Debug("Working after first comparison") self.SetHoldings(self.tqqq, 1)

When I compare self.Securities["TQQQ"].Price and self.emaSmaller, I get this error:

Runtime Error: Python.Runtime.PythonException: TypeError : Cannot get managed object at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, object, QuantConnect.Data.Slice) at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.OnData (QuantConnect.Data.Slice slice) [0x000c6] in <91afafcb96134cb1934e681486862439>:0 at QuantConnect.Lean.Engine.AlgorithmManager.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Interfaces.IAlgorithm algorithm, QuantConnect.Lean.Engine.DataFeeds.IDataFeed feed, QuantConnect.Lean.Engine.TransactionHandlers.ITransactionHandler transactions, QuantConnect.Lean.Engine.Results.IResultHandler results, QuantConnect.Lean.Engine.RealTime.IRealTimeHandler realtime, QuantConnect.Lean.Engine.Server.ILeanManager leanManager, QuantConnect.Lean.Engine.Alpha.IAlphaHandler alphas, System.Threading.CancellationToken token) [0x01260] in <7573aaf6e6a74f29b31f8e11628c060e>:0 (Open Stacktrace)

How do I fix this problem.

Thanks,

Malachi