Seven backtesting pitfalls to avoid
A backtest is only as honest as its assumptions. Here are seven common mistakes that make historical results look better than they really are, and how to catch each one.

A backtest answers a narrow question: “If these exact rules had been followed on this historical data, under these assumptions, what would have happened?” It cannot tell you what will happen next. Yet even that narrow question is easy to answer wrongly. Small modeling shortcuts compound, and the result is an equity curve that looks far smoother than anything you could have traded.
Below are seven pitfalls that show up again and again in strategy research, along with practical ways to detect them before they mislead you.
Look-ahead bias happens when a simulated decision uses information that was not available at the moment the decision was made. The classic example is computing a signal from today's closing price and then assuming you traded at that same close. Subtler versions include using financial statements as of the fiscal period end rather than the date they were actually published, or normalizing a feature with the mean and standard deviation of the entire dataset.
The fix is to be explicit about timing. Decide when each signal becomes known and when the resulting order can realistically execute, then shift the signal accordingly.
import pandas as pd
df = pd.read_csv("prices.csv", parse_dates=["date"], index_col="date")
df["ret"] = df["close"].pct_change()
df["signal"] = (df["close"] > df["close"].rolling(50).mean()).astype(int)
# Wrong: today's signal earns today's return (it used today's close)
df["biased"] = df["signal"] * df["ret"]
# Better: the position is taken after the signal is known, so it earns the next return
df["strategy"] = df["signal"].shift(1) * df["ret"]If your universe is built from the companies that exist today, you have quietly removed every firm that was delisted, acquired or went bankrupt during the test period. Those names often had poor returns before they disappeared, so excluding them flatters almost any long-only strategy. Use point-in-time constituent lists and a dataset that retains delisted securities, or at least be aware of the direction of the bias when you cannot.
Commissions, bid-ask spreads, exchange fees, borrowing costs for short positions and market impact all reduce returns. A strategy that trades frequently can look excellent before costs and unremarkable after them. Model costs per trade, measure turnover, and test how results change when you double your cost assumption. If a modest increase erases the edge, the edge was probably not robust.
Every time you tweak a parameter after looking at the results, you use up some of the information in your data. Test enough combinations and one of them will look impressive purely by chance. Warning signs include many tunable parameters, rules with oddly specific thresholds, and performance that collapses when a parameter moves slightly.
Backtests often assume that every order fills completely at the price you wanted. In practice, limit orders may not fill at all, market orders pay the spread, and large orders relative to traded volume move the price. Cap position sizes as a fraction of average volume, treat limit fills conservatively, and be skeptical of results that depend on trading thinly traded instruments.
Unadjusted stock splits create fake crashes. Mixed time zones shift bars by hours. Missing sessions get forward-filled into flat prices that look like low volatility. Before trusting any result, check the data itself: plot it, scan for extreme one-bar returns, and confirm how dividends and corporate actions are handled. Many strategy “discoveries” turn out to be data errors.
A strategy tested over a single market regime may simply be a bet on that regime continuing. Test across different volatility and interest-rate environments where possible, and look beyond total return. Maximum drawdown, the length of drawdowns, the distribution of returns and the number of independent trades all matter. A result built on a handful of trades is an anecdote, not evidence.
A backtest that survives these checks is not a guarantee of anything. It is simply a result you can reason about honestly.
Want to go deeper? See how Quantzivo Studio's backtesting workflow is being designed around these checks, or build the underlying skills in the Factor Models & Quantitative Research course.
Educational content only. This article explains concepts and methods. It is not investment advice or a recommendation to buy or sell any security. Trading involves risk, including loss of capital. Read the risk disclaimer.
Raw price files are rarely ready for analysis. This walkthrough shows how to parse, deduplicate, validate and resample OHLCV data in pandas so your research starts from a trustworthy base.
Read articleWalk-forward testing repeatedly fits a strategy on past data and evaluates it on the period that follows. Learn how it works, how to choose windows, and what it can and cannot tell you.
Read articleNews sentiment models turn headlines and articles into structured scores. This guide explains the main approaches, from word lists to language models, and the limitations every researcher should understand.
Read article