class OpenRangeBreakout(QCAlgorithm): openingBar = None currentBar = None def Initialize(self): self.SetStartDate(2018, 7, 10) # Set Start Date self.SetEndDate(2019, 6, 30) # Set End Date self.SetCash(100000) # Set Strategy Cash # Subscribe to TSLA with Minute Resolution future = self.AddFuture(Futures.Indices.SP500EMini) #1. Create our consolidator with a timedelta of 30 min self.Consolidate("SP500EMini", timedelta(minutes=30),self.OnDataConsolidated) def OnData(self, data): if self.Portfolio.Invested or self.openingBar is None: return if data['SP500EMini'].Close > self.openingBar.High: self.SetHoldings("SP500EMini",1) elif data["SP500EMini"].Close < self.openingBar.Low: self.SetHoldings("SP500EMini",-1) #2. Create a function OnDataConsolidator which saves the currentBar as bar def OnDataConsolidated(self, bar): #1. Check the time, we only want to work with the first 30min after Market Open if bar.Time.hour == 9 and bar.Time.minute == 30: #2. Save one bar as openingBar self.openingBar = bar

I am trying to take the "Boot camp" tutorial and apply them to futures. And I keep getting stuck. What am I doing wrong? Any help is greatly appreciated. 

Author