Home โ€บ Strategy & Technical Analysis โ€บ What Is Backtesting and How Do I Do It?

What Is Backtesting and How Do I Do It?

i Short answer

Backtesting means systematically applying a strategy's specific rules to historical price data to observe how it would have performed in the past.

This provides useful, though imperfect, evidence about a strategy's potential viability before committing actual capital.

1. The basic backtesting process step by step

The basic backtesting process involves selecting a historical period of price data for your instrument of interest, then manually or systematically working through that historical data applying your strategy's exact entry, exit, and risk management rules at each point a signal would have occurred, recording what the outcome of each hypothetical trade would have been had you actually executed it according to your defined rules.

Accumulating these hypothetical trade outcomes across a meaningful historical sample, ideally covering different market conditions (trending periods, range-bound periods, high and low volatilityVolatility measures how much and how quickly an instrument's price fluctuates.Click to read more โ†’ periods), produces a dataset you can analyse for overall profitability, win rate, average win versus average loss size, and maximum drawdown (the largest peak-to-trough decline the strategy would have experienced), giving a more complete statistical picture than any single metric alone.

!
Never optimise a strategy only on the data you will trade

Fitting parameters to historical data produces strategies that look excellent in backtests and fail immediately live. Always reserve out-of-sample data for final validation.

โœ“
Strategy evaluation: A strategy requires at least 100 trades under consistent conditions to assess statistically. Judging performance on a shorter sample produces unreliable conclusions.

It's worth deciding on the specific historical period before you start, rather than adjusting it partway through based on how the early results look. Extending or shifting the tested date range after seeing disappointing initial results, specifically to find a window where the strategy performs better, quietly reintroduces the same bias a proper backtest is meant to guard against, even though no individual rule was technically changed.

Manual vs automated backtesting
FeatureManualAutomated
SpeedSlowerMuch faster
Requires codingNoUsually yes
Overfitting riskLowerHigher if not careful

2. Manual versus automated backtesting

Manual backtesting involves a trader personally working through historical charts, identifying where strategy signals would have occurred, and manually recording hypothetical outcomes, time-consuming but genuinely valuable for building deep, intuitive familiarity with how a strategy's signals actually look and behave across real historical price action, beyond just the abstract rules on paper.

Automated backtesting, available through platforms like MetaTrader's Strategy Tester or other dedicated backtesting software, can process vastly larger historical datasets far more quickly by programmatically applying strategy rules, but requires the strategy to be precisely codified into a script or algorithm (commonly in MetaTrader's MQL programming language), which itself requires either programming skill or access to someone who can help translate strategy rules into this precise, executable format.

100+minimum sample for valid assessment
55%win rate needed at 1:1 RR to break even
35%win rate possible at 2:1 RR profitably
6 monthsrecommended strategy review interval
Pros
  • Quantifiable rules remove subjectivity
  • Backtestable on historical data
  • Works consistently when edge is genuine
  • Clear entry/exit criteria reduce hesitation
Cons
  • Past performance does not guarantee future results
  • Risk of overfitting to historical data
  • Market regimes change, edges decay
  • Requires discipline through drawdown periods
Technical analysis
  • Price and volume patterns
  • Works on any liquid instrument
  • Faster to learn basics
  • Ignores fundamental context
Fundamental analysis
  • Economic and financial data
  • Better for longer timeframes
  • Deeper knowledge required
  • Ignores entry precision

A practical middle path many traders use is manual backtesting first, to build genuine intuition for how the strategy's signals actually look on a chart, followed by automated backtesting once the rules are well understood and precise enough to codify reliably. Attempting to code a strategy before you've manually seen enough of its real signals often produces subtle logical gaps between what you intended and what the code actually checks for.

3. What constitutes a genuinely useful backtest

A useful backtest covers a meaningful sample size of trades (commonly suggested as at least 50-100, ideally more) across a historical period long enough to include varied market conditions, rather than a small sample drawn entirely from one specific, perhaps unusually favourable, market period. Testing exclusively during a strong trending period, for example, can make a trend-following strategy look more universally sound than it would actually prove during subsequent range-bound, choppy conditions.

