Skip to content
GetProfitable
Search
Dictionary

Event-driven backtest

A backtest that replays market events in order through the same components that will run live: data handler, strategy, order manager, execution simulator, portfolio.

Because it processes one event at a time and cannot see the future by construction, this design eliminates whole classes of leakage. It also lets you model realistic behaviour: partial fills, rejected orders, margin checks, and position limits that actually bind.

The bigger payoff is code reuse. If the strategy component is identical in backtest and live, with only the data and execution adapters swapped, then a large share of live-vs-backtest-divergence disappears because there is no second implementation to drift.

The cost is speed and complexity. Event-driven runs can be a hundred times slower, which discourages broad parameter sweeps. The common workflow is to screen with a vectorised-backtest and validate finalists event-driven before anything goes near real money.

Related: vectorised-backtest, fill-assumption, live-vs-backtest-divergence, order-reconciliation

See it drawn

Original diagrams for the ideas on this page. Illustrative, not real market data.

Bearish divergence between price and RSIA price line whose second peak is higher than its first, drawn above an RSI panel whose second peak is lower than its first, with the two peaks joined by sloping dashed lines.PRICEhigher highRSI (14)70overbought30oversoldlower high
Divergence between price and RSI. RSI measures how one-sided recent price moves have been on a 0–100 scale. Here price sets a higher peak while RSI sets a lower one, so the second push carried less momentum than the first.

Educational only, not advice. Spotted an error? Post in Site Feedback.