Before you risk money or an evaluation on a strategy, you need to know whether it holds up at all. That is what backtesting is for: testing your rules against historical data. In this guide you will learn how to backtest manually and with software, how many trades you need for a meaningful sample, how to avoid the biases that ruin most tests, and how to follow up with forward testing on a simulated account.
In short: backtesting means applying written, unambiguous rules to historical data to estimate how a strategy behaved. You need a large sample (ideally 100+ trades), you must avoid curve fitting and look-ahead bias, and you should confirm the results with real-time forward testing before trusting them.
What backtesting is, and what it is not
Backtesting means taking a strategy with defined rules and applying it, trade by trade, to price history to record what would have happened. The goal is to answer specific questions: How often does the setup appear? What was the expectancy in R? What was the worst losing streak? How deep a drawdown would the account have had to absorb?
What backtesting does not do is predict the future. Markets change, and a strategy that worked in one period may behave differently in another. Backtesting reduces uncertainty and weeds out ideas that did not even work in the past. It offers no certainties.
Prerequisite: rules with no wiggle room
You cannot test something that is not defined. Before you start, write your rules so that someone else could apply them and arrive at the same trades:
- Context: timeframe, instrument, session.
- Entry: the exact condition (for example, an H1 candle closing above the previous day's high).
- Stop loss: where it goes and why.
- Exit: fixed target, trailing stop or time-based exit.
- Risk: a fixed percentage per trade.
- Filters: hours to avoid, maximum trades per day.
If your rules include phrases like "when price looks strong", they are not ready yet. A structured trading plan is the best place to start.
Manual vs. software backtesting
Both approaches are valid and serve different needs.
| Aspect | Manual | Software |
|---|---|---|
| How it works | You step through the chart bar by bar and log each trade | A program runs coded rules over the history |
| Speed | Slow (hours per 100 trades) | Very fast (seconds or minutes) |
| Skill required | Chart reading and discipline | Coding or rule configuration |
| Best for | Discretionary, price action and level-based strategies | Fully mechanical strategies |
| Key advantage | Trains your eye and your decision-making | Huge samples and exact metrics |
| Main risk | Bias from "seeing" the future chart | Over-optimising parameters |
How to backtest manually, step by step
- Pick an instrument and a period spanning several months or years.
- Use your platform's replay mode or cover the right side of the chart so you cannot see what comes next.
- Move forward one bar at a time. When a setup meets every rule, write down entry, stop and target before moving on.
- Advance until the stop or target is hit and log the result in R.
- Repeat until the sample is complete.
- Calculate the metrics at the end, not during the test, so they do not influence your decisions.
Log each trade in the same format you would use in your trading journal. That way you can later compare the backtest with your live trades.
When to use software
If your strategy is fully mechanical, software lets you test thousands of trades across several instruments. cTrader, for instance, lets you code bots and test them on historical data. Keep in mind that if your strategy relies on reading context, translating it into code can change it so much that you are no longer testing the same thing.
Sample size: how many trades you need
This is the most common mistake: drawing conclusions from 15 or 20 trades. With small samples, randomness dominates.
A practical guide:
- Fewer than 30 trades: only tells you whether the strategy can be applied. Conclude nothing.
- 50 to 100 trades: you start getting a reasonable picture of win rate and expectancy.
- More than 100 trades: a useful sample for decisions, especially if it covers different market conditions.
Make sure the sample spans several environments: trends, ranges, high and low volatility. A strategy tested only in a trending market can look excellent and fall apart as soon as price goes sideways.
The metrics to extract
- Win rate, plus average R on winners and losers.
- Expectancy per trade in R.
- Longest losing streak.
- Maximum drawdown in percent, using the risk per trade you plan to use.
- Frequency: how many trades a week it produces.
An illustrative example: if your backtest shows a worst streak of 8 losses in a row and you plan to risk 1% per trade, you should assume you could see a drop of at least 8% live, and probably more. If your account has a 6% maximum loss, that risk per trade is too high for that strategy. A tool like the loss limits calculator helps you fine-tune these numbers.
The biases that ruin a backtest
A backtest is only as good as it is honest. These are the most common biases and how to avoid them.
Curve fitting (over-optimisation)
This is tweaking parameters until the strategy fits past data perfectly: a 23-period average instead of 20, a 17-pip stop instead of 15. The result looks spectacular on history and collapses live, because it describes the noise of one specific period rather than repeatable behaviour.
How to avoid it:
- Use few parameters and round values.
- Split your data: optimise on one part (say, the oldest 70%) and validate on the rest without touching anything.
- Be suspicious if small parameter changes wreck the results. A robust strategy performs reasonably well with nearby values.
Look-ahead bias
This happens when you use information you would not have had at the moment of the decision. Examples: entering at a candle's close while using its high, which was not yet known, or, in manual testing, glancing at where price went next.
How to avoid it: decide only on closed candles, hide the future part of the chart and log the trade before advancing.
Selection bias
Testing only the period or instrument where you "know" the strategy worked. Choose the period before looking at results and do not drop the difficult stretches.
Ignoring costs
Spreads, commissions and slippage eat into results, especially for strategies with tight stops. Always include them.
Forward testing: the real-time test
A positive backtest is a hypothesis, not a conclusion. The next step is forward testing: running the strategy in real time, without changing the rules, for a meaningful period.
Forward testing reveals what a backtest cannot:
- Whether you can execute the rules under live market pressure.
- Whether setups appear during the hours you can actually trade.
- Whether real slippage and spreads change the expectancy.
A simulated account is the natural environment for this phase. At Funded Profit every account is simulated, and the 1-Phase Challenge has no time limit, so you can run your strategy calmly, with real risk rules (4% daily loss, 6% static maximum loss) and no clock ticking. Compare your live numbers with the backtest: if expectancy is similar and your execution matches the plan, you gain confidence grounded in data. If they differ widely, your journal will help you work out whether the problem is the strategy or the execution.
Remember that even with a good backtest and a solid forward test, trading involves risk and future results may differ.
FAQ
What is backtesting in trading?
It is the process of applying a strategy's rules to historical price data to estimate how it would have behaved: win rate, expectancy, streaks and drawdown. It helps you discard weak ideas before using them live.
How many trades do I need in a backtest?
At least 100 trades for a useful sample, ideally spread across different market conditions. With fewer than 30, results depend too heavily on chance.
Is manual or automated backtesting better?
It depends on the strategy. Manual testing suits discretionary strategies and trains your chart reading; automated testing is faster and more precise for fully mechanical strategies, but carries a higher risk of curve fitting.
What is forward testing?
It is running the strategy in real time, with unchanged rules, after the backtest. A simulated account is a good place to do it, because it lets you check your execution under real market conditions.