Overall Statistics |
Total Trades 32 Average Win 25.85% Average Loss -2.83% Compounding Annual Return 121.434% Drawdown 24.800% Expectancy 6.610 Net Profit 992.386% Sharpe Ratio 1.675 Loss Rate 25% Win Rate 75% Profit-Loss Ratio 9.15 Alpha 0.004 Beta 44.335 Annual Standard Deviation 0.367 Annual Variance 0.135 Information Ratio 1.637 Tracking Error 0.367 Treynor Ratio 0.014 Total Fees $4649.16 |
from QuantConnect.Indicators import * class BollingerMomentum(QCAlgorithm): def Initialize(self): self.SetStartDate(2016, 1, 1) #Set Start Date self.SetEndDate(2019, 1, 1) #Set End Date self.SetCash(10000) #Set Strategy Cash self.SetBrokerageModel(BrokerageName.GDAX,AccountType.Cash) self.AddCrypto("BTCUSD", Resolution.Daily) ## Set Boilinger Bands self.bband = self.BB("BTCUSD", 20, 2, MovingAverageType.Simple, Resolution.Daily) # Set WarmUp period self.SetWarmUp(20) def OnData(self, data): price = self.Securities["BTCUSD"].Close ## BUY if price is larger than upper band if not self.Portfolio['BTCUSD'].Invested and price > self.bband.UpperBand.Current.Value: self.SetHoldings("BTCUSD",1) ## Liquidate if price is less than middle band if self.Portfolio['BTCUSD'].Invested and price < self.bband.MiddleBand.Current.Value: self.Liquidate()