Overall Statistics |
Total Orders 239 Average Win 0.06% Average Loss -0.05% Compounding Annual Return 15.975% Drawdown 7.000% Expectancy 0.832 Start Equity 100000 End Equity 124921.11 Net Profit 24.921% Sharpe Ratio 0.89 Sortino Ratio 1.082 Probabilistic Sharpe Ratio 78.850% Loss Rate 14% Win Rate 86% Profit-Loss Ratio 1.14 Alpha 0.009 Beta 0.36 Annual Standard Deviation 0.068 Annual Variance 0.005 Information Ratio -0.87 Tracking Error 0.096 Treynor Ratio 0.168 Total Fees $239.71 Estimated Strategy Capacity $53000000.00 Lowest Capacity Asset BND TRO5ZARLX6JP Portfolio Turnover 0.50% |
# region imports from AlgorithmImports import * # endregion class DeterminedTanZebra(QCAlgorithm): def Initialize(self): self.SetStartDate(2022, 9, 28) self.SetCash(100000) tickers = ["SPY", "BND", "GLD", "QQQ"] security_type = SecurityType.Cfd if self.LiveMode else SecurityType.Equity for ticker in tickers: equity = self.AddEquity(ticker, Resolution.Daily) equity.sma_fast = self.SMA(equity.Symbol, 50) equity.sma_slow = self.SMA(equity.Symbol, 200) equity.target_vehicle = self.AddCfd(ticker, Resolution.Daily, market=Market.InteractiveBrokers).Symbol if self.LiveMode else equity.Symbol def OnData(self, data: Slice): for security in self.Securities.Values: if security.sma_fast > security.sma_slow: self.SetHoldings(security.target_vehicle, 0.25) else: self.SetHoldings(security.target_vehicle, 0) # In Initialize: # self.UniverseSettings.Asynchronous = True # self.universe = self.AddUniverse(self.FundamentalSelectionFunction) # def FundamentalSelectionFunction(self, fundamental: List[Fundamental]) -> List[Symbol]: # filtered = [f for f in fundamental if f.Price > 10 and f.HasFundamentalData and not np.isnan(f.ValuationRatios.PERatio)] # sortedByDollarVolume = sorted(filtered, key=lambda f: f.DollarVolume, reverse=True)[:100] # sortedByPeRatio = sorted(sortedByDollarVolume, key=lambda f: f.ValuationRatios.PERatio, reverse=False)[:10] # if self.LiveMode: # return [Symbol.Create(f.Value, SecurityType.Cfd, Market.InteractiveBrokers) for f in sortedByPeRatio] # else: # return [f.Symbol for f in sortedByPeRatio]