Overall Statistics
class ParticleTachyonCompensator(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 8, 17)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("AAPL", Resolution.Daily)
        
        
        self.entryTicket = None
        self.stoplossTicket = None
        self.profit1Ticket = None
        self.profit2Ticket = None
        
        
    def OnData(self, data):
        
        if self.entryTicket == None:
            
            self.stopBuyPrice = data["AAPL"].Close + 3
            self.stopLossPrice = self.stopBuyPrice - 10
            self.profitTarget1 = self.stopBuyPrice + 10
            self.profitTarget2 = self.stopBuyPrice + 20
            
            self.entryTicket = self.StopMarketOrder("AAPL", 100, self.stopBuyPrice)
    
    
    def OnOrderEvent(self, orderevent):
        if orderevent.Status != OrderStatus.Filled:
            return
        
        if self.entryTicket != None and self.entryTicket.OrderId == orderevent.OrderId:
           # Enter stop loss order
           self.stoplossTicket = self.StopMarketOrder("AAPL",-100,self.stopLossPrice)
           # Enter limit order 1
           self.profit1Ticket = self.LimitOrder("AAPL",-50,self.profitTarget1)
           # Enter limit order 2
           self.profit2Ticket = self.LimitOrder("AAPL",-50,self.profitTarget2)
        
        if self.profit1Ticket != None and self.profit1Ticket.OrderId == orderevent.OrderId:
            self.stoplossTicket.UpdateQuantity(-50)
            
        if self.stoplossTicket != None and self.stoplossTicket.OrderId == orderevent.OrderId:
            self.profit1Ticket.Cancel()
            self.profit2Ticket.Cancel()
            self.entryTicket = None
        
        if self.profit2Ticket != None and self.profit2Ticket.OrderId == orderevent.OrderId:
            self.stoplossTicket.Cancel()
            self.entryTicket = None