Ike Lim← All projects

Case Study

XAUUSD Backtester

Testing a liquidity-sweep trading strategy against 20 years of gold data.

Feb 2026

PythonJupyterkagglehub

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.

Notebook output showing previous-day high/low levels and simulated sweep-and-reversal entries on XAUUSD data
Notebook output showing previous-day high/low levels and simulated sweep-and-reversal entries on XAUUSD data

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.

Notebook output showing successful simulated trade execution after sweep was detected
Notebook output showing successful simulated trade execution after sweep was detected

Learnings

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