Recording not just whether trades were winners or losers, but the full distribution of outcomes (including the size of both wins and losses, and the maximum drawdown experienced along the way) gives a much more complete and useful picture of a strategy's realistic risk and reward profile than a simple win-rate percentage alone, which can be genuinely misleading if not considered alongside the actual magnitude of wins and losses.

Strategy Validation Checklist
  • Written entry/exit rules with zero ambiguity
  • Backtested on minimum 3 years of data
  • Walk-forward tested on out-of-sample data
  • SA-specific events included in test period
  • Maximum drawdown within personal tolerance
  • 100+ live demo trades with consistent performance
DODON'T
Test on minimum 100 trades before judging performance
Abandon a strategy after 5-10 consecutive losses
Walk-forward test on out-of-sample data
Optimise parameters only on the same data you will trade
Include SA-specific events in your backtest period
Use only global data ignoring rand-specific volatility events
Document rules in writing before trading
Keep strategy rules only in your head

A strategy with a 40% win rate can be considerably more profitable than one with a 70% win rate, if the winning trades in the first strategy are, on average, large relative to the losses, while the second strategy's frequent small wins are offset by occasional large losses. This is precisely why expectancy, which combines win rate with average win and loss size into a single figure, tends to be a more reliable summary statistic than win rate viewed in isolation.

4. Common pitfalls that undermine backtest reliability

Several common mistakes undermine backtest reliability and validity. Overfitting, adjusting strategy rules repeatedly and specifically to maximise historical backtest performance on one specific dataset, often produces a strategy that performed excellently on that specific historical data purely by chance, but that fails to perform similarly going forward on new, future data the strategy wasn't tuned against. Look-ahead bias, inadvertently using information in the backtest that wouldn't actually have been available at the time a real trading decision was being made, produces artificially inflated, unrealistic results.

