Every technique covered in this series so far, support and resistance, trend identification, moving averages and RSI, chart patterns, has been presented with a real example showing it working. That is honest as far as it goes, but it is also exactly the kind of evidence that should make a careful trader suspicious, because hand-picked examples of a technique working prove very little on their own. Backtesting is the discipline of testing an idea systematically across real historical data, including the periods where it does not work, to find out whether it has a genuine statistical edge or simply looked good in the one example you happened to choose.

What a backtest actually is

A backtest takes a precisely defined, mechanical set of rules, an exact entry condition, an exact exit condition, and applies those rules systematically to historical price data, then measures the results as if the rules had genuinely been followed in real time. The key word is mechanical: a backtest cannot test a vague idea like “buy when the chart looks bullish,” because that judgment cannot be applied identically and unambiguously to every single day of historical data. It can test a precise rule like “buy when the 10-day moving average crosses above the 20-day moving average, and sell when it crosses back below,” because that rule produces an unambiguous, repeatable decision on every single day of available data.

A real backtest, calculated from real AAPL data

Here is a genuine, fully calculated backtest, not a description of a hypothetical one. The rule is a classic moving average crossover: hold a long position whenever the 10-day simple moving average is above the 20-day simple moving average, and hold no position otherwise, applied to the real daily AAPL closing prices used throughout this series, from July 22 to September 30, 2025. Trades are entered and exited on the day following each crossover signal, a standard backtesting convention that avoids the unrealistic assumption of trading at a price you could not have known yet.

Calculated from real AAPL daily closes, Jul 22 – Sep 30, 2025. Strategy: long when SMA(10) > SMA(20), flat otherwise, trades executed one day after each signal.

The results are genuinely instructive, and not entirely flattering to the strategy. A starting value of $100 invested using this exact crossover rule grew to $110.28 by the end of the period. Simply buying AAPL on July 22 and holding it, with no trading at all, grew the same $100 to $118.76. The mechanical crossover strategy underperformed a simple buy-and-hold approach over this specific real window, by a meaningful margin, even though both ended the period profitable. This is a real, calculated result, not a cherry-picked failure invented to make a point, and it illustrates something important: moving average crossover strategies are inherently laggy, since they only signal a change after the shorter average has already crossed the longer one, which means they systematically miss the early portion of strong, sustained moves like the powerful early-August rally and the September breakout this series has referenced throughout. A strategy built specifically to exploit choppy, range-bound conditions, or one using faster-reacting inputs, might have performed quite differently across this same window.

Why one short backtest is not enough

This single, roughly two-month backtest should not be read as proof that moving average crossovers are bad, any more than the earlier articles in this series should be read as proof that support and resistance, RSI, or chart patterns are infallible. A sample size of one asset over one short period, containing exactly one strong, sustained uptrend, is nowhere near enough data to draw a reliable conclusion about a strategy’s genuine statistical edge. A trustworthy backtest typically needs a meaningfully longer history, ideally spanning multiple different market conditions, trending, range-bound, and volatile, and ideally tested across more than a single asset, before its results say much about how the strategy is likely to behave going forward.

Overfitting: the trap that makes backtests lie

Overfitting occurs when a strategy’s exact rules are tuned, often unconsciously, specifically to maximize performance on the historical data being tested, producing spectacular backtested results that have no real predictive power going forward because the rules were essentially reverse-engineered to fit noise specific to that one historical sample. A reliable warning sign is a strategy with an unusually large number of adjustable parameters, multiple specific moving average lengths, multiple specific RSI thresholds, multiple specific pattern definitions, all tuned simultaneously until the backtest looks excellent. The standard defense is to test a strategy on one stretch of historical data, called the in-sample period, finalize the rules there, and then test those exact same unchanged rules on a separate, later stretch of data the rules were never tuned against, called out-of-sample data, before trusting the result.

Realistic costs a backtest needs to include

A backtest that ignores trading costs is measuring a strategy that does not exist in the real world. Commissions, even where a broker advertises commission-free trading, are typically offset elsewhere through the bid-ask spread, the small gap between the price you can buy at and the price you can sell at, which quietly erodes returns on every single trade, especially for strategies that trade frequently. Slippage, the difference between the price a backtest assumes you traded at and the price you could realistically have gotten in real, live conditions, particularly during fast-moving or low-liquidity moments, also needs to be accounted for, usually by deliberately assuming a slightly worse fill than the theoretical best price on every trade.

From backtest to live trading

A strategy that survives a long, multi-condition, out-of-sample backtest with realistic costs included has earned the right to a small amount of real capital, not a full-sized allocation immediately. The standard, careful progression moves from backtesting to a period of paper trading the exact same rules in real time, then to live trading with a small position size, increasing exposure gradually only as real-time results continue to track reasonably close to what the backtest predicted. A strategy that performs dramatically worse in real-time paper trading than its backtest suggested is a strong signal that something, often overfitting or unrealistic cost assumptions, was wrong with the original test.

