Backtesting Explained: How to Test a Trading Strategy Honestly

Updated November 2026 · 5 min read

Backtesting means running a trading rule on past prices to see how it would have performed. If your rule is "buy when price closes above the 50-day average, sell when it closes below," a backtest goes through history day by day, applies the rule, and records every trade. It is the cheapest way to find out whether an idea has any merit. It is also one of the easiest ways to fool yourself.

How a backtest works

  1. Define the rule exactly. Entry, exit, position size, and what price you trade at. "Buy on strength" is not testable. "Buy at the next day's open after the close crosses above the 50-day SMA" is.
  2. Choose the data. Which assets, which dates, which timeframe.
  3. Step through history. At each bar, use only the information that would have been available then.
  4. Record the results. Every trade, its profit or loss, and summary statistics.
  5. Judge the results against a simple alternative, like buying and holding.

A worked example

Say you test a rule on one stock over a year and get 10 trades:

Trade Result
1 +$420
2 −$150
3 −$180
4 +$90
5 −$160
6 +$610
7 −$140
8 −$170
9 +$300
10 −$120

A 40% win rate sounds bad, but winners averaged more than twice the size of losers, so the rule made money in this test. That is the logic behind the risk/reward ratio. But 10 trades is far too few to trust. A couple of lucky trades decide the whole result. If trade 6 had been a normal loss instead of +$610, the net would have been negative.

Key numbers to look at

The three biases that make backtests lie

Overfitting

Overfitting is tuning a rule until it fits past data perfectly, including random noise. Suppose you test moving-average lengths from 10 to 200 and find that a 37-day average crossed with a 113-day average gave the best result. That combination probably won by luck. Test enough variations and one will always look brilliant.

Signs of overfitting:

How to reduce it: keep rules simple, use common settings, and hold back a chunk of data you never look at while building the rule. Test on that "out-of-sample" data once, at the end. If performance collapses, the rule was fitted to noise.

Look-ahead bias

Look-ahead bias means the test uses information that was not available at the time of the trade. Classic examples:

Look-ahead bias can make a worthless rule look spectacular. The fix is strict: at each step, only use data that existed before the decision. Trading at the next bar's open after a signal on the close is a common, honest convention.

Survivorship bias

Survivorship bias comes from testing only on assets that still exist today. If you backtest on the current members of the S&P 500, you are testing on companies that grew, survived and stayed in the index. The ones that went bankrupt, were acquired cheaply, or shrank out of the index are missing. A strategy that buys dips would look far better on survivors, because in the real past some dips never recovered.

The fix is to use data that includes delisted and removed assets as they existed at the time. In crypto, this is especially important because many coins have faded to near zero.

Other things backtests miss

Common mistakes

How Stupid Simple Trader uses backtesting

Each ticker page shows a 6-month backtest of the signal. It checks the bullish and bearish calls made over the past six months and records whether price had moved in the called direction 10 trading days later. The calculation uses the same fixed rules for every ticker, rather than tuning settings per ticker, which avoids one obvious form of overfitting.

It still has limits worth stating plainly. Six months is a short window covering one kind of market. It measures direction only, not the size of moves or costs. Accuracy varies widely between tickers and can be below 50%. Treat it as a quick read on how well a trend-and-momentum summary has fit that asset recently, not as a forecast. The details are in how Stupid Simple Trader signals work.

Try it

Compare the backtest on a steady large-cap like /t/MSFT with a volatile asset like /t/BTC-USD to see how much signal accuracy can differ between tickers.

Frequently asked questions

Does a good backtest mean a strategy will make money?

No. A backtest shows how a rule would have behaved on past data. Markets change, and many strategies that looked great in testing fail live because of overfitting, hidden biases, or costs that were left out. A good backtest is a reason to keep studying a rule, not proof it works.

How many trades do I need for a meaningful backtest?

There is no magic number, but more is better. A handful of trades can look great or terrible by pure chance. Results based on many trades across rising, falling and sideways markets are much more informative than a few trades in one kind of market.

What is overfitting in trading?

Overfitting means tuning a strategy so closely to past data that it captures random noise instead of a real pattern. The result looks excellent on the data it was built on and disappointing on new data.

What is the difference between backtesting and paper trading?

Backtesting applies a rule to historical data in one go. Paper trading runs the rule forward in real time with pretend money. Paper trading is slower but avoids many backtest biases, because you cannot accidentally use information from the future.