← All posts

October 28, 2026 · Michael Shane

How to Avoid Look-Ahead Bias: 7 Bugs to Check in Your Backtest

Look-ahead bias lets a backtest use data it couldn't have had yet. Here are seven common bugs that cause it, how to spot each one, and a quick test you can run today.

Look-ahead bias is when a backtest uses information it couldn't have had at the time of the trade. It's the most common reason a strategy looks amazing on paper and then does nothing in real trading.

We wrote about the idea behind it in Point-in-Time Truth. This post is the hands-on version: the actual bugs that cause it, and how to find them in your own test.

How big can one bug be?

We ran a quick simulation to show it. We made 100 random price series, 365 days each, with no real pattern in them at all. Then we tested one simple rule on each: be long when the close is above its 20-day average, with fees.

  • Buggy version: the rule used today's close to decide, but got credited with today's move. 100 of 100 net positive (simulated).
  • Fixed version: same rule, but the trade only earns from the next day on. 45 of 100 net positive (simulated).

Same rule. Same data. Same fees. One line of timing was wrong, and pure noise turned into a "perfect" strategy. That's how quiet this bug is.

Bug 1: Acting on a bar before it closes

This is the one in our simulation. Your signal uses the close of a candle, but the trade enters at the open of that same candle, or earns that candle's move.

How to check: for every trade, write down the time the signal was known and the time the trade entered. The entry must come after the signal. If your signal uses the close, the earliest entry is the next bar.

Bug 2: Indicators that peek forward

Some indicator code uses future bars by accident. A "centered" moving average, a smoothing filter, or a pivot point that needs bars on both sides can all look ahead.

How to check: cut your data at some date and compute the indicator. Then compute it again on the full data. The values up to the cut date should be the same. If they change when you add future data, the indicator is peeking.

Bug 3: Using the high or low to fill an order

A backtest says your limit buy filled at the low of the day. But you only know the low after the day ends. Same with "exit at the high." Real orders fill at a price you could have gotten when the order was live.

How to check: look at how fills are priced. Fills at the exact high or low, again and again, are a red flag. Also check what happens when a candle hits both your stop and your target. If the test always assumes the good one came first, it's guessing in your favor.

Bug 4: Data that was fixed later

Some data gets revised after it's first published. Funding rates, volume, on-chain stats, and economic numbers can all change. If you test on the cleaned-up version, your strategy is reacting to numbers nobody had in real time.

How to check: ask where each data field came from and when it was available. Data stored with the time it was actually known is safer than a tidy download made months later.

Bug 5: Picking coins with today's list

You test on "the top 20 coins." But which top 20? If it's today's list, you've picked coins that survived and grew. Coins that crashed or got delisted are missing. That's survivorship bias riding along with look-ahead bias.

How to check: use the list of markets that existed at each point in time, including the ones that later died.

Bug 6: Normalizing with the whole data set

A common machine learning mistake: you scale or normalize your data using the mean and spread of the full history. Now every early data point "knows" something about the future.

How to check: any scaling, ranking, or threshold should be computed only from data before each decision. A rolling window is fine. A full-history number is not.

Bug 7: Tuning on the results you're grading

You try 30 settings, look at the backtest, and keep the best. The backtest you report now includes your own hindsight. This isn't a data bug, but it has the same effect: the result knows the answer.

How to check: write down every version you tried. Then judge the winner on data it has never seen, like forward Paper trading. More on why counting every try matters in The Deflated Sharpe Ratio.

A quick test you can run today

Here's the fastest sanity check we know. Shift every signal one bar later and re-run the backtest.

If the result drops a little, that's normal. If it collapses, especially if a great strategy turns into nothing, your original result was probably leaning on look-ahead. A real pattern rarely depends on acting one bar earlier than possible.

A second check: if a simple rule wins on almost every market and every period, be suspicious, not excited. Real results are messy. 100 of 100 is a warning sign.

Why AI-built strategies need this extra

AI tools like ChatGPT, Claude, Grok, or Cursor can write backtest code in seconds. That's useful. But they make timing mistakes like these just as easily as people do, and the code still runs without errors. Ask the AI to explain, for one trade, exactly when each value it used was known. If it can't, check the code yourself.

For more on the testing side, see How to Backtest Without Fooling Yourself and the AI trading bot backtest checklist.

How Pickled Lizard handles it

At Pickled Lizard, a strategy starts with a backtest on the full data set we have. Then the real test is forward Paper trading, on new market data as it arrives. Look-ahead bias can't help a strategy there, because the future hasn't happened yet. A strategy is marked Verified only when it reaches 80% of its own backtest's trade rate and 80% of its backtest win rate. Until then, it shows as still collecting.

Live trading is off during the beta. Everything is paper, and every result is labeled simulated. You can read more about the difference between a backtest and forward observation.

Try it

The beta is free. Bring a strategy, or one your AI wrote, and see how it holds up on data it has never seen.

Test it free at pickledlizardz.com/join

Paper trading only. Results are simulated. Not financial advice.