Overall Statistics |
Total Trades 2292 Average Win 0.52% Average Loss -0.47% Compounding Annual Return 26.200% Drawdown 46.000% Expectancy 0.153 Net Profit 109.089% Sharpe Ratio 0.712 Probabilistic Sharpe Ratio 20.805% Loss Rate 45% Win Rate 55% Profit-Loss Ratio 1.10 Alpha 0.287 Beta -0.573 Annual Standard Deviation 0.334 Annual Variance 0.112 Information Ratio 0.342 Tracking Error 0.45 Treynor Ratio -0.416 Total Fees $8700.73 Estimated Strategy Capacity $180000.00 Lowest Capacity Asset SPUU VQX5IUOB8JMT Portfolio Turnover 28.65% |
#region imports from AlgorithmImports import * #endregion #0. LOAD LIBRARIES from Alphas.MacdAlphaModel import MacdAlphaModel from Execution.ImmediateExecutionModel import ImmediateExecutionModel from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity #The MaximumDrawdownPercentPerSecurity model monitors the unrealized profit percentage of each security in the portfolio. #When the percentage drops below a threshold relative to the opening price, it liquidates the position and #cancels all insights in the Insight Manager that are for the security. #This model can operate even when the Portfolio Construction model provides an #empty list of PortfolioTarget objects. class CrawlingYellowGreenCow(QCAlgorithm): #1. INITIALIZE def Initialize(self): self.SetStartDate(2020, 1, 30) self.SetEndDate(2023, 3, 31) self._cash = 100000 self.SetCash(self._cash) #2. UNIVERSE SELECTION symbols = [ Symbol.Create("TBT", SecurityType.Equity, Market.USA), Symbol.Create("SPUU", SecurityType.Equity, Market.USA), Symbol.Create("QLD", SecurityType.Equity, Market.USA), Symbol.Create("UWM", SecurityType.Equity, Market.USA), Symbol.Create("DIG", SecurityType.Equity, Market.USA), Symbol.Create("UGL", SecurityType.Equity, Market.USA) ] self.SetUniverseSelection( ManualUniverseSelectionModel(symbols) ) #3. MODEL STRUCTURE self.AddAlpha(MacdAlphaModel(12, 26, 9, MovingAverageType.Simple, Resolution.Daily)) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) self.SetExecution(ImmediateExecutionModel()) self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.05)) #4. REFERENCES FOR PLOTTING THE BENCHMARK self._benchmark = self.AddEquity("SPY", Resolution.Daily, Market.USA).Symbol self._Initial = self.History(self._benchmark,1, Resolution.Daily) self._initialPrice = self._Initial['open'][0] #5. PLOTS def OnData(self, data): self.Plot("Strategy Equity", "Relative", self._cash*self.Securities[self._benchmark].Close/(self._initialPrice*self.Portfolio.TotalPortfolioValue))