Overall Statistics Total Trades 164 Average Win 49.71% Average Loss -3.43% Compounding Annual Return 632.229% Drawdown 79.300% Expectancy 2.968 Net Profit 914.812% Sharpe Ratio 1.883 Loss Rate 74% Win Rate 26% Profit-Loss Ratio 14.50 Alpha 1.792 Beta 0.723 Annual Standard Deviation 0.989 Annual Variance 0.979 Information Ratio 1.786 Tracking Error 0.988 Treynor Ratio 2.577 Total Fees \$4750.81
```from QuantConnect.Indicators import *
import decimal as d

### <summary>
### In this example we are looking for price to breakout above the bollinger bands
### and look to buy when we see that. We hold our position until price touches the
### middle band of the bollinger bands.
###

class BollingerBreakoutAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetStartDate(2016, 6, 1)  #Set Start Date
self.SetEndDate(2017, 7, 1)    #Set End Date
self.SetCash(10000)             #Set Strategy Cash
self.SetBrokerageModel(BrokerageName.GDAX)

# define crypto we want to trade on
# ETHUSD, LTCUSD or BTCUSD
self.target_crypto = "ETHUSD"

# create a bollinger band
self.Bolband = self.BB(self.target_crypto, 20, 2, MovingAverageType.Simple, Resolution.Daily)

# Plot Bollinger band
self.PlotIndicator(
"Indicators",
self.Bolband.LowerBand,
self.Bolband.MiddleBand,
self.Bolband.UpperBand,
)

# create a momentum indicator over 3 days
self.mom = self.MOM(self.target_crypto, 5)

# Plot Momentum
self.PlotIndicator(
"Indicators",
self.mom
)

# set warmup period
self.SetWarmUp(20)

def OnData(self, data):

holdings = self.Portfolio[self.target_crypto].Quantity
price = self.Securities[self.target_crypto].Close
mom = self.mom.Current.Value

# buy if price closes above upper bollinger band
if holdings <= 0:
if price > self.Bolband.LowerBand.Current.Value:
self.SetHoldings(self.target_crypto, 1.0)

# sell if price closes below middle bollinger band
if holdings > 0 and price < self.Bolband.MiddleBand.Current.Value:
self.Liquidate()```