Overall Statistics
import datetime

from datetime import timedelta

class BollingerBreakoutAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2019, 11, 25)
        self.SetCash(100000) 
        self.AddEquity("UNH", Resolution.Daily)
        self.Securities["UNH"].Price
        self.bband = self.BB("UNH", 20, 2, MovingAverageType.Simple, Resolution.Daily)
        self.SetWarmUp(364, Resolution.Daily)
        self.SetBenchmark("SPY")
        self.ticket = None 
        self.period = timedelta(days=3)
        
    def OnData(self, data):
        if not (self.bband.IsReady): return
        price = self.Securities["UNH"].Price
        if price <= self.bband.LowerBand.Current.Value:
            self.MarketOrder("UNH", 20)
        
        if self.ticket is not None and self.UtcTime > (self.ticket.Time + self.period):
            self.Liquidate(self.ticket.Symbol)
            self.ticket = None
import datetime

from datetime import timedelta

class BollingerBreakoutAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2019, 11, 25)
        self.SetCash(100000) 
        self.AddEquity("UNH", Resolution.Daily)
        self.Securities["UNH"].Price
        self.bband = self.BB("UNH", 20, 2, MovingAverageType.Simple, Resolution.Daily)
        self.SetWarmUp(364, Resolution.Daily)
        self.SetBenchmark("SPY")
        self.ticket = None 
        self.period = timedelta(days=3)
        
    def OnData(self, data):
        if not (self.bband.IsReady): return
        price = self.Securities["UNH"].Price
        if price <= self.bband.LowerBand.Current.Value:
            self.MarketOrder("UNH", 20)
            self.ticket
        
        if self.ticket is not None and (self.UtcTime > (self.ticket.Time + self.period)):
            self.Liquidate(self.ticket.Symbol)
            self.ticket = None