The complete backtest analysis for the strategy has been published using QuantStats, providing a deep dive into performance, risk, and return metrics. Click below to explore the full institutional-style interactive report (Sharpe, Sortino, Drawdowns, Rolling Returns, and much more): Click here to view the full QuantStats backtest report
Date Range: 2024-01-02 → 2024-12-31
Tickers: 32 (Dow 30 + additional large-cap stocks)
| Metric | Value |
|---|---|
| Initial Capital | $1,000,000 |
| Final Capital | $1,401,058 |
| Total Return | +40.11% |
| Annualized Return | 26.30% |
| Max Drawdown | –1.91% |
| Sharpe Ratio (annualized) | 2.36 |
| Trades Executed | 3,308 |
| Win Rate | 66.63% |
| Avg Win / Loss | +$480.21 / –$345.07 |
| Volatility (annualized) | 11.13% |
| Profit Factor | 1.72 |
Diagnostics Summary:
- Entries: 3,308
- Intraday exits: 55
- EOD closes: 3,253
- Z-score invalids (fails): 1,234,512
- Volatility filter fails: 27
- Trend filter fails: 568,989
- Position size fails: 48,938
- Cash availability fails: 353
The following analytical components are provided as part of the QuantX V4.9 backtest package:
-
Equity Curve
- Cumulative balance over time, starting from $1M base.
- Equity initialization begins on 8 Jan 2024 after the first valid signal post warm-up period.
-
PnL Distribution
- Histogram of per-trade profits/losses showing slight right-skew and light tails, consistent with mean-reversion payoff distribution.
-
Monthly Return Distribution
- 11 out of 12 months were profitable; the worst drawdown was under 2%.
-
QuantStats Tear Sheet
- Detailed return statistics, monthly returns, drawdown table, and benchmark-relative plots.
- File:
QuantX_V4.9_QuantStats_Report_Full.pdf.
-
Ticker Trade Charts
- 32 individual PNGs showing price action with trade markers (
▲entries,▼exits). - Cleaned from zero-value anomalies.
- 32 individual PNGs showing price action with trade markers (
-
Trade Log
QuantX_V4.9_Trades_Report.csvand.xlsxcontain:- Time of Signal
- Ticker
- Entry/Exit prices
- PnL
- Z-score at signal
- Position size
-
Equity Curve Data
QuantX_V4.9_EquityCurve.csvfor custom analysis in Python or Excel.
- The framework generated consistent low-drawdown performance, achieving ~26% annualized return with sub-2% drawdown.
- High trade frequency implies strong statistical validity and robustness of Z-score thresholds.
- Limited correlation with SPY confirms mean-reversion’s market-neutral nature.
- Drawdowns remain shallow, suggesting effective volatility-normalized position sizing and proper intraday stop management.
-
Multi-Asset Extension:
Expand universe to include ETFs, futures, or FX pairs with synchronized tick data for cross-asset mean reversion. -
Machine Learning Enhancements:
Integrate adaptive thresholding via regime detection (Hidden Markov Models or clustering-based volatility state identification). -
Transaction Cost Modeling:
Include realistic limit order fills using LOB simulation or dynamic spread modeling. -
Execution Optimization:
Test VWAP and TWAP-based execution for partial fill simulation. -
Portfolio Optimization:
Introduce dynamic capital allocation across tickers based on rolling Sharpe or drawdown-adjusted return. -
Live Deployment:
Integrate with broker APIs (e.g., Interactive Brokers) for paper/live trading environment.
| Tool | Version |
|---|---|
| Python | 3.10 |
| Pandas | 2.1.1 |
| NumPy | 1.26 |
| Matplotlib | 3.8 |
| QuantStats | 0.0.60 |
| pdfkit | 1.0.0 |
| wkhtmltopdf | 0.12.6 |
| Conda Environment | quantx_v49 |
- Source: Proprietary minute-level OHLCV data for Dow 30 equities.
- Location:
Data/1 Min Data/OHLC/ - Cached path (if using joblib):
notebooks/cache_minute_data/joblib/__main__...
-
Activate environment:
conda activate quantx_v49 -
Run backtest notebook:
notebooks/run_backtest.ipynb -
Generate reports:
notebooks/analysis.ipynb -
Convert QuantStats HTML to PDF using
pdfkitor browser print.
Quant_Strategy_Backtester/
├── README.md
├── environment.yml
├── requirements.txt
├── data/
│ └── 1 Min Data/OHLC/
├── notebooks/
│ ├── run_backtest.ipynb
│ ├── analysis.ipynb
│ └── cache_minute_data/
├── src/
│ ├── strategy.py
│ ├── backtest.py
│ ├── execution.py
│ ├── reporting.py
│ └── utils.py
├── outputs/
│ ├── QuantX_Final_Backtest_Results.pdf
│ ├── QuantX_V4.9_QuantStats_Report_Full.pdf
│ ├── QuantX_V4.9_Trades_Report.xlsx
│ ├── QuantX_V4.9_EquityCurve.xlsx
│ ├── QuantX_V4.9_EquityCurve.png
│ ├── QuantX_V4.9_PnL_Hist.png
│ └── charts/
│ ├── chart_AAPL_all_trades.png
│ ├── chart_MSFT_all_trades.png
│ └── ...
└── docs/
└── backtest_performance_template.pdf
Strategy demonstrates the efficacy of a statistically disciplined, volatility-adjusted intraday mean-reversion framework.
The backtest confirms that a properly parameterized short-horizon strategy can achieve superior risk-adjusted returns while maintaining minimal drawdowns.
This repository serves as a complete and reproducible record of the strategy’s design, assumptions, implementation, and results, suitable for internal audit, investment committee review, or further research development.
Released under the MIT License.
Copyright © 2025 Alqama Ansari.
If referencing or using this codebase in research:
Ansari, A. (2025). QuantX V4.9: Intraday Mean-Reversion Strategy Backtest. GitHub Repository. https://github.com/ /Quant_Strategy_Backtester