arbitrading

Learn

Backtesting a pairs trading strategy without fooling yourself

A backtest answers one question: what would these rules have done on past data? It is easy to build one that answers a different, flattering question by accident. These are the traps that matter most for pairs trading.

1. Look-ahead bias

If the hedge ratio, mean or standard deviation are estimated on the full sample and then applied to every date in it, the backtest knows the future. Use a walk-forward design: at each date, estimate everything from a trailing window that ends on that date, and decide using only that information.

2. Same-bar fills

A rule that sees today's close and also trades at today's close assumes you can act at a price that was only known after the fact. A more realistic assumption is to fill on the next bar. Arbitrading's backtests use next-bar fills.

3. Costs

A pair trade has four transactions: open and close, on two legs. Even 5 basis points per transaction adds up to 20 basis points per round trip, which can be most of the expected gain on a short-lived trade. Add borrow fees for the short leg and slippage in thinner markets. Always include costs; never treat them as an afterthought.

4. Overfitting

Try enough combinations of entry level, exit level, stop and window, and one of them will look excellent on the past. That does not mean it will work in the future. Prefer rules that work reasonably across a range of nearby settings over a single sharp peak, and be suspicious of very high Sharpe ratios on few trades.

5. Pair selection bias

Choosing pairs because they were cointegrated over the whole test period, then backtesting them over that same period, guarantees good results. Selection must also be done walk-forward: only with data available at the time.

6. Too few trades

Ten trades with a 90% win rate is an anecdote, not evidence. Look at the number of trades, the worst drawdown and the longest losing streak, not only the total return.

Using the backtester

Every pair in Arbitrading's pair list can be backtested with your own entry, exit and stop levels, trading costs and look-back window. The results describe the past and are not a forecast or a recommendation.

Try Pro free for 14 days

More guides