Back to knowledge
Data & research8 min read

Research hygiene

Look-ahead bias and data snooping

The fastest way to improve a backtest is often to accidentally use information that would not have been known at the time.

Common look-ahead paths

Look-ahead can enter through an indicator using the current unfinished bar, a normalisation calculated over the full sample, a future-filled missing value, a target accidentally included in a feature, or a split chosen after reviewing all results.

The code may run without an error while producing an impossible advantage.

Control the research degrees of freedom

Trying many symbols, periods, filters, exits, and date ranges creates many opportunities to find a lucky result. Record every meaningful experiment and compare the selected result with a baseline that was not tuned in the same way.

  • Fit transformations on training data only.
  • Make decisions using data available at the simulated timestamp.
  • Keep a final holdout untouched until the research is frozen.
  • Report the number of variations explored.

Build tests for time direction

A useful check is to shift a feature or target forward and confirm the result changes as expected. Shuffle labels, remove the strongest period, and compare against a deliberately simple baseline.

If the strategy collapses when future information is removed, the research result was not an edge.

If a value would not have been known when the order was sent, it cannot influence that historical decision.

Discuss this article

Ask a setup question, share a backtest, or compare notes with other algorithmic traders. Use a display name; your email remains private.

Create an account or sign in above to join the conversation.

Loading discussion…