Overall Statistics |
Total Trades 12 Average Win 10.39% Average Loss -7.06% Compounding Annual Return -10.246% Drawdown 29.700% Expectancy -0.176 Net Profit -10.107% Sharpe Ratio -0.062 Probabilistic Sharpe Ratio 10.244% Loss Rate 67% Win Rate 33% Profit-Loss Ratio 1.47 Alpha -0.194 Beta 0.206 Annual Standard Deviation 0.328 Annual Variance 0.108 Information Ratio -1.402 Tracking Error 0.614 Treynor Ratio -0.099 Total Fees $0.00 Estimated Strategy Capacity $21000000.00 Lowest Capacity Asset BTCUSD XJ |
class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2021,1, 1) self.SetEndDate(2021,12,25) self.SetCash(100000) bit = self.AddCrypto("BTCUSD", Resolution.Daily) bit.SetDataNormalizationMode(DataNormalizationMode.Raw) self.bit = bit.Symbol self.SetBenchmark(self.bit) self.dema = self.DEMA(self.bit, 20, Resolution.Daily) self.str = self.STR(self.bit, 10, 3, MovingAverageType.Wilders, Resolution.Daily) self.mom1 = self.MOM(self.bit, 20, Resolution.Daily) self.mom2 = IndicatorExtensions.Of(Momentum(20), self.dema) self.SetWarmUp(40, Resolution.Daily) def OnData(self, data): if self.IsWarmingUp or not self.dema.IsReady or not self.str.IsReady: return if not data.ContainsKey(self.bit) or not self.mom1.IsReady or not self.mom2.IsReady: return price = self.Securities[self.bit].Close self.Plot(self.bit, "Price", price) self.Plot(self.bit, "DEMA", self.dema.Current.Value) self.Plot(self.bit, "STR", self.str.Current.Value) self.Plot("Momentum", "MOM1", self.mom1.Current.Value) self.Plot("Momentum", "MOM2", self.mom2.Current.Value) self.Plot("Momentum", "Zero", 0) if not self.Portfolio.Invested: if self.mom2.Current.Value >= 0 and self.dema.Current.Value > self.str.Current.Value: self.SetHoldings(self.bit, 0.9) elif self.Portfolio.Invested: if self.mom2.Current.Value < 0 or self.dema.Current.Value < self.str.Current.Value: self.Liquidate(self.bit)