Overall Statistics |
Total Trades 9 Average Win 15.06% Average Loss -15.62% Compounding Annual Return -3.334% Drawdown 45.900% Expectancy -0.018 Net Profit -3.341% Sharpe Ratio 0.212 Probabilistic Sharpe Ratio 16.890% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 0.96 Alpha 0.104 Beta -0.041 Annual Standard Deviation 0.495 Annual Variance 0.245 Information Ratio 0.147 Tracking Error 0.808 Treynor Ratio -2.546 Total Fees $2520.67 Estimated Strategy Capacity $38000000.00 Lowest Capacity Asset BTCUSDT 18N |
# CRYPTO EMAC LS CRYPTO = "BTCUSDT"; EMA_F = 13; EMA_S = 48; class MovingAverageCrossAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 4, 1) self.SetEndDate(2022, 3, 31) self.SetCash("USDT", 100000) self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin) self.crypto = self.AddCrypto(CRYPTO, Resolution.Daily).Symbol self.fast = self.EMA(self.crypto, EMA_F, Resolution.Daily) self.slow = self.EMA(self.crypto, EMA_S, Resolution.Daily) self.SetWarmUp(5*EMA_S, Resolution.Daily) def OnData(self, data): if self.IsWarmingUp: return if not self.slow.IsReady: return self.Plot(self.crypto, "Price", self.Securities[self.crypto].Price) self.Plot(self.crypto, "ema_fast", self.fast.Current.Value ) self.Plot(self.crypto, "ema_slow", self.slow.Current.Value ) if not self.Portfolio[self.crypto].IsLong: if self.fast.Current.Value >= self.slow.Current.Value: self.SetHoldings(self.crypto, 1) elif not self.Portfolio[self.crypto].IsShort: if self.fast.Current.Value < self.slow.Current.Value: self.SetHoldings(self.crypto, -1)