AlphaStocks

By Maksym Lytvynov, Founder of AlphaStocks | Published: 2026-11-18

We Found Look-Ahead Bias in Our Own Backtest. Here Is What Was Left.

Look-ahead bias is when a backtest uses information that was not available on the date it pretends to trade. A strategy “knows” a number before the world did, so its past returns look better than anything you could have actually earned. It is the most common way a backtest lies, and it rarely looks like a bug.

I build AlphaStocks, a site that scores about 1,500 US stocks from 0 to 10 using five classic investing models: Piotroski, Graham, Buffett, Lynch and Greenblatt. For a while the site advertised a backtest with a large alpha figure. When I rebuilt that backtest properly, I found three separate look-ahead leaks. Fixing them left a result that cannot be told apart from luck.

This is what went wrong, how each leak was found, and a checklist you can run on your own backtest.

What Is Look-Ahead Bias?

A backtest replays history: on each date it looks at the data, makes a decision, and records what happened next. Look-ahead bias creeps in whenever the “data on that date” quietly includes something from later.

The textbook example is earnings. A company's quarter ending December 31 is not public on December 31. The 10-Q or 10-K arrives weeks later. If your backtest buys on January 1 using those December numbers, it is trading on a report nobody had yet.

Real cases are subtler, because the leak hides inside a database column, a helper function, or the list of stocks you start from. All three of ours were like that.

Leak 1: The Scores Were Rebuilt With Today's Data

What happened. Our historical scores were not recorded at the time. They were backfilled in one go, in 2026, by running the current model over historical financials. Every snapshot row had a creation date in 2026. That backfill had two problems:

  • It ignored the filing lag.A company's financial statements reach the SEC on average about 103 days after the quarter ends. The backfill used each quarter's numbers from the day the quarter ended, roughly three months before anyone could see them.
  • It used restated figures. When a company later corrects its numbers, the database keeps the corrected version. A 2021 score built from 2026 data sees the correction, the 2021 investor did not.

How it was found. Not by the returns, which looked fine. By the timestamps. Every stored score was created on the same day in 2026, so none of them could be a record of what the model said at the time.

The fix.I stopped reading stored scores at all. For every rebalance date D, the backtest recomputes each company's score only from filings whose filed_at date is on or before D. If a 10-K was filed on D + 1, it does not exist yet. This rebuild is the point-in-time backtest on our backtest page; leaks 2 and 3 below are the two biases that page lists, found while doing it.

Leak 2: Today's Stock Price Was Inside a 2021 Score

This one I did not expect, and it survived the first fix.

What happened.Three of the five models compare a company's price to a valuation: price against Graham's fair value, price-to-book, a margin-of-safety discount. The as-of scoring functions fetched “the latest quote” for that comparison. In production that is correct. In a backtest it meant a score for June 2021 was partly computed from the stock's price in 2026.

How it was found. By measuring it. I recomputed historical scores with the price pinned to the rebalance date and compared:

Rebalance dateScores that changedLargest moveTop-10 names changed
2021-06-3045 of 4461.89 points2
2023-06-3053 of 4831.32 points2
2025-06-3021 of 4971.01 points0

The effect shrinks as the date approaches the present. That is the fingerprint of this kind of leak: “today's price” converges on “the price then”.

The fix. Every price used in a score now comes from a function that returns the close on or before D. Two tests guard it: one checks behaviour (a price after D never changes a score at D) and one checks structure (the scoring code cannot call the live-quote path).

Leak 3: We Started From Today's List of S&P 500 Companies

What happened.The backtest picked stocks from the current S&P 500 members. A company that is in the index today was, by definition, successful enough to stay or get there. Choosing from that list on a 2021 date quietly favours the winners.

The fix. Membership is now as-of too. On each date the backtest uses the companies whose index entry date is on or before D.

Why the Wrong Number Looked Believable

This part matters more than any single leak.

The price leak and the index-membership leak pushed the result in opposite directions. Fixing only the price leak made the backtest look better. Fixing only the membership leak made it look worse. With both leaks in place, they partly cancelled, and the published full-period figure landed in a range that seemed reasonable.

A backtest that looks too good invites scrutiny. A backtest that looks plausible does not. If you fix one bias and your result improves, that is a reason to look harder, not to celebrate.

The Honest Numbers

The backtest after all three fixes: the top 10 S&P 500 stocks by score, equally weighted, rebalanced monthly, January 2021 to February 2026. Hypothetical, no trading costs.

MeasureTop-10*S&P 500 (SPY)
Total return, full period+136.3%+100.3%
Annual alpha, full period+3.9% (t = 0.71)—
Annual alpha, in-sample (2021–2023)+4.8%—
Annual alpha, out-of-sample (2024–Feb 2026)+2.4% (t = 0.36, 95% CI ≈ ±13 pp)—
CAPM alpha, out-of-sample+0.4% at beta 1.11—
Max drawdown, full period24.8%23.9%
Sharpe ratio, full period0.810.73
Sharpe ratio, out-of-sample1.281.65

