Lookahead Bias
Lookahead bias is a backtest using information that did not exist at the moment the strategy acted. The classic case is a daily rule that reads today's closing price to decide, then buys at that same close or at today's open. The close is only known after the session ends, so a live account could never have used it. The backtest did, and it shows a profit the live account cannot repeat.
The flaw is hard to spot because the results look like skill. A strategy with a leak can show a smooth equity curve, a high win rate and a small drawdown. The only symptom is that live trading does not match it. Every number on DeployQuant's learn pages comes from an engine that fills orders on minute bars after a decision, which keeps the signal and the fill in the right order. The data below shows how large the leak can be for the funds in this universe, what the honest results of twelve simple rules look like, and how to tell a leaked result from a real one.
The window is 2021-01-04 to 2026-10-02, 1,444 sessions, with $10,000 of starting cash and no fees in the headline run. The related terms are backtesting and survivorship bias. The question do I need minute data to backtest, or is daily data enough covers the data side of the same problem.
The forms lookahead takes
Most leaks fall into a few groups.
- Same-bar signal and fill. The rule uses a bar's close and fills at that bar's open or close. The signal needs the close, and the fill happens before or at the instant the close is known.
- Indicators that include the current bar. A moving average, RSI or breakout level computed with today's value is fine if the order goes out after the close. It is a leak if the order is placed earlier in the same session.
- Revised or restated data. Some data series are corrected after the fact. A backtest that reads the corrected value uses something the trader did not have on the day.
- Adjusted prices read as prices seen at the time. Trade lists on this site are adjusted for splits and dividends, so they are lower than the quotes printed at the time. Rules use adjusted history consistently, and the adjustment is applied to the whole series so that returns are comparable. A rule that compared an adjusted price with a raw level it remembered would mix two scales.
- Future-looking universe choices. Picking a fund because of how it did over the window is a leak in the selection step. It is closely related to survivorship bias.
- Parameter choice on the same data. Choosing the best setting from a grid on the full window and then reporting that window leaks the answer into the rule. The parameter tables on strategy pages show a spread of results for exactly this reason.
The first form is the most common in daily strategies, and the data below measures it.
How big the same-bar leak is on real funds
The size of the leak depends on how much a fund moves between the moment the signal is known and the first price a trader could get. For a daily rule that is the overnight gap plus the opening move. The market examples show how much the funds differ.
SPY averaged an overnight gap of 0.44% and an intraday range of 1.15%. QQQ averaged 0.59% and 1.58%. TQQQ averaged an overnight gap of 1.78% and an intraday range of 4.74%. UVXY averaged 2.53% and 7.03%. A rule that fills at the close that produced the signal gets the price before that gap. A rule that fills at the next open gets the price after it. On TQQQ the gap alone is large compared with the edge most simple rules show.
The overnight share of returns shows how much of the gain sits in that gap. SPY's overnight log return was 49.65% against an intraday log return of 29.84%, which makes overnight 62.46% of the total. For QQQ the overnight share was 64.64%, and for TQQQ 74.87%. For IWM the overnight log return was 69.84% while the intraday log return was -27.57%, so the whole gain and more came from the gap.
This matters because a same-bar fill puts the strategy on the wrong side of that gap. If a rule buys at the close after a rise and the next session opens higher, the real fill is at the higher open, and the backtest shows the lower close. If the fund opens lower, the backtest misses a loss. Over many trades the first effect is the one that flatters trend and breakout rules, since they buy after strength. Across a strategy with many round trips, such as the RSI(2) snapback with a median of 166, the error repeats on every entry and exit.
What a leak does to an edge
Consider what the funds do day to day. SPY was up on 54.4% of sessions and QQQ on 54.82%. TQQQ was up on 54.47% and IWM on 51.7%. The next day's direction is close to a coin flip with a small tilt upward. The lag-1 autocorrelation of daily returns was -0.02 for SPY, -0.04 for QQQ, -0.04 for TQQQ and -0.02 for IWM. Yesterday's move tells a trader almost nothing about today's.
A strategy with a leak that touches even a fraction of the next day's move would break that. Knowing the sign of the move on a fraction of days would push the win rate far above 54%. Average up days were 0.74% on SPY and average down days were -0.74%, 1.01% and -1.06% on QQQ, and 3.01% and -3.22% on TQQQ. A trader who knew the sign in advance and held through the up days only would collect the full up-day average and avoid the down-day average. The curve would climb steadily and the drawdowns would nearly vanish.
That is why a leak produces unusually clean results. The honest edges in the data are small. RSI(14) fell below 30 on SPY in only 18 sessions, and the median 5-day return afterwards was 3.74%, against a baseline of 0.42% for all sessions. The median 20-day return was 2.86% against a baseline of 1.73%. Eighteen events are a small sample, and the result is a tendency and not a rule. A leaky version of the same rule, filling at the oversold close with information from the following days, would show something much cleaner.
What honest results from simple rules look like
The twelve strategy templates all use daily decisions, and each runs on 59 funds. Their medians sit in a narrow range. The weekly 7% target had the highest median CAGR at 6.61%. The monthly cycle was 5.46% and the RSI(2) snapback was 4.74%. The RSI mean reversion median was 2.98%, the EMA 12/26 trend was 2.76%, the trend with a trailing stop was 2.61%, the SMA 10/50 trend was 2.12%, the golden cross was 2.05% and the 200-day regime filter was 1.84%. The dip buyer was 1.33%, while the momentum breakout and the 3-month momentum rules both had a median of 0%.
Median maximum drawdowns ran from 17.47% for the RSI(2) snapback to 36.63% for the monthly cycle. The number of funds that beat buy-and-hold, out of 59, ran from 14 for the monthly cycle to 34 for the RSI(2) snapback and the weekly 7% target.
These results include losses and long flat stretches. None of them looks like a perfect curve. A rule that returned several times these medians with a drawdown near zero would be a candidate for a leak check before anything else. The point is a sanity check on the size of the result. When a result looks too good for the fund it ran on, the first step is to audit the timing of the signal and the fill.
The fund also matters. Buy-and-hold on SPY compounded at 14.56% with a 23.99% maximum drawdown. On QQQ it was 16.7% and 34.23%. On TQQQ it was 25.35% and 80.77%. TLT lost 8.23% a year in buy-and-hold with a drawdown of 42.77%. A trend filter that sidestepped TLT's decline would have a real edge in this window. A leak would make the same filter look better than that, and the live account would not see it.
How to check a backtest for lookahead
Several checks catch most leaks. They apply to any engine, including the one behind this site.
- Sort by time. For every trade, the signal's timestamp must be earlier than the fill's timestamp. A signal at the 16:00 close with a fill at the same 16:00 print is suspect.
- Delay the signal by one bar. Rerun the strategy with every signal shifted forward by a bar. A real edge shrinks a little. A leak collapses.
- Read the decision log. DeployQuant logs every decision with the prices and indicator values the strategy saw at that moment. Comparing those values with the data at that timestamp shows whether the rule saw a number that was not yet available.
- Watch the biggest winners. Open the best trades and ask what the strategy knew when it entered. A leak concentrates in trades that catch a turning point with no visible reason.
- Compare with the live or paper fill. Paper trading uses the live market data feed. A strategy that works in backtest and fails at once in paper trading is worth checking for a timing problem.
- Compare engines. The same strategy run through a second engine on the same data should produce the same fills. A conversion between blocks and Python on DeployQuant is backtested both ways and the fills are compared before it is saved, which catches a conversion that changes the trades.
Why the engine matters more than manual care
Manual care helps, but it depends on every author remembering every ordering rule on every line of code. The definition of the term points out that engine-level safeguards beat it. An engine that gives the strategy one bar at a time and fills orders on later bars closes off the most common leak by design.
DeployQuant backtests on minute-resolution consolidated US equity data, and a daily rule decides on one bar and fills on minute bars after it. Strategies can also run on 1-second bars in Python. The same engine runs backtests and live trading, so the code path that produced the backtest fills is the one that sends live orders. The engine, DQengine, is source-available, so the order of operations can be read. The product reference states that it is the same code the hosted platform runs.
An engine's protection stops somewhere. It controls the order of events inside the engine. It does not control what the author does with data brought in from outside: a file of signals built elsewhere, a fundamental value stamped with the wrong date, or a parameter chosen after looking at the whole window. Those are still the author's to check.
What the data here does and does not show
The numbers above are measured on one window of 5.74 years, on 59 funds and twelve rules, with daily decisions and minute-bar fills. They show the size of overnight gaps, the base rates of up days, the lack of next-day predictability and the honest range of simple-rule results. They do not include a run of a deliberately leaky strategy, so no measured inflation figure is quoted. The effect described for same-bar fills is reasoned from the gap and range data and not read from a leaky backtest.
Fees and slippage are zero in the headline run, with 5 and 10 basis point cost runs on the strategy pages. A rule that looks good before costs and bad after is a separate problem from lookahead, though the two are often found together in the same suspicious result. Backtests are hypothetical and do not predict live results.
Frequently asked questions
What is lookahead bias in a backtest?
It is a backtest using information that was not available when the strategy decided. Examples are using today's close to place a trade at today's open, reading revised data, or filling at a price the strategy could not have known. The result is a profit the live account cannot repeat.
Why does lookahead bias make results look so good?
Day-to-day direction is close to a coin flip in the data here. SPY was up on 54.4% of sessions and its lag-1 autocorrelation was -0.02. A strategy that sees even part of the next move beats that by a wide margin, which gives clean curves and small drawdowns.
How can I tell if my backtest has lookahead bias?
Check that every signal time is earlier than its fill time, shift the signal by one bar and see whether the result collapses, and read the decision log for the values the rule saw. Results far above the 1.84% to 6.61% range of the template medians on this site deserve an audit first.
Does daily data cause lookahead?
It makes the leak easier, because the close that creates the signal and the fill price are often the same number. On TQQQ the average overnight gap was 1.78%, so filling at the signal's close and at the next open differ by a lot. Minute data allows the engine to fill after the decision. The linked question on minute versus daily data goes into the data side.
Is lookahead bias the same as survivorship bias?
They are different errors. Lookahead is about timing inside the backtest. Survivorship bias is about which assets are in the universe, such as testing only funds that still exist. Both overstate results, and both are checked at the design stage.
Can an engine remove lookahead bias completely?
It can close off the same-bar and indicator-ordering leaks by giving the strategy one bar at a time and filling on later bars. It cannot check outside data the author imports or settings chosen after looking at the whole window. Those stay with the author.
Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
Related terms
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.