Case Study
XAUUSD Backtester
Testing a liquidity-sweep trading strategy against 20 years of gold data.
Feb 2026
The problem
I wanted to test - with data rather than conviction - whether a previous-day-high/low liquidity-sweep strategy on gold actually holds up.
The approach
A Python backtesting framework over 20 years (2004–2024) of XAUUSD price data. An ExtractTrades parser computes each day's directional bias and previous-day high/low; a TradeSimulation engine enters on sweep-and-reversal, exits at the sweep point, and tracks full win/loss statistics - run across seven intraday timeframes from 1 minute to 4 hours.

The outcome
Documented results across roughly 25,000 simulated trades, with the strategy's best performance a 71.17% win rate on the 15-minute timeframe (4,547 trades). Results deliberately exclude spread, commission and slippage - stated as limitations rather than hidden.
Backtest win rate - 15-minute timeframe
Best-performing of the 7 intraday timeframes tested.
- trades on the 15m timeframe
- 4,547trades on the 15m timeframe
- simulated trades across all timeframes
- ~25,000simulated trades across all timeframes
- intraday timeframes tested
- 7intraday timeframes tested
- of XAUUSD data
- 20 yearsof XAUUSD data
Results exclude spread, commission and slippage.

Learnings
Backtests lie easily. Being explicit about execution assumptions and costs matters more than the headline win rate.