← NeuPortal blog

What Is Backtesting? Testing a Strategy on the Past

By ·

What Is Backtesting? Testing a Strategy on the Past

Before anyone risks real money on a trading strategy or a forecasting model, they usually ask the same question: would this have worked in the past? Backtesting is how you answer it. You take a set of rules — buy here, sell there, forecast this — and you run it against historical data to see how it would have performed. Done honestly, it is one of the most useful tools in quantitative finance. Done carelessly, it is one of the most dangerous, because a backtest is remarkably easy to make look brilliant while being worthless.

What a Backtest Actually Does

A backtest replays history. You feed your strategy the price data, the odds, or the signals that existed day by day, let it make the decisions it would have made, and tally the result. The output is a performance record for a past that already happened: how much it would have made or lost, how often it was right, how deep its worst drawdown ran.

The appeal is obvious. Testing on the past is fast, free, and risk-free compared with testing on live money. A good backtest can kill a bad idea before it costs anything, and it can tell you whether an edge is even plausible. The problem is not the idea of backtesting — it is how quietly a backtest can lie.

Why a Great Backtest Is So Easy to Fake

The trouble is that you already know how history turned out, and that knowledge leaks into the test in a hundred subtle ways. This is often called look-ahead bias: the strategy is quietly allowed to use information it could not have had at the time. A rule that "buys when the price is near its low for the month" is trivial to state in hindsight and impossible to act on in real time, because you do not know the monthly low until the month is over.

Then there is the temptation to tune. You try one set of parameters, the returns are mediocre, so you adjust. You try another, and another, keeping whatever the history rewards. After enough attempts you will find a version that produced a spectacular curve — not because it captured a real pattern, but because with enough tries something always fits the noise. And because failed experiments rarely get written down, the winning backtest arrives looking like a first-try triumph. A backtest with a gorgeous equity curve and no honest account of how many variants were discarded tells you almost nothing.

The Overfitting Trap

The deepest version of this problem has a name: overfitting. An overfitted strategy has essentially memorized the specific historical data it was built on rather than learning a durable pattern that will repeat. It nails the past precisely because it was shaped to the past, and it falls apart the moment it meets data it has never seen.

This is why "a great backtest can still lose in the real world" — the backtest measured how well the rules fit yesterday, not how well they will predict tomorrow. We wrote about this failure mode in more depth at neuportal.ai/blog/overfitting-why-a-great-backtest-can-still-lose. The one-line takeaway: an impressive fit to history is not evidence of an edge. Sometimes it is evidence of the opposite.

What an Honest Backtest Looks Like

A trustworthy backtest is built to resist fooling you. A few principles do most of the work.

Hold out data. Build and tune the strategy on one slice of history, then test it — once — on a later slice it never saw during development. Out-of-sample performance is the only number that means much.

Walk it forward. Instead of one fixed split, retrain on a rolling window and test on the period immediately after, stepping through time the way you actually would have lived it. This mimics real deployment far better than a single in-sample fit.

Model the frictions. Include trading costs, the bid-ask spread, and slippage. A strategy that only wins before costs does not win.

Count your attempts. Be honest about how many variants you tried, because the more you tested, the more likely your best result is luck. A single out-of-sample test after a hundred tuning runs is not really out-of-sample anymore.

None of these guarantee an edge. They just make it harder for the backtest to flatter you.

Why We Do Not Trust Backtests Alone

Even a careful backtest shares one unavoidable weakness with a careless one: it is graded on data that already exists. The tester always knows, at some level, how the story ends. The only way to fully escape that is to make the prediction first and let reality grade it afterward — a forward test.

That is the whole design of our public experiment. Rather than showing you a backtest and asking you to trust it, we lock each forecast before the event, Bitcoin-timestamp it so the timing cannot be edited, and score it against the market once the outcome is known — wins and losses in the open. It is slower and less flattering than a tuned backtest, and that is exactly the point: nothing about a locked, timestamped forward record can be quietly fitted to a past you already know. You can follow the full graded track at neuportal.ai/experiment.

Educational content — not financial advice, and not a betting tip.