How to backtest a trading strategy honestly
Words on this page
- Backtest
- A replay of trading rules on past prices. Its results are hypothetical: they show how rules behaved in the past, never what they will do next.
- Yardstick
- What you compare a strategy with, such as simply holding an S&P 500 fund over the same days. Without one, any rising market makes a strategy look good.
- Held-back years
- Years of data you never look at while designing the rules, kept aside to test them once at the end. Statisticians call them out-of-sample data.
- Index fund
- A fund that holds the companies of an index (or a representative sample of them), so it moves with the whole market. An example is the S&P 500 (Standard & Poor's index of large American companies).
Seven habits of an honest backtest
Each one closes a door through which luck or hindsight gets in:
- Write the rule down before you test it, and test that rule - not the one you would have liked after seeing the chart.
- Include every cost: trading fees, currency conversion, and taxes where you can. A rule that trades often can look strong before costs and weak after them.
- Compare with a yardstick over exactly the same dates. In a rising market almost every strategy goes up; the question is whether it did better than simply holding a fund.
- Hold back years you never tune on, and test on them once at the end. If the rule only works on the years it was designed on, it learned those years, not the market.
- Count every version you tried. Try enough variations and the best one will look good by luck alone - see overfitting.
- Check for one lucky stretch. Leave out the best few months and see whether the rule was still ahead on the ordinary ones.
- Use prices that include dividends and the companies that existed at the time - see two quiet backtest errors.
What a good result does and doesn't mean
A backtest that passes all seven still says nothing certain about the future. Markets change, and an edge can fade once other people find it. What a careful backtest does tell you is whether a result is more than you would expect from luck - and that is worth knowing before real money is involved.
A result that fails is useful too. Most ideas don't survive honest testing; finding that out on past prices costs nothing.
After the backtest: practise in real time
The months after you stop changing the rules are the only ones the rules could not have been fitted to. Running the rules on practice money in real time collects exactly those months, with real prices and real fees, before you decide anything.
In a BasisPoint bot, every bot can run a paper bot beside it for this: a second bot on practice money with its own strategy.
How BasisPoint does it
Backtesting, an add-on for your own bot, replays your bot, a mix you put together, or rules you describe in your own words on past prices, as far back as the data goes, next to holding an S&P 500 fund, with fees and currency costs included.
Every backtest ends with a plain verdict, Signal or noise: Signal, Unclear, Mostly noise, or behind the S&P 500, with each check in one line. It asks whether the result holds on years it was never tuned on, whether it does better than the same trades shuffled at random, and whether it rests on one lucky stretch. It is never a forecast.
Questions
How many years of data is enough?
More is better, and the number of independent ups and downs matters more than the calendar: a long record of one calm market shows less than a shorter one through a crash and a recovery. The luck test needs enough periods to tell a pattern from chance, and says so when it hasn't got them.
Can I backtest without coding?
Yes. In a BasisPoint bot you describe the rules in plain words or pick them in a form; in the free Playbot you can try textbook rules on a made-up market.
I already have results from somewhere else. Can I check them?
Yes, with the free tool Is my strategy luck?: pick an index and the months, drop your statement or type your account's month-end values, and see whether the results look like signal, unclear or mostly noise. Nothing leaves your browser.
Education only: not investment advice and not a recommendation to buy or sell anything. Facts about BasisPoint checked on November 21, 2026.
