Quantitative methods · Beginner · Monthly check

Kalman Filter Trend
How it works, and when it doesn't.

In every bear market since 1980, either gold (GLD) or long bonds (TLT) delivered positive returns. This strategy is rarely in cash — it always holds whichever safe haven is winning the macro argument.

Today's signal · re-scored after every close
Long

Holding SPY

Kalman slope=0.132%/day (positive trend). Price 759.8 above Kalman level=754.7. Trend active for 0 days. Obs noise=0.1, proc noise=0.050.

Why it works

Gold and long-term bonds are both defensive assets but respond differently to macroeconomic environments. Gold outperforms during inflation and dollar weakness. Bonds outperform during deflation and recession fears. Using 63-day relative momentum to choose between them means always holding the winning safe haven asset.

The signal logic

  1. Compute 63-day return for GLD and TLT
  2. Hold GLD: GLD 63-day return > TLT AND GLD above SMA(50)
  3. Hold TLT: TLT return positive and GLD fails filter
  4. XGBoost macro regime classifier confirms direction
  5. Cash only if both assets have negative absolute momentum

When it fails

2022 — the Fed's fastest tightening in 40 years caused both gold and bonds to fall simultaneously as real yields surged.

Best market
Inflationary environments (gold), recession fears (bonds), any macro uncertainty
Worst market
Real yield shock — simultaneous gold and bond selloffs

Backtest

Sharpe ratio-0.50
Annual return-6.9%
Worst drawdown-34.0%
Trades in the backtest613

Backtest on daily bars, positions taken the bar after the signal (no look-ahead).

Kalman Filter Trend, 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.