* Hypothetical backtested results. No commissions, spreads, taxes or slippage.

  • The headline return is not evidence. +136.3% against +100.3% sounds like a win, but the t-statistic on the full-period alpha is 0.71. A rule of thumb is that you want about 2 before you take an edge seriously. The out-of-sample confidence interval is roughly ±13 percentage points around +2.4%, so it comfortably includes zero and includes losing.
  • Most of the excess return is market exposure. The basket had a beta of 1.11. Adjust for that and the out-of-sample alpha drops to +0.4%.
  • The edge got smaller, not larger, on unseen data. In-sample alpha was +4.8%. Out-of-sample it was +2.4%. That is the normal direction for a strategy that partly fits noise.
  • It did not protect on the downside. The maximum drawdown was slightly worse than the index, and the out-of-sample Sharpe ratio was lower.
  • The sign depends on the basket size. Out-of-sample alpha for the top 10 was +2.6%, for the top 20 −5.2%, for the top 30 −3.7%. A real edge should not flip sign when you hold ten more stocks.

The Walk-Forward Test the Model Failed

The weights the site used were chosen while looking at a period that overlaps the out-of-sample window. So the out-of-sample row above is not truly out-of-sample for those weights.

To test the weighting honestly, I ran a proper walk-forward: pick the best of 26 weight combinations using only the in-sample years, then judge that pick on the later years. The chosen combination earned −0.3% annual alpha out-of-sample. Across all 26 combinations, the out-of-sample median was −0.6%, with a range from −6.5% to +2.7%. The weights the site shipped sat near the top of that range. That is what luck looks like.

What Is Still Wrong With It

Fixing look-ahead bias does not make a backtest correct. Known remaining problems, all of which flatter the result:

  • Survivorship bias. The database records when companies joined the index but not when they left. Companies that dropped out, often after doing badly, are missing, so their losses are missing too.
  • No trading costs. Rebalancing a 10-stock portfolio monthly means a lot of turnover. Realistic costs plausibly eat more than the remaining edge.
  • A different ranking pool.The backtest ranks stocks within the S&P 500. The live site ranks across about 1,500 US stocks, so the backtested score is not identical to the score you see.
  • Data-poor companies rank slightly high. A company missing one part of the score is scored on the rest, which can lift it.
  • Restatements are not fully ruled out. Each metric is tied to the filing it came from, but I have not verified that no corrected figure from a later filing ever reaches an earlier date.

A Checklist for Catching Look-Ahead Bias

If you only take one thing from this, take this list. Every item is something that bit us or nearly did.

  1. Check when your data was created, not just what it says. If every historical row has the same creation date, it was backfilled, and backfills leak.
  2. Use filing dates, not period-end dates. A quarter’s numbers are usable from the day they were filed. For US companies that is often a month or more after the quarter ends, and for annual reports longer.
  3. Watch for restatements. Store the version of a number that was public on the date, not the latest corrected one.
  4. Grep for “latest”, “current” and “now”. Any helper that returns the latest price, the latest rating or today’s index members is a leak waiting to happen inside a backtest.
  5. Use point-in-time universes. Pick from the stocks that were in the index on that date, including the ones that later left.
  6. Write a guard test. For a date D, change only data from after D and assert the backtest’s decisions at D do not move.
  7. Measure the leak, do not argue about it. Recompute with and without the suspect input and count how many decisions change.
  8. Distrust improvements. When a fix makes results better, there is probably a second bias pointing the other way.
  9. Report t-statistics and intervals, not just total return. A total return with no uncertainty attached tells you almost nothing.
  10. Do a real walk-forward. Choose every parameter on early data only, then test on later data once.

What This Means If You Use AlphaStocks

The scores are a way to shortlist companies and see why a model likes or dislikes them. The evidence does not say they beat the market, and the site no longer says so either.

One more caveat: this backtest tested an earlier version of the scoring model. The current version rebuilt each of the five models from its original source, and it has not been backtested. Until it is, there is no performance claim for it.

The full numbers and method are on the backtest page, and every scoring rule is documented on the methodology page.

Frequently Asked Questions

What is look-ahead bias in simple terms?

Using information in a backtest before it was actually available. For example, trading on a company's quarterly earnings on the day the quarter ends, when the report was not filed until weeks later.

How is look-ahead bias different from survivorship bias?

Look-ahead bias uses data from the future. Survivorship bias leaves out companies that failed or were removed, so the past looks better than it was. They often appear together: choosing from today's index members is both.

How do I avoid look-ahead bias with fundamental data?

Key every financial figure to the date it was filed, not the period it describes, keep the originally reported values rather than restatements, and pin every price to the close on or before the trading date.

Does fixing look-ahead bias always lower backtest returns?

No. In our case, fixing one leak alone raised the result, because a second leak was pulling the other way. That is why it is worth fixing all of them and measuring each one separately.

Related Guides

This article is for educational purposes only and is not investment advice. Backtested results are hypothetical, exclude trading costs, and do not guarantee future results. AlphaStocks provides algorithm-generated research tools, not personalized recommendations. Data sourced from SEC EDGAR filings and Alpaca Markets.

← Back to Learn