Algorithmic Trading.

Signals, backtests, and the discipline that separates edge from artefact.

4 articles · each one with a runnable notebook

Algorithmic TradingFoundational

The SMA Crossover, Honestly Backtested: QQQ and Bitcoin, Costs Included

The moving-average crossover is trend following's workhorse — and the perfect vehicle for backtesting discipline 101. We run the same long-or-flat rule on QQQ and BTC-USD over 2015–2024, close the lookahead gap with one shift(1), charge 10bp a side, then sweep a 4×4 parameter grid: QQQ's grid straddles buy-and-hold while BTC's sits above it. Trend behaves differently per asset.

25 Jul 202611 minRead ↗
Algorithmic TradingAdvanced

Kalman Filters for Dynamic Hedge Ratios: Tracking a Beta That Refuses to Sit Still

Static hedge ratios assume the relationship never moves; on EWA/EWC 2010–2024 it moves from 0.71 to 1.49. We treat beta as a random-walk state, filter it in five lines of NumPy, and trade the spread both ways — the Kalman beta wins as an estimator (gross Sharpe 0.55 vs 0.47, half the drawdown), while 10 bp costs on 2.7× turnover decide the net line.

25 Jul 202612 minRead ↗
Algorithmic TradingIntermediate

The GameStop Squeeze: When Momentum Models Broke

In January 2021 a dying mall retailer became, briefly, the most traded stock on Earth. We reconstruct the squeeze from GME, XRT and the VIX — the +1,625% month, the ETF dragged along with it, and the mark-to-market path of a short entered on 4 January that was wiped out inside four weeks.

11 Aug 202610 minRead ↗
Algorithmic TradingAdvanced

Alpha Decay: Measuring Momentum's Shrinking Half-Life

How long does a momentum signal keep working? Using 20 years of daily data on the 11 SPDR sector ETFs, this note measures the information coefficient across horizons from 1 to 126 days, fits an exponential decay to find the half-life, and splits the sample into two decades to test for alpha erosion.

11 Aug 20269 minRead ↗