I tried to write a statement where if an order had been placed for a certain security, then the buy condition is ‘voided’ by not having a value until the next day, but I am running into issues. 

 

 

def OnData(self, slice):
      
      
      
       if not all([data.IsReady for data in self.symbolData.values()]):
            return
       
       for symbol, data in self.symbolData.items():
           price = self.Securities[symbol].Price
           
           
           if price >= data.entryPricesLong:
               marketorderticket = self.SetHoldings(symbol, 0.1)
               stopmarketorderticket = self.StopMarketOrder(symbol, -1.0, price * self.stopLossPercentLong)
               limitorderticket = self.LimitOrder(symbol, -1.0, price * self.takeProfitPercentLong)
           if price <= data.entryPricesShort:
               marketorderticketshort = self.SetHoldings(symbol, -0.1)
               stopmarketorderticketshort = self.StopMarketOrder(symbol, -1.0, price * self.stopLossPercentShort)
               limitorderticketshort =self.LimitOrder(symbol, -1.0, price * self.takeProfitPercentShort)
       
           if marketorderticket.time < (self.time - datetime.timedelta(hours = 8)):
               data.entrypricesLong = None
           if marketordertickershort.time < (self.time - datetime.timedelta(hours = 8)):
               data.entrypricesShort = None