| Overall Statistics |
|
Total Orders 1 Average Win 0% Average Loss 0% Compounding Annual Return 21.668% Drawdown 34.900% Expectancy 0 Start Equity 100000 End Equity 351544.86 Net Profit 251.545% Sharpe Ratio 0.687 Sortino Ratio 0.748 Probabilistic Sharpe Ratio 23.872% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.032 Beta 1.128 Annual Standard Deviation 0.204 Annual Variance 0.042 Information Ratio 0.589 Tracking Error 0.075 Treynor Ratio 0.125 Total Fees $3.36 Estimated Strategy Capacity $510000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX Portfolio Turnover 0.04% |
#region imports
from AlgorithmImports import *
#endregion
# For a better understanding of the results : https://www.quantconnect.com/docs/v2/our-platform/backtesting/results
class RetrospectiveYellowGreenAlligator(QCAlgorithm):
def Initialize(self):
# INITIALIZE
self.SetStartDate(2019, 1, 1)
self.SetEndDate(2025, 5, 28)
self.SetCash(100000)
self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol
self.qqq = self.AddEquity("QQQ", Resolution.Daily).Symbol
# SET BENCHMARK AND PREPARE COMPARATIVE PLOT
self.SetBenchmark("SPY")
self.lastBenchmarkValue = None
self.BenchmarkPerformance = self.Portfolio.TotalPortfolioValue
def OnData(self, data):
#INVESTMENT STRATEGY
if not self.Portfolio.Invested:
self.SetHoldings("QQQ", 1)
#CREATE A COMPARATIVE PLOT OF STRATEGY VS. BENCHMARK
benchmark = self.Securities["SPY"].Close
if self.lastBenchmarkValue is not None:
self.BenchmarkPerformance = self.BenchmarkPerformance * (benchmark/self.lastBenchmarkValue)
self.lastBenchmarkValue = benchmark
self.Plot("Strategy vs Benchmark", "Portfolio Value", self.Portfolio.TotalPortfolioValue)
self.Plot("Strategy vs Benchmark", "Benchmark", self.BenchmarkPerformance)