Seventeen versions to find out what to throw away
A quant research program set out to build a regime-classified momentum breakout system. The verdict: keep the regime classifier, retire everything else.
- Status
- Concluded. Concluded. The classifier survives as a standalone risk overlay.
- Built with
- Python, pandas, GJR-GARCH, Hidden Markov models, Walk-forward testing
The problem
Momentum and all-time-high breakouts work, sometimes. The question I wanted to answer was whether a model of market regime could tell me when, and whether a stock-selection layer on top of it added anything.
The plan had two layers. A regime classifier labels the market as bull, drift, or crisis. A selection stack ranks stocks by momentum, detects breakouts, and times entries on retracements.
What I built
The classifier uses ATR z-scores, a GJR-GARCH volatility model, and moving-average filters to label each day. Earlier screener work had already shown that the regime gate was the most important filter on breakout signals. In the crisis regime, every all-time-high signal I tested lost money out of sample.
The program ran through seventeen versions; the selection stack was refined across the last five as notebook iterations, versions thirteen to seventeen.
What I found
The selection stack was negative-value complexity. It failed its own null hypothesis.
The test that settled it was the simplest one available: hold SPY when the classifier says the regime is favorable, step aside when it does not. Regime-timed SPY beat every strategy mode on Sharpe ratio, compound annual growth, and maximum drawdown.
Each round of refinement made the selection stack more elaborate without getting it past that baseline. The only durable part was the classifier, so I retired the selection strategy and kept the classifier as a standalone risk overlay.
The audit checklist
The audit caught indexing bugs, double-counted folds, and gaps between closed-trade and mark-to-market returns. These are the checks, in the order to run them before reading any result.
- Indexing. Every signal uses only data available at the decision time. Check each shift and every rolling window for look-ahead.
- Fold accounting. In walk-forward testing, each trade belongs to exactly one fold. Overlapping windows double-count returns.
- Closed versus marked. Report closed-trade returns and mark-to-market returns separately. A strategy that holds losers looks better on closed trades alone.
- The null. Compare against the simplest strategy that uses the same information. If the complex version cannot beat it, the complexity is the problem.
Follow-on
The classifier’s next use is in planning rather than trading: a regime-switching Monte Carlo engine for financial planning. It uses a two-feature hidden Markov model with a cross-seed stability gate, so that a regime model is only accepted if it comes out the same under different random seeds. The goal is to model drawdowns and sequence-of-returns risk more faithfully than planning tools that assume static, normally distributed returns.