Overall Statistics
Total Trades
68
Average Win
0%
Average Loss
0%
Compounding Annual Return
1.233%
Drawdown
1.800%
Expectancy
0
Net Profit
3.624%
Sharpe Ratio
1.057
Probabilistic Sharpe Ratio
53.948%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.005
Beta
0.05
Annual Standard Deviation
0.012
Annual Variance
0
Information Ratio
-1.06
Tracking Error
0.123
Treynor Ratio
0.247
Total Fees
$68.00
class BollingerBreakoutAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2017, 1, 1)
        self.SetEndDate(2019, 11, 25)
        self.SetCash(100000)

        self.bband = dict()
        for ticker in ["UNH", "DIS"]:
            symbol = self.AddEquity(ticker, Resolution.Daily).Symbol
            self.bband[symbol] = self.BB(symbol, 20, 2, MovingAverageType.Simple, Resolution.Daily)
        
        self.SetWarmUp(20, Resolution.Daily)
        self.SetBenchmark("SPY")
        
    def OnData(self, data):
        if not all([bband.IsReady for symbol, bband in self.bband.items()]):
            return
        
        for symbol, bband in self.bband.items():
            price = self.Securities[symbol].Price
            if price < bband.LowerBand.Current.Value:
                self.MarketOrder(symbol, 1)