backte.st

Look-ahead bias and execution timing in backtests

How using information you wouldn’t have had inflates backtests, why fills at the next open matter, and what the delayed-entry check reveals.

Look-ahead bias happens when a backtest uses information that would not have been available at the moment of the decision. It can make a worthless rule look brilliant, and it is surprisingly easy to introduce by accident.

Common ways it sneaks in

How Backte.st avoids it

The engine reads signals only from completed candles and fills orders at the next open. A rule that fires on Monday’s close is executed at Tuesday’s open, which is the earliest price you could realistically get.

This is stricter than some backtesting tools, and results can look worse as a result. That is intended.

The delayed-entry check

Even with honest fills, a strategy can depend heavily on precise timing. The Delayed entry check fills every order one bar later, at the second open after the signal.

Look-ahead bias is about when you knew something. A close cousin is knowing which markets would still exist. Choosing today’s winners to test a strategy on yesterday’s data is survivorship bias.

Checklist

  1. Can every input to the rule be known when the decision is made?
  2. Does the fill happen after the signal, at a price you could get?
  3. Does the result survive a one-bar delay?

Run any strategy in the lab and compare the delayed-entry return to the base result.

Try it in the lab

Build a strategy from indicators, no code needed, run it on a few markets and see this check on your own rules. It’s free and runs in your browser.

Open the lab