When I run this code in initialize:

self.AddEquity("SPY") self.spy = self.Securities["SPY"].Price self.spy_mavg = self.SMA("SPY", 10, Resolution.Daily, Field.Close) self.SetWarmUp(20)

And this code on market open:

spy_price = float(str(self.Securities["SPY"].Price)) spy_mavg = float(str(self.spy_mavg)) if (spy_price < spy_mavg): #run method code

The spy_mavg is significantly less than what I know is correct. What about the above code would cause the Simple Moving Average for SPY to be incorrect? Finaly tidbit: I'm running this code live to IBKR and using their data (I do have the appropriate subscription). Should run live using QC's data? Any help greatly appreciated. Thanks!

Author