Advertisement IC Markets

Look-Ahead Bias: When a Test Quietly Peeks at the Future

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Fairman
Posts: 3303
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Look-Ahead Bias: When a Test Quietly Peeks at the Future

Post by Fairman »

Look-Ahead Bias: When a Test Quietly Peeks at the Future

Look-ahead bias occurs when a test uses information that would not have been available at the time of the trade. It is one of the most common reasons backtests look better than reality.

A simple example is using the daily high or low in a rule for an intraday entry. At 10 a.m., you do not know the day's final high, but a test using full-day data does, and the strategy appears to buy near the low consistently.

Another example concerns indicators that repaint. Some custom indicators redraw past signals as new data arrives, so the chart looks perfect in hindsight, though the signal appeared late or differently in real time. Zigzag-type indicators are notorious for it.

Bar timing also causes problems. If a rule triggers at the close of a candle but the test assumes you got the entry at the candle's open, it assumes you acted before the signal existed.

Manual backtesting suffers too, as you know what happens next. Covering the right side of the chart and moving bar by bar helps.

To check, replay the data in real time or on a demo for a few weeks, and compare signals against the historical chart. If they differ, something peeked.

Practical step: test any custom indicator you rely on by saving a screenshot of its signals live, then comparing them with the chart a day later.
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 3303
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Look-Ahead Bias: When a Test Quietly Peeks at the Future

Post by Fairman »

Another sneaky one is using the close of the higher timeframe candle to filter a lower timeframe entry. If the daily candle isn't finished yet when you take the 15m trade, the test is using information you didn't have.
It’s Fairman :geek:
Fairman
Posts: 3303
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Look-Ahead Bias: When a Test Quietly Peeks at the Future

Post by Fairman »

Screenshotting indicator signals live is underrated. Try it with any custom pivot or swing indicator and compare the next day. You may find some of the arrows you'd been admiring on old charts have quietly moved.
It’s Fairman :geek:
Fairman
Posts: 3303
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Look-Ahead Bias: When a Test Quietly Peeks at the Future

Post by Fairman »

For manual testing, the bar replay feature on most charting platforms is worth learning. It's slower than scrolling, but it's the closest thing to not knowing what comes next.
It’s Fairman :geek:
Post Reply