Free guide · updated 2026-09

How to Backtest a Trading Strategy (Without Fooling Yourself)

A backtest is an experiment, and most of them are designed to pass. The method below is built to make your strategy fail early if it is going to, which is the only useful outcome of testing.

Short answer

Write rules a stranger could follow, choose the instrument and period before you look, record every trade in R, subtract realistic spread, commission and slippage, and reserve a slice of history you never touch while developing. Then check the sample size: a few dozen trades cannot separate an edge from luck. A good backtest is a hypothesis, not proof.

9 min read · The Algo Vision
How to Backtest a Trading Strategy
Practise on real charts →All guides & tools

Is my backtest sample big enough?

95% range for the true expectancy

Margin of error = 1.96 × standard deviation ÷ √n. If the range crosses zero, the sample cannot tell a real edge from luck. Standard deviation of around 1–1.5R is typical for a fixed-risk strategy; use your own if you have it.

About this calculator. The result is an educational estimate. Contract sizes, pip values, spreads, commissions and overnight financing differ by broker and by instrument, and fills can differ from the prices you model. Check your own account's specification before trading.
See this on a live chart

Open EURUSD on the D1 in our charting desk and look for it on real, current price - the same thing this page describes, on a chart that is moving. It is a free preview of the real desk, and a free guest account is required to open it: put in your email, we send a login code, and you are on a live chart in under a minute. The preview runs real market data with one indicator at a time - nothing is saved and no broker is connected. A preview of the product, not advice.

Open the live chart →

1. Write rules a stranger could follow

If two people can read your rules and take different trades, you are not testing a strategy, you are testing your mood. Every rule needs to be checkable on the chart: entry trigger, stop, target or exit rule, what invalidates the setup, position size, and the hours and instruments it applies to.

2. Choose the sample before you look

Decide the instrument, the period and the timeframe first. Include a bad year, not just the trending stretch you remember. Reserve a slice of history you will not touch during development - that untouched slice is the only honest test you get.

3. Record every trade in R

One R is the amount risked. Recording results in R rather than money makes samples comparable and stops good position sizing from hiding a weak method. Log the ones you would have skipped too; the gap between "the rules" and "what I would have done" is the finding.

Chart Bound, the free trading game
Practise this in Chart Bound, free

Backtesting is reading old charts with discipline. Chart Bound's replay drills exactly that, free, one candle at a time.

Play free, no signup →

4. Ask how many trades you need

This is where most backtests quietly fail: a run of 20 trades tells you almost nothing. The calculator above shows the margin of error around a measured expectancy for a given sample size, so you can see when a result is signal and when it is noise.

5. Subtract the costs

Spread, commission, swap and slippage come off every trade. Test the fill you could actually get, not the perfect price on the chart. A strategy that survives realistic costs is a different animal from one that only works on mid prices.

Where backtests lie

After the backtest

A good result is a hypothesis, not a conclusion. Forward-test it on unseen data, at small size, with the same logging - the journal and the expectancy calculator turn that into a number you can compare with the backtest.

Frequently asked questions

How many trades does a backtest need?

Enough that the margin of error is smaller than the edge you think you found. The calculator on this page shows that relationship; a few dozen trades is rarely enough.

What is curve fitting?

Tuning parameters until they fit past data. It produces excellent backtests and poor live results, and the risk grows with every setting you optimise.

Should I backtest manually or with code?

Manual replay teaches you what the rules feel like and catches ambiguity; code gives bigger samples. Most people benefit from doing a manual pass first.

Does a good backtest mean the strategy will work?

No. It means the rules would have worked on that data. Markets change, and past results do not predict future results.

Embed this calculator on your site

Free to use, on any site, with no signup: paste this one line where you want the tool to appear. It loads our hosted version, so it stays up to date, and the link under it credits back to this page.

420×620 by default and it scales down to fit a narrower column. Please keep the attribution link.

Keep learning

Free Trading Simulator & Paper TradingTrading Expectancy CalculatorTrading Journal TemplateForex Trading Strategies for BeginnersRisk:reward ratio
Chart Bound, the free trading game
Practise this in Chart Bound, free

Backtesting is reading old charts with discipline. Chart Bound's replay drills exactly that, free, one candle at a time.

Play free, no signup →