Systematic Regime Trading

5-model ensemble that classifies market regimes and adjusts equity allocation. Beats SPY on both absolute return and risk-adjusted basis over 15 years of out-of-sample data.

0.70
Sharpe
-28%
Max Drawdown
10.2%
CAGR
6 days
Lead Time

September 2008. The S&P 500 lost 30% in three weeks.

Most systematic strategies were fully invested when the crash hit. This system detected the regime shift 6 days earlier. By September 19, allocation had dropped from 85% to 12%.

-29%
Market (Sep-Dec 2008)
-4.3%
Strategy (Sep-Dec 2008)
-55%
Buy & Hold Max DD
-28%
Strategy Max DD

Performance

Hover for daily returns. Click legend to toggle strategies. Drag to zoom into any period.

Drawdown comparison
Drawdown from peak. Buy-and-hold hit -55% in 2008. The regime strategy cut that in half while delivering higher returns (10.2% vs 9.6% CAGR).
StrategyCAGRVolSharpeMax DDTurnover
Regime Momentum10.2%9.3%0.70-27.7%5.7x
Binary Regime7.5%12.5%0.49-35.8%10.6x
Vol-Managed6.6%10.5%0.47-23.7%1.7x
SMA 2007.0%11.7%0.47-21.9%6.0x
Buy & Hold (SPY)9.6%20.1%0.46-55.2%0.0x

Signal vs Market Drawdown

Signal vs drawdown
Blue: equity allocation. Red: market drawdown. The strategy reduces exposure before and during every major drawdown.

Architecture

190 Stocks 6 Features 5 Models Ensemble Signal Backtest

Walk-forward validation, expanding window, quarterly refit. 59 windows, 3,771 out-of-sample predictions. SPY benchmark. 1-day execution lag. Asymmetric confirmation filters.

Walk-forward loop
while train_end_idx + step_days <= n_total:
    train = feature_df.iloc[:train_end_idx]
    test = feature_df.iloc[train_end_idx:test_end_idx]

    probs = {
        "hmm": fit_predict_hmm(train, test),
        "garch": fit_predict_garch(train, test),
        "kmeans": fit_predict_kmeans(train, test),
        "gmm": fit_predict_gmm(train, test),
        "ms": fit_predict_markov_switching(train, test),
    }
    combined = ensemble.combine(probs)
    train_end_idx += 63  # quarterly

Regime Prediction

Prediction accuracy
Realized volatility over the next 5, 10, and 20 days by predicted regime. Calm: 12%. Turbulent: 22%. Clear separation across all horizons.
Regime timeline
SPY with regime shading. Bottom: ensemble probability decomposition. Turbulent regimes concentrate around 2008, 2011, 2015, and early 2020.

Performance by Regime

Regime performance
Calm markets: Sharpe 1.10, 81% of total return from 52% of trading days.

Try It: Cost Simulator

Drag the slider to see how transaction costs affect strategy performance. Institutional equity costs are typically 5-10 bps.

7 bps
0.70
Sharpe
10.2%
CAGR
-28%
Max DD
31 bps
Breakeven

Through the 2008 Crisis

$10,000 invested in September 2007, right before the worst financial crisis in modern history. Watch what happens.

$10,000
Strategy
$10,000
SPY Buy & Hold

Crude Oil Extension

Crude oil regimes
WTI crude oil regime detection. Correctly identifies the 2008 crash, 2014-2016 oil glut, and the 2020 negative price event. Cross-asset correlation with equity VIX: 0.25.

Ensemble Diagnostics

Model agreement
Pairwise agreement between five models. Feature-space models (HMM, GMM) and return-based models (GARCH, Markov-Switching) form two independent clusters.
Cumulative excess
Cumulative excess return vs SPY. Alpha concentrates during crisis periods. Fama-French R-squared of 0.20 confirms low factor exposure.