Practical guidelines

  • Define every rule in a strategy mechanically and unambiguously before backtesting; if you cannot apply the rule identically to every historical day without judgment calls, it cannot be properly backtested.
  • Test across multiple market conditions and, where possible, multiple assets, not a single short window containing only one type of price behavior.
  • Reserve a portion of historical data as out-of-sample, never used while building or tuning the strategy, and treat that portion’s results as far more meaningful than the in-sample results.
  • Build realistic trading costs, including the bid-ask spread and reasonable slippage assumptions, into every backtest rather than assuming perfect, frictionless fills.
  • Move from backtest to paper trading to small live size gradually, and treat a significant gap between backtested and real-time performance as a serious warning sign worth investigating before increasing size.

Walk-forward testing: a more rigorous alternative

A more rigorous variation on the simple in-sample and out-of-sample split described above is walk-forward testing, which better simulates how a strategy would actually have been used in real time. Rather than tuning a strategy once on an early block of data and testing it once on a later block, walk-forward testing repeats the process in a rolling sequence: tune the strategy on an initial window, test it on the next short period immediately afterward, then roll the entire window forward in time, re-tuning on a new block that now includes that just-tested period, and testing again on the next period after that, repeating this cycle all the way through the available history. This approach produces a much larger, more realistic sample of genuinely out-of-sample results stitched together, and a strategy that performs reasonably consistently across many successive walk-forward windows is considerably more trustworthy than one tested with a single, one-time in-sample and out-of-sample split, particularly for strategies intended to be used for an extended period across changing market conditions.

Survivorship bias and lookahead bias

Two additional, easy-to-miss errors can quietly inflate backtested results even when overfitting and trading costs have both been handled carefully. Survivorship bias occurs when a backtest is run only on assets that still exist and are still actively traded today, silently excluding companies that went bankrupt, were delisted, or cryptocurrencies that simply failed and disappeared, which systematically removes many of history’s worst outcomes from the test and makes a strategy look considerably safer than it actually was at the time. Lookahead bias occurs when a backtest accidentally uses information that would not actually have been available on the date being simulated, for example calculating an indicator using a company’s full-year revenue figure on a date before that figure was actually publicly reported, or, in a simpler and more common version, calculating a signal using a day’s closing price and then assuming a trade could have been entered at that same day’s opening price, when in reality the open occurs before the close and the signal would not yet have existed.

The backtest used earlier in this article specifically guards against the simpler version of lookahead bias by entering and exiting trades on the day following each crossover signal rather than the same day the signal technically completed, a standard and important convention that any credible backtest needs to follow consistently.

What a clean backtest still cannot tell you

Even a long, carefully constructed, walk-forward tested backtest with realistic costs included answers a narrower question than it might seem to. It tells you how a specific, mechanical rule set would have performed across the specific historical periods you tested it on. It cannot guarantee that future market conditions will resemble the periods tested closely enough for those same results to repeat, and it says nothing at all about a trader’s actual ability to follow the mechanical rules with real money on the line, which is precisely why the earlier articles in this series on risk management and trading psychology matter just as much as the backtest itself. A strategy with excellent backtested statistics, traded by someone who cannot resist deviating from the rules during a real losing streak, will not produce the backtested results in practice, no matter how rigorous the original testing was.

Treat backtesting as a continuous, ongoing discipline rather than a one-time gate a strategy passes through before going live. Markets evolve, and a strategy that tested well across one multi-year stretch of history can gradually stop working as conditions change, which is exactly why periodically re-testing and re-validating any strategy you trade, including the simple crossover example used in this article, remains good practice for as long as you continue using it.

Key takeaways

  • A backtest applies a precisely defined, mechanical rule systematically across historical data to measure whether an idea has a genuine statistical edge, rather than relying on a single illustrative example.
  • A real, calculated SMA(10)/SMA(20) crossover backtest on AAPL from Jul 22 to Sep 30, 2025, grew $100 to $110.28, underperforming a simple buy-and-hold result of $118.76 over the same real window, illustrating the inherent lag in moving average crossover strategies during strong trends.
  • A single short backtest on one asset is not sufficient evidence; reliable conclusions require testing across multiple market conditions and ideally multiple assets.
  • Overfitting happens when a strategy’s rules are tuned to fit historical noise rather than a genuine, repeatable edge; out-of-sample testing on data never used for tuning is the standard defense.
  • Realistic costs, including spread and slippage, must be included in a backtest, and live trading should be approached gradually, starting small, with any major gap from backtested results treated as a warning sign.

Disclaimer

This article is for aducational purposes only and does not constitute financial or investment advice. The backtest shown here uses a simplified strategy on a single, short, real historical AAPL window and is intended to illustrate backtesting methodology, not to recommend any trading strategy or security. Past performance, simulated or not, does not guarantee future results. Always do your own research and consider consulting a licensed financial advisor before trading or investing.


Leave a Reply

Your email address will not be published. Required fields are marked *