Overall Statistics |
Total Trades 16 Average Win 0% Average Loss 0% Compounding Annual Return 19.091% Drawdown 9.300% Expectancy 0 Net Profit 17.057% Sharpe Ratio 1.503 Probabilistic Sharpe Ratio 70.603% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.115 Beta 0.239 Annual Standard Deviation 0.12 Annual Variance 0.014 Information Ratio -0.602 Tracking Error 0.152 Treynor Ratio 0.754 Total Fees $16.00 |
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