I have written a simple also to trade during rth and scalp extremes using a short period rsi and a take profit/stopmarket order bracket. I am not able to figure out why the OnOrderEvents method is not performing as it should. I am sure its a simple mistake I am making but I could use some help. The algo should function firstly by entering with market orders then placing take profit limit .005% from current price and stop market order .005% from price, however when reviewing the order log for the back test none of the orders besides the market orders to open my positions and the auto liquidation before cash session close are working. All the help and suggestions are much appreciated, I apologize for posting the raw code, I do not know how to find my backtest to post here for you. Best Regard, 

-Fat Tail Chaser

class BasicTemplateFuturesAlgorithm(QCAlgorithm):

   def Initialize(self):
       self.SetStartDate(2015, 1, 1)
       self.SetEndDate(2015,2,1)
       self.SetCash(100000)  
       self.crudeoilwti = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute)
       self.rsi = self.RSI(self.crudeoilwti.Symbol, 5)
       minuteConsolidator = TradeBarConsolidator(timedelta(minutes=5))
       self.SubscriptionManager.AddConsolidator(self.crudeoilwti.Symbol, minuteConsolidator)
       self.RegisterIndicator(self.crudeoilwti.Symbol, self.rsi, minuteConsolidator)
       
       self.Schedule.On(self.DateRules.EveryDay(self.crudeoilwti.Symbol), self.TimeRules.At(15, 00), self.ClosePositions)
       
       
       self.SetWarmUp(timedelta(weeks=20))
       
       
       self.buyticket = None
       self.sellticket = None
       self.stoplossticket = None
       self.takeprofitticket = None

   def OnData(self,slice):
       if self.Time.hour >= 9 and self.Time.hour <= 14:
           self.Debug(f"Time is between 9h and 12h inclusive. Time is: {self.Time}")
       
           if not self.Portfolio.Invested:    
           
               
                   if self.rsi.Current.Value <= 10:
                       self.buyticket = self.MarketOrder(self.crudeoilwti.Symbol, 1)
                       
               
                   if self.rsi.Current.Value >= 90:
                       self.sellticket = self.MarketOrder(self.crudeoilwti.Symbol, -1)
                       
                   
   def OnOrderEvent(self, orderEvent):
       if orderEvent.Status != OrderStatus.Filled:
           return
         
       if self.buyticket is not None:
           if orderEvent.OrderId == self.buyticket.OrderId:
               price = orderEvent.FillPrice
               self.StopMarketOrder(self.crudeoilwti.Symbol, -1, 
                               orderEvent.FillPrice * .995)
               self.LimitOrder(self.crudeoilwti.Symbol, -1, 
                               orderEvent.FillPrice * 1.005)
           else:
               self.Transactions.CancelOpenOrders(orderEvent.Symbol)
               self.buyticket = None
       if self.sellticket is not None:
           if orderEvent.OrderId == self.sellticket.OrderId:
               price = orderEvent.FillPrice
               self.StopMarketOrder(self.crudeoilwti.Symbol, 1, 
                           orderEvent.FillPrice * 1.005)
               self.LimitOrder(self.crudeoilwti.Symbol, 1, 
                           orderEvent.FillPrice * .995) 
           else:
               self.Transactions.CancelOpenOrders(orderEvent.Symbol)
               self.sellticket = None
       
   def ClosePositions(self):
       self.Liquidate(self.crudeoilwti.Symbol)