Join the program →
Strategy & risk · testing an edge

How to Backtest a Trading Strategy

Backtesting tells you whether a strategy has an edge before you risk money on it. Learn how to test rules honestly, the traps of overfitting, and why forward testing is the real proof.

The short answer

Backtesting checks how a strategy would have performed on past data, to see if it has an edge before you risk real money. Write objective rules a stranger could follow, test a large sample across different conditions, and measure the result as expectancy in R. The great danger is overfitting. The real proof is forward testing.

Two rules drop from about 60% accuracy on fitted data to 42% and 43% on unseen data
Figure 1. Fitted vs unseen: the 10-day momentum rule fell from 60.2% to 42.1%, and “price above its 20-day average” from 59.6% to 43.0%. Open full sizeSource: JuicyForex tests on XAUUSD data, 2026. Drawn from the results, not edited by hand.
01

Why backtest at all

Trading an untested strategy is gambling with extra steps. You have no idea whether it has an edge. Backtesting lets you estimate that edge cheaply, on history, before a cent is at risk. It answers one question: over many trades, does this make money?

It also builds the confidence to follow a plan through a losing streak, because you have seen the strategy survive drawdowns before.

02

Define objective rules

A strategy you can backtest must be mechanical enough to be unambiguous: exact entry conditions, a defined stop and a defined target or exit. If two people reading your rules would take different trades, the rules are too vague to test.

Writing rules this precisely forces you to turn a vague idea, such as buy the dip, into something you can execute and measure.

03

Gather a large sample

A handful of trades proves nothing, because luck dominates. Aim for at least 100 trades, more if you can, spanning trends, ranges, and high and low volatility. A strategy that only worked in one 2020-style trend is not a strategy.

Record each trade's result in R, then compute the expectancy and the worst drawdown. Those two numbers tell you whether the edge is real and whether you could survive trading it.

04

The trap: overfitting

Overfitting is adding rules and tweaking parameters until the strategy looks flawless on past data. A curve fit perfectly to history describes the past, not the future, and falls apart when conditions change.

Guard against it with simplicity. Fewer rules and round, un-tuned parameters generalise better. If a setting looks magical, be suspicious.

05

Overfitting in numbers

In our testing, a 10-day momentum rule scored 60.2% on the period it was fitted to and 42.1% on unseen days. Price above its 20-day average went from 59.6% to 43.0%. Six of the 16 rules tested were flagged.

We also caught a look-ahead bug that manufactured an 11-percentage-point edge. It fell to about 2 once the signal was stamped at the confirming bar. See what we learned testing gold methods for the results.

06

Forward test before you scale

Forward testing means running the strategy on new data it has never seen, on a demo account or with micro lots. It is the only test that cannot be gamed, because you cannot fit to data that has not happened yet.

Backtest to find a candidate edge, forward test to confirm it, then scale slowly. Past results are evidence, never a promise.

07

Questions

What should I measure when backtesting?

Record each trade in R-multiples, then calculate the strategy's expectancy and its worst drawdown. They show whether the edge is positive and whether you could survive trading it.

How many trades do I need to backtest?

At least 100, ideally more, across different market conditions. A small sample is dominated by luck and cannot confirm an edge.

Is backtesting enough to trust a strategy?

No. Overfitting can game it. The real proof is forward testing on new data, on demo or with micro lots, before scaling up.

Risk

70–80% of retail investor accounts lose money trading CFDs. This page is education, not advice. All trade examples are constructed composites.


Ready when you are

See how we trade.

Join the free channel, or look at the plans.

See the plans →
Trade with a Mentor.