
Cross-sectional equity momentum with a Hidden Markov Model regime filter. The regime filter is what makes this different, it's what cuts drawdown during trend reversals without killing too much upside.
What's included:
- Data: yfinance + FRED (free, no API key)
- Signal: 12-1 month cross-sectional momentum on equity ETF universe
- HMM regime detection using VIX + 30-day realized vol as observations
- Position sizing: full size in trending regime, half in risk-off
- Backtest: monthly rebalance, 10bps transaction costs, 2005-2024
- Regime-conditional returns table: see momentum performance broken out by state
- Sensitivity grid: lookback × skip period × filter aggressiveness
Calmar ratio improvement from regime filter: ~0.4-0.6 (no filter) → ~0.8-1.2 (with filter).
Not financial advice. Past performance does not predict future results.
TAGS: equity, momentum, quantitative finance, python, jupyter, backtesting, regime
Trading and quant
Momentum + HMM Regime Filter Equity Quant Notebook
Cross-sectional equity momentum with a Hidden Markov Model regime filter. The regime filter is what makes this different, it's what cuts drawdown during trend reversals without killing too much upside.
One-time price in US dollars, checkout by Stripe. After paying you land on a page with your download link. Each link works for 15 minutes, and reopening that page makes fresh ones.
- momentum-regime-v1.0.zip