i Short answer

Backtesting means applying a strategy’s exact rules to past price data to see how it would have performed. You write the rules precisely, go through the chart bar by bar or use software, record every trade in R, and then work out expectancy, win rate, profit factor and drawdown after costs. In the worked example, 120 trades with 46 winners averaging 2.1R gave +0.19R per trade before costs, +0.14R after them, and a profit factor of 1.31. Past results are only useful if the rules were not tuned to fit the past. The same tests apply before paying for one; see evaluating an indicator vendor.

The expectancy calculator turns your backtest’s win rate and average win and loss into a result per trade.

1. What do you need before you backtest?

Rules exact enough that two people would take the same trades: market, timeframe, entry condition, stop, target or exit rule, position size and when not to trade. Vague rules turn a backtest into hindsight. What a complete rule set looks like is covered in trading systems.

2. How do you run a backtest?

Manual backtest steps
  • Pick a period with different market conditions, such as trends and ranges
  • Hide future bars and move forward one bar at a time
  • Record every signal, even the ones you dislike
  • Log entry, stop, exit and result in R for each trade
  • Subtract realistic spreads, commission and slippage

Software, covered in backtesting platforms, speeds this up for rules that can be coded. Manual testing teaches more about how the strategy behaves.

At a glance: What Is Backtesting and How Do I Do It?
At a glance: What Is Backtesting and How Do I Do It?

⬇ Download this summary (PNG) · Free to share with the credit “Source: TradeAnswers” (CC BY 4.0).

3. How do you read the results? A worked example

Assumptions (hypothetical example): 120 backtested trades; 46 winners averaging 2.1R and 74 losers averaging 1R; costs equal to 0.05R per trade.

Backtest results
MeasureWorkingResult
Win rate46 ÷ 12038.3%
Expectancy before costs(46 × 2.1 − 74 × 1) ÷ 120+0.19R
Expectancy after costs0.19R − 0.05RAbout +0.14R
Profit factor before costs96.6R ÷ 74R1.31

A win rate under 40% still produces a positive result because winners are twice the size of losers. Costs take about a quarter of the edge, which is why they must be in the test. Drawdown matters too: track the largest fall from a peak, as described in drawdown. The expectancy calculator, which also gives the profit factor handles the ratio.

120trades in the test
+0.19Rexpectancy before costs
+0.14Rafter costs
1.31profit factor

4. How do you avoid fooling yourself?

The biggest risk is overfitting: adjusting rules until they fit the past perfectly, which usually makes them fail in the future. Keep rules simple, test on one period and confirm on another the rules never saw, and be wary of results that depend on one exact setting. The details are covered in avoiding overfitting and walk-forward testing.

5. How many trades does a backtest need?

At least 100, preferably more, spread across different conditions. Fewer trades leave too much room for luck: over 20 trades a win rate can stray more than 20 percentage points from its true level. Why sample size matters for any strategy is covered in the best strategy for a beginner.

6. What comes after a good backtest?

A forward test on demo with the same rules, then small live trading, comparing results with the backtest at each step. If live results fall well below the test after enough trades, the test was probably too optimistic. Demo trading’s role is covered in is demo trading worth it. Test any indicator settings the same way (CME Group, technical analysis course).

Three ways a backtest can mislead

Slippage and costs. A test that fills every trade at the exact signal price overstates results. Worked example (hypothetical): 200 trades averaging +0.15R before costs become +0.05R if spreads and slippage cost 0.10R per trade, a third of the apparent edge.

Survivorship bias. Testing a JSE share strategy over ten years on today’s Top 40 leaves out the companies that fell out of the index or delisted, often after large losses, so the test only sees the survivors (JSE, indices). Use the index membership as it was at each date.

Look-ahead bias. Using information that was not available when the trade was taken, such as deciding at the open using that day’s close or a revised data figure, makes a strategy look better than it could ever trade. Check that every input is known before the signal time.

★ Why It Matters

A backtest is only as honest as its rules and its costs. Exact rules, realistic costs, enough trades and a period the rules never saw are what turn past results into evidence rather than a story.

✕ Common mistakes

  • Using vague rules. The test becomes hindsight.
  • Leaving out costs. In the example they took about a quarter of the edge.
  • Tuning settings until the past looks perfect. That is overfitting, and it fails forward.
  • Testing too few trades. In small samples, luck can dominate.

Key Takeaways

  1. Write rules before looking at historical charts.
  2. Use as many trades as the data allows, and check the margin of error.
  3. Include costs and slippage.
  4. Test on data you did not use to design rules.
Share this answer:LinkedInXEmail

Frequently asked follow-up questions

What is backtesting?

Applying a strategy’s exact rules to historical prices to see how it would have performed.

How many trades should a backtest include?

At least 100, across different market conditions.

Should I include costs in a backtest?

Yes. Spreads, commission and slippage can take a large share of the edge.

What is overfitting?

Adjusting rules until they fit past data closely, which usually makes them fail in live trading.

Can I backtest manually?

Yes, by moving through charts bar by bar and recording every signal the rules give.