Overall Statistics |
Total Trades 1378 Average Win 1.77% Average Loss -0.61% Compounding Annual Return -100% Drawdown 98.300% Expectancy -0.955 Net Profit -98.319% Sharpe Ratio -0.373 Probabilistic Sharpe Ratio 0.000% Loss Rate 99% Win Rate 1% Profit-Loss Ratio 2.88 Alpha -13.639 Beta 0.189 Annual Standard Deviation 2.679 Annual Variance 7.178 Information Ratio -23.561 Tracking Error 2.883 Treynor Ratio -5.295 Total Fees $85672.46 Estimated Strategy Capacity $0 Lowest Capacity Asset BTCUSD XJ |
class MovingAverageCrossAlgorithm(QCAlgorithm): '''In this example we look at the canonical 15/30 day moving average cross. This algorithm will go long when the 15 crosses above the 30 and will liquidate when the 15 crosses back below the 30.''' def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2015, 1, 1) #Set Start Date self.SetEndDate(2015, 2, 1) #Set End Date self.SetCash(100_000) #Set Strategy Cash #self.SetCash("BTC", 1) self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash) # Find more symbols here: http://quantconnect.com/data self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute).Symbol self.fast = self.EMA(self.symbol, 3, Resolution.Minute); self.slow = self.EMA(self.symbol, 7, Resolution.Minute); self.superslow = self.EMA(self.symbol, 15, Resolution.Minute); self.timeToBuy = True def OnData(self, data): if not self.fast.IsReady or not self.slow.IsReady: return tolerance = 0.00015; if self.Portfolio[self.symbol].Quantity <= 0 and self.fast.Current.Value > self.slow.Current.Value and self.timeToBuy: self.SetHoldings(self.symbol, 1.0) self.timeToBuy = False if self.Portfolio[self.symbol].Quantity > 0 and self.Securities[self.symbol].Open != self.Securities[self.symbol].Close: self.Liquidate() if self.fast.Current.Value < self.slow.Current.Value: self.timeToBuy = True