Hi,

I create 15 min SPX Index consolidation and based on this data try to buy SP500EMini.
My code not process marketorder for future. How I can by SP500EMini from OnDataConsolidated15min?
Thanks for help.

    def OnDataConsolidated15min(self, sender, TradeBar):

            self.rsi94.Update(TradeBar.EndTime,TradeBar.Close)

            rsi94_current = self.rsi94.Current.Value

            self.rsi94_Window.Add(self.rsi94.Current)

            if self.rsi94_Window.Count >=2:

              rsi94c = self.rsi94.Current.Value

              rsi94p = self.rsi94_Window[1].Value      

              self.atr.Update(TradeBar)

              atr = self.atr.Current.Value

             position = self.Portfolio[self.future_symbol].Quantity  

              if position == 0:  

                if rsi94c > 50 and rsi94p < 50 and rsi94c != 0 and rsi94p != 0:

                    cash =  self.Portfolio.Cash

                    last_price = self.Securities[self.future_symbol].Price

                    ticket = self.MarketOrder(self.future_symbol, 100)

                    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

                    buy_price = ticket.AverageFillPrice

                    self.stop_price = buy_price + self.atr.Current.Value * 0.5  

                    self.limit_price = buy_price - self.atr.Current.Value * 20  

                    self.stopMarketTicket = self.StopMarketOrder(self.future_symbol, 100, self.stop_price)

                    self.limitTicket = self.LimitOrder(self.future_symbol, 100, self.limit_price)