Overall Statistics
Total Trades
138
Average Win
11.96%
Average Loss
-4.97%
Compounding Annual Return
342.809%
Drawdown
49.700%
Expectancy
0.580
Net Profit
314.496%
Sharpe Ratio
3.551
Probabilistic Sharpe Ratio
79.370%
Loss Rate
54%
Win Rate
46%
Profit-Loss Ratio
2.41
Alpha
2.431
Beta
0.559
Annual Standard Deviation
0.804
Annual Variance
0.647
Information Ratio
2.724
Tracking Error
0.769
Treynor Ratio
5.113
Total Fees
$231.28
Estimated Strategy Capacity
$15000000.00
Lowest Capacity Asset
ETHUSD XJ
from QuantConnect.Indicators import *
import decimal as d
class BollingerBreakoutAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2021, 1, 1)  #Set Start Date
        #self.SetCash("ETH",0.05)
        self.SetCash(100)
        self.ticker="ETHUSD"
        self.symbol=self.AddCrypto(self.ticker, Resolution.Daily)
        self.SetBrokerageModel(BrokerageName.GDAX,AccountType.Cash)
        x=16
        self.trailing_stop = 0.05
        self.stopTargetPrice = 0
        self.Bolband = self.BB(self.ticker, x, 3, MovingAverageType.Simple, Resolution.Daily)
        self.SetWarmUp(x)
        self.Schedule.On(self.DateRules.EveryDay(),self.TimeRules.At(12,1),self.EveryDayAfterMarketOpen)
        
    def OnData(self, data):
        if self.IsWarmingUp != False:
            return
        holdings = self.Portfolio[self.ticker].Quantity
        price = self.Securities[self.ticker].Close
        if holdings <= 0:
            if price > self.Bolband.LowerBand.Current.Value:
                quantity = self.CalculateOrderQuantity(self.ticker,1)
                self.MarketOrder(self.ticker, quantity)
                stopPrice = round((1-self.trailing_stop)*self.Securities[self.ticker].Price,2)
                self.stopTicket = self.StopMarketOrder(self.ticker, quantity, stopPrice,'Exited using Sell Stop')
                self.stopTargetPrice = self.Securities[self.ticker].Price
            else:
                if self.Securities[self.ticker].Price < self.stopTargetPrice and self.stopTargetPrice!=0:
                    updateFields = UpdateOrderFields()
                    updateFields.StopPrice = round(self.Securities[self.ticker].Price*(1+self.trailing_stop),2)
                    self.stopTicket.Update(updateFields)
                    self.stopTargetPrice = self.Securities[self.ticker].Price
        if holdings > 0 and price < self.Bolband.MiddleBand.Current.Value:
            self.Liquidate()
            
    def EveryDayAfterMarketOpen(self):
        pass