Overall Statistics |
Total Trades 487 Average Win 5.34% Average Loss -1.12% Compounding Annual Return 38.908% Drawdown 19.400% Expectancy 0.284 Net Profit 103.066% Sharpe Ratio 1.452 Probabilistic Sharpe Ratio 68.913% Loss Rate 78% Win Rate 22% Profit-Loss Ratio 4.78 Alpha 0.248 Beta 0.231 Annual Standard Deviation 0.193 Annual Variance 0.037 Information Ratio 0.572 Tracking Error 0.246 Treynor Ratio 1.209 Total Fees $0.00 Estimated Strategy Capacity $920000.00 Lowest Capacity Asset BTCBUSD 18N |
class RetrospectiveMagentaAlbatross(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetCash(1000000) self.crypto = self.AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance).Symbol self.rsi = self.RSI(self.crypto, 14, MovingAverageType.Simple, Resolution.Daily) self.SetWarmUp(14 + 1, Resolution.Daily) self.threshold = 0.72 self.StopLoss = -0.01 self.ProfitTarget = 0.05 def OnData(self, data): if self.IsWarmingUp: return if not self.rsi.IsReady: return pnl = self.Portfolio[self.crypto].UnrealizedProfit / self.Portfolio.TotalPortfolioValue if not self.Portfolio[self.crypto].Invested: if self.rsi.Current.Value >= self.threshold: self.SetHoldings(self.crypto, 0.3) elif self.Portfolio[self.crypto].Invested: if self.rsi.Current.Value < self.threshold: self.Liquidate(self.crypto, "RSI less than threshold") elif pnl >= self.ProfitTarget: self.Liquidate(self.crypto, "Took profit") elif pnl < self.StopLoss: self.Liquidate(self.crypto, "Took loss") else: return