How to backtest: test your strategy step by step before real money is on the line
Backtesting means checking your strategy against past prices before you trade it with real money. This guide shows you how to go about it, which mistakes distort the result, and how to tell when a strategy is ready.
Guide, updated October 2026. 6 min read
In short
Write your rules down so precisely that someone else could trade them. Test them over many trades from different market phases, include spread and fees, then practise without rewinding before you go live.
What is backtesting?
In a backtest you apply your strategy's rules to past price data and see what would have happened. You learn whether an idea has an edge at all, how often it wins and how deep the losing stretches get, without risking money.
There are two ways to do it. In an automated backtest you write the rules as a program and the computer runs years of data in seconds. In a manual backtest, also called replay backtesting, you play the market forward candle by candle and make every decision yourself, as you would live.
For beginners, the manual route is usually the better start. You don't just get to know the strategy, you get to know yourself: how you react to losses, when you hesitate and when you exit too early.
Why is backtesting worth it, especially for beginners?
- You see how a strategy behaves over many trades, not just the last three.
- You learn to sit through losing streaks because you know they're part of it.
- You gain in a few hours the experience that would take months live.
- You don't lose any money doing it.
A good backtest is no guarantee for the future. It shows whether an idea worked in the past. That's all, but it's far more than most people know when they place their first real trade.
Step by step: how to test your strategy
1. Write down your rules
Write your strategy down so precisely that someone else could trade it without asking you anything: which market, which timeframe, which hours, when you enter, where the stop goes, where you take profit and when you don't trade at all. Anything done by feel can't be tested.
2. Pick the market and the period
Test the market you actually plan to trade. Choose a period that covers different phases: quiet weeks, strong trends, hectic days with major news. If you only test the last two weeks, you're mostly testing luck.
3. Set your costs
Enter spread, commission and fees as your broker or prop firm charges them. With small targets, scalping for example, costs often decide whether a strategy makes or loses money.
4. Trade it candle by candle
Play the market forward from a starting point without looking to the right. Make each decision before the next candle prints, and set entry, stop and target exactly by your rules, even when you don't like the setup.
5. Log every trade
For every trade, note the date, time, direction, entry, stop, target, result and one sentence on why you took it. Setups you skipped belong in there too.
6. Collect enough trades
Twenty trades tell you almost nothing. A common rule of thumb is at least 100 trades before you judge. The fewer trades, the bigger the share of chance in the result.
7. Review the results
Only once the sample is big enough do you look at the numbers. Which ones matter is covered next.
Which metrics matter?
- Win rate: the share of your trades that end in profit.
- Average win and average loss: together with the win rate, they show whether anything is left at the end.
- Expectancy: what you make or lose per trade on average, after costs.
- Profit factor: total gains divided by total losses. Above 1 means the gains outweigh the losses.
- Maximum drawdown: the biggest drop from a peak. It shows what you'll have to sit through.
- Longest losing streak: how many losses came in a row.
A strategy that wins 40 percent of the time can be very good if the wins are much bigger than the losses. So never judge by a single number.
Which mistakes distort a backtest?
Peeking into the future
If you can see what happened after the entry, you'll pick the better trades without meaning to. So step forward candle by candle and never scroll ahead.
Tweaking the rules after the fact
Keep changing the rules until the past looks perfect and you've built a strategy for the past. That's called overfitting. Change rules rarely, and test every new version on a period you haven't seen yet.
Leaving out costs
Without spread and fees, almost every strategy looks better than it is.
Data that's too coarse
When stop and target both sit inside the same candle, minute data can't tell you which was hit first. Finer data, down to ticks, answers exactly that question.
Too few trades
A small sample can look great or terrible by pure chance. Collect more trades before you decide.
When is a strategy ready for real money?
There's no fixed line, but these are good signs:
- Expectancy is positive after costs, over a large number of trades.
- The results hold up on a period you didn't use while building the strategy.
- You know the worst drawdown and can handle it, with your account and your nerves.
- You've also practised it without rewinding, under live-like conditions.
Then start small, on a demo account or with the smallest possible size, and compare your live results with the backtest. If they differ a lot, the cause is often the execution, not the strategy. That's exactly what a trading journal is for.
Checklist for your backtest
- Rules written down, with no room for interpretation
- Market and period chosen to cover different phases
- Spread, commission and fees set
- No peeking ahead, candle by candle
- Every trade logged, skipped setups too
- At least 100 trades as a rule of thumb
- Results reviewed after costs, with drawdown and losing streak
- Test repeated on a period you haven't seen
How Beyond Replay helps
Beyond Replay's replay backtesting lets you play 21 markets with five years of price data candle by candle: the major indices, the key forex pairs, gold and silver. Starter uses second-level data, Pro and Elite are tick by tick. You set spread and fees per session, economic releases show up as markers on the chart, and every session has its own journal and statistics.
Live Sim mode lets you practise without rewinding. And if you'd rather describe your strategy in words, Edge writes its own test program, shows you how it understood the rules, and runs the test.
About this guide
This guide explains a general approach. Figures such as 100 trades are rules of thumb, not hard limits.
No guide replaces personal advice. This text is not investment advice. Trading leveraged products such as CFDs, futures and forex carries a high risk of loss. Backtest results are no guarantee of future results.
Guide, updated October 2026.
Frequently asked questions
How many trades do I need for a meaningful backtest?
As a rule of thumb, at least 100 trades, ideally more, spread across different market phases. With fewer trades, chance plays a big part in the result.
Is manual or automated backtesting better?
Automated backtesting is faster and covers a lot of data. Manual replay backtesting is closer to real trading because you make every decision yourself. For beginners, manual is usually the better start because you practise execution as well.
Do I need to code to backtest?
No. For manual backtesting you only need a chart you can step through candle by candle and your rules on paper. In Beyond Replay you can also describe a strategy in words and Edge writes the test program.
Why are my live results worse than my backtest?
Common reasons are costs missing from the backtest, peeking ahead while testing, and rules that aren't followed live, out of fear or after losses. A trading journal shows you exactly where the gap comes from.
Does a good backtest guarantee profits?
No. A backtest only shows how a strategy would have done in the past. Markets change, and backtest results are no guarantee of future results.

