F. HEKİMOĞLU
← cd ~/work/quant
// QUANT · A NEGATIVE RESULT, DONE RIGHT

A study in evaluating a strategy rigorously

A vectorised, from-scratch MA-crossover backtester on US-equity ETFs. The deliverable is not a winning strategy: an honest evaluation that cannot reject zero skill, and says so.

00Overview

A vectorised from-scratch backtester for moving-average-crossover strategies on liquid US-equity ETFs. The point of the project is the evaluation harness, not the rule: property-tested no-lookahead, HAC standard errors on alpha, and walk-forward folds. The strategy itself is a foil to demonstrate doing the statistics honestly.

Validation band

Tests0
Coverage0%
No-lookahead40 × 2
Alpha errorsHAC

01Headline result

SPY · SMA(50, 200) · 2010-2024 · 5 bps per side:

Strategy CAGR0.00%
Buy & hold CAGR0.00%
Jensen α / yr+0.00%p = 0.69
Max DD0.00%= B&H

The rule trails buy-and-hold by over four points of CAGR, and its alpha of +0.84%/yr is statistically indistinguishable from zero (p = 0.69). It does not even reduce risk: its worst drawdown is identical to buy-and-hold at -33.72%.

02Live chart: strategy vs buy & hold

SMA(50,200)BUY & HOLD
cumulative return · honest y-axis
DATE latestSTRATEGY +256.7%BUY & HOLD +503.5%SRC ma-crossover-backtest
drawdown (%)

03Walk-forward: per-fold IS vs OOS Sharpe

Each point is one walk-forward fold: in-sample Sharpe (x) against out-of-sample Sharpe (y). Points scatter around and below the 45° line; in-sample skill does not carry over.

in-sample Sharpe → out-of-sample SharpeDeflated SR (concat OOS) = 0.00
45° = skill persists

04Why this is the right answer

A simple, well-known rule applied to a deeply liquid index, evaluated after realistic costs, should not produce alpha. If it did, the result would more likely indicate a bug or a leak than a market inefficiency. Finding no skill here is evidence the harness is honest.

This matches the literature: Bajgrowicz & Scaillet (2012) show technical-trading-rule profits vanish after data-snooping corrections and costs, and the reassessment of Brock, Lakonishok & LeBaron finds their apparent edge does not survive out of sample. Reporting the null cleanly is the result.

05Stack & links

pythonnumpyhypothesisstatsmodels
SEC 00 · INDEXENDARK--:--:--⌘K / ? help