Ignoring realistic transaction costs (spreadsThe spread is the gap between an instrument's buy and sell price, and the most fundamental trading cost.Click to read more โ†’, commissions, financing charges) in backtest calculations is another common pitfall, since a strategy that appears profitable based purely on price movement alone can become unprofitable once these real, unavoidable costs are properly factored into every hypothetical trade in the backtest, particularly for strategies trading frequently where these costs accumulate significantly.

Win Rate Required at Different RR Ratios
Win rate1:1 RR1.5:1 RR2:1 RR
40%LosingBreak evenProfitable
50%Break evenProfitableProfitable
55%ProfitableProfitableProfitable
60%ProfitableProfitableProfitable
Strategy Evaluation Reference
Minimum sample
100+ trades before assessing
Win rate at 1:1 RR
Must exceed 50%
Win rate at 2:1 RR
Can be 35%+ and still profitable
Max test drawdown
Define tolerance before live use
Walk-forward test
Out-of-sample confirmation required
Edge decay check
Re-evaluate every 6 months

This pitfall is easy to underestimate precisely because each individual cost looks small in isolation. A few Rand of spread cost on any single trade seems negligible, but multiplied across dozens or hundreds of backtested trades, it can be the difference between a strategy that looks profitable on paper and one that would have actually lost money once the real, unavoidable cost of executing every single trade is properly included.

5. Moving from backtesting to forward testing

Given backtesting's inherent limitations and pitfalls, a sound strategy validation process typically moves from backtesting (testing against historical data) to forward testing (testing the strategy in real time on a demo account going forward, without the benefit of already knowing how the market actually moved). Forward testing provides a genuinely independent check on whether a strategy's backtested performance translates to real, live conditions the strategy wasn't specifically developed or tuned against.

A strategy that performs reasonably consistently across both rigorous backtesting and a subsequent period of forward testing on demo provides considerably more genuine confidence than backtesting alone, because forward testing helps reveal whether the backtest results reflected genuine strategy edge or simply favourable historical curve-fitting that doesn't hold up against new, previously unseen data.

It's worth resisting the temptation to skip or shorten forward testing simply because the backtest results looked strong. A strategy's backtest is, by definition, tested against data the strategy was developed with knowledge of, even without deliberate overfitting; forward testing is the only stage that genuinely tests the strategy against data it has had no opportunity to be shaped by, which is exactly why it deserves the patience it requires.

6. What backtesting fundamentally cannot tell you

Even a rigorous, well-conducted backtest cannot tell you whether you, personally, will actually execute the strategy with sufficient discipline under real psychological pressure once genuine financial risk is involved, this is the same demo-to-live psychological gap discussed elsewhere, and backtesting, being entirely retrospective and risk-free, provides no information whatsoever about this critical, separate dimension of trading success.

Backtesting also cannot account for genuinely unprecedented future market conditions or events that have no clear historical analogue in the specific dataset tested, past performance, even when rigorously tested, never guarantees future results, and this limitation is fundamental and unavoidable regardless of how much historical data or how sophisticated the backtesting methodology employed, making backtesting a useful but ultimately incomplete piece of evidence within a broader strategy validation and risk management process.

Treating backtesting as one input among several, alongside forward testing, honest self-assessment of your own discipline, and ongoing trading journal review once live, rather than as a final verdict on a strategy's worth, keeps its genuine value in proper perspective without asking it to answer questions it was never capable of answering in the first place.

โ˜… Why It Matters

Worth doing as a specific discipline: write down your exact entry and exit rules before you begin backtesting, not while you're in the middle of reviewing the historical data, rules adjusted mid-test to fit what 'looks like it would have worked' produces a result that won't replicate going forward.

Manual backtesting versus automated backtesting
Manual backtesting
Automated backtesting
Method
Review charts, record trades
Platform runs rules automatically
Bias risk
Visual selection bias
Lower if rules are objective
Speed
Slow
Fast
Suitable for
Most retail strategies
Systematic strategies
Starting tool
Your existing charts
MT4/MTS strategy tester
Manual backtesting on charts is accessible and builds genuine market feel.
Automated backtesting runs faster with less visual selection bias.

Manual backtesting builds genuine market feel and works for most retail strategies. Automated backtesting runs faster and reduces visual selection bias, better suited to systematic, rule-based approaches.

โœ• Common mistakes

  • Not writing exact rules down before starting the backtest. Rules decided in advance prevent unconscious result-fitting during testing.
  • Ignoring realistic spread and slippage in the simulated results. A frictionless backtest can show profitability that disappears with real costs included.
  • Treating a single successful backtest as sufficient validation. Forward testing and walk-forward analysis provide a more complete picture.
How many indicators should I use on a chart?

Most professional traders use one to three indicators at most. More indicators tend to produce conflicting signals and analysis paralysis. A single well-understood indicator combined with price action context is often more useful than a complex multi-indicator setup.

Does backtesting guarantee a strategy will work in live markets?

No. Backtesting shows historical performance, but past results do not guarantee future outcomes. Overfitting a strategy to historical data is a common trap that produces strategies that fail in live conditions.

Key Takeaways

  1. Backtesting tests a strategy against historical price data before risking real money. Learn the process, tools, and common pitfalls to avoid.
  2. Backtesting means systematically applying a strategy's specific rules to historical price data to observe how it would have performed in the past.
  3. This provides useful, though imperfect, evidence about a strategy's potential viability before committing actual capital.
  4. The basic backtesting process step by step.
  5. Manual versus automated backtesting.

Frequently asked follow-up questions

Do I need programming skills to backtest a strategy?

Manual backtesting requires no programming skill, just patience and discipline working through historical charts; automated backtesting typically requires at least basic scripting ability or access to someone who can help codify your strategy rules.

How much historical data is enough for a reliable backtest?

There's no single fixed answer, but covering at least several months to ideally a few years of data, spanning varied market conditions, generally produces more reliable results than testing against just a few weeks of a single specific market period.

Can a strategy that backtests well still fail in live trading?

Yes, due to factors including overfitting, unaccounted transaction costs, genuinely new market conditions without historical precedent, and the separate psychological challenge of executing the strategy under real financial risk.

Official sources: FSCA

๐Ÿ“š Sources & further reading

This article draws on general information published by the South African regulators and established financial education resources listed below. Always check each source directly for the most current detail.

Explore more South African trading guides on TradeAnswers.

๐Ÿ›ก๏ธ
Practice without risk

See This Strategy in Live Market Conditions

Test how this approach performs on real price action, on a free demo account with no capital at risk.

Test This Strategy Free
  • FSCA RegulatedTrade with confidence
  • Practice Risk FreeReal market conditions
  • Beginner FriendlyPerfect for learning

79% of retail CFD accounts lose money. Demo accounts do not guarantee future profits.