Quantitative methods · Intermediate · Daily
Walk-Forward Framework
How it works, and when it doesn't.
The SPY/QQQ spread has mean-reverted with a half-life of ~8-12 trading days historically. The Ornstein-Uhlenbeck framework quantifies when the spread is far enough from equilibrium to trade profitably.
Holding SPY
WFO meta vote=-1.00 (bearish). [SMA(5/20)=- w=0.48, SMA(5/100)=- w=0.29, SMA(5/40)=- w=0.24]. OOS Sharpe=0.34. Short.
Why it works
SPY and QQQ are cointegrated — their spread tends to revert to a mean over time. The Kalman Filter provides dynamic estimates of the hedge ratio and mean reversion speed, making this more robust than static cointegration models.
The signal logic
- Estimate dynamic hedge ratio using Kalman Filter
- Compute spread = SPY - beta * QQQ
- Long spread (long SPY, short QQQ) when spread < -2σ
- Short spread (short SPY, long QQQ) when spread > +2σ
- Exit at mean (0σ); stop loss at ±3σ
When it fails
The cointegration breaks during structural changes. During AI/tech rallies QQQ systematically outperforms SPY for extended periods.
- Best market
- Markets with stable SPY/QQQ beta relationships and mean-reverting sector rotation
- Worst market
- Strong sector concentration (AI dominance causing persistent QQQ outperformance)
Backtest
| Sharpe ratio | -0.18 |
| Annual return | -4.0% |
| Worst drawdown | -29.8% |
| Trades in the backtest | 41 |
Backtest on daily bars, positions taken the bar after the signal (no look-ahead).
Walk-Forward Framework, live.
Re-scored after every close.
The platform runs this and 32 other strategies against the live tape each day — with the evidence behind every number.