BACKTESTING WORKSHOP
How to avoid look-ahead bias in candle replay
A rule can look obvious after the next few candles appear. A fair replay asks a harder question: could you have made the same decision using only the information available then? This article uses the timing of our recorded 24 September 2025 EUR/USD loss to build a practical information-cutoff exercise. It does not introduce a new profitable setup.
A candle label is not its closing decision time
Our recorded exercise used EUR/USD, five-minute candles and HistData bid data. The qualifying candle was labelled 09:15 UTC on 24 September 2025: open 1.17752, high 1.17763, low 1.17719 and close 1.17758. The label identifies the start of the 09:15–09:20 interval. Its final closing price becomes knowable at the end of that interval, not at 09:15.
ReplayPip reveals a whole candle and uses its close for a simulated market entry. Record this as “signal candle 09:15; close-based decision 09:20; model entry 1.17758.” Claiming you bought at 09:15 because that candle closed bullish would use five minutes of future information. Even a close-based simulation excludes the delay and execution conditions of a live order.
| Observation | Candle label | Close knowable | Model price |
|---|---|---|---|
| Entry signal | 09:15 | 09:20 | 1.17758 |
| Timed exit | 10:15 | 10:20 | 1.17724 |
Write the rule before exposing the outcome
For an exercise, specify the instrument, interval, start date, qualifying condition, order size, stop, target and time exit before advancing. A condition such as “a strong candle near support” needs operational definitions: which level was already marked, what counts as strong and what makes the condition invalid? Otherwise future candles can silently change your interpretation.
Save a before screenshot and a timestamped note. If you recognise the date or remember a previous run, mark the session as familiar. It can still test whether you follow instructions, but it is weaker evidence of an unseen decision. A second replay of the same chart does not turn the remembered outcome into an independent observation.
Audit indicators and larger-timeframe context
A moving average for the current decision may use only closes available by that cutoff. The final close of an unfinished hourly candle is not available during its first five minutes. Similarly, a swing high that requires later candles for confirmation must be dated when it becomes confirmed, not backdated to the earlier peak.
Changing chart styles cannot fix information leakage: hollow candles and OHLC bars display the same underlying observations. In a multi-timeframe worksheet, record the latest completed higher-timeframe interval used for each decision. ReplayPip’s saved state preserves a practice session, but it is not an automatic audit certificate for every external chart, indicator or news page you consult.
Does your indicator have enough history? A worked SMA 20 example
Keep the recorded loss as recorded
The companion case study entered long at 1.17758, kept SL 1.17658 and TP 1.17958, and exited manually at 1.17724 after twelve subsequent five-minute candles. At 0.10 lots the gross result is (1.17724 − 1.17758) × 10,000 = −3.40 USD, or −0.34R against the original 10 USD price risk.
The exit candle is labelled 10:15; its close is associated with the end of that interval, 10:20 UTC. Knowing that exit now does not justify rejecting the original entry or adding a filter to the old record. A new filter is a new hypothesis and must be evaluated separately on dates not used to invent it.
Use a decision log that captures what was knowable
For every candidate, log the signal interval, earliest decision time, known levels, rule version, decision and skip reason. Add the result only after replay advances. Keep valid skips and losing signals in the sample; deleting them after seeing the outcome defeats the information cutoff even if the chart itself hid future candles correctly.
If you accidentally look ahead, label that observation contaminated and keep it in the audit trail. Replace it only according to a prewritten sampling rule, not with a more attractive day. The aim is to stop an accidental peek becoming an invisible selection decision. The downloadable checklist provides fields rather than fabricated trading results.
Separate practice from evidence of an edge
An honest no-peeking session can reveal inconsistent execution, unclear rules and poor record-keeping. It cannot establish profitability from one trade. Review multiple preselected periods, include costs in a separate documented model, and reserve genuinely unseen dates for later evaluation. The number of observations needed depends on variability and dependence; there is no universal trade count that proves an edge.
Treat this workshop as a process audit: can another person identify what was available at each decision and reproduce the entry rule? If that answer is unclear, fix the timestamp or definition before interpreting the profit column. Better timing records make the test interpretable even when the recorded result remains a loss.
How to test a trading strategy change without moving the goalposts