Testing & Technology · 12 min
Backtesting Trading Strategies
Key Points
- A backtest answers one narrow question: did this exact rule make money on past data, after costs? It proves nothing about the future.
- Write the rules before you touch the chart. A rule invented while looking at the answer is not a rule.
- Test on data the rule was not tuned on. The out-of-sample gap is the honest price of overfitting.
- Include spread and realistic slippage in every test, or the test is advertising, not research.
- Judge the result by expectancy and drawdown across at least 100 trades — never by win rate alone.
Every strategy sounds convincing in a sales pitch and most sound convincing in a forum post. Backtesting is where a strategy stops being a story and becomes a claim that can be checked. Done honestly, it is the cheapest education in trading: the market's own history, replayed against your exact rules, billing you nothing for the losses. Done dishonestly — and it usually is — it is a machine for manufacturing false confidence. This article teaches the honest version we require at Forex In Urdu before any strategy is allowed near a demo account: rules written first, history replayed blind, costs included, and the result judged like an accountant, not a fan.
What a backtest can and cannot prove
A backtest can prove that a rule, applied mechanically, would have produced a certain result on a specific stretch of past data. It cannot prove the rule will work next month, because the market that generated that data — its volatility, its trends, its participants — is already gone. Treat a good backtest the way an engineer treats a bridge model: it rules out designs that collapse under known conditions; it does not guarantee the bridge. The correct conclusion from a solid test is never 'this works'. It is 'this survived an honest attempt to kill it, so it has earned a forward test'.
The honest manual method
You need no software beyond your charting platform's replay or a scrollable chart. Step one: write the rules so precisely that a stranger could apply them — market, timeframe, setup, entry trigger, stop, target, hours, and the maximum risk. If a rule contains the word 'obvious', it is not finished. Step two: start at a random point in history, hide or scroll past what comes next, and move forward one candle at a time, recording every trade the rules generate — including the ugly ones your eye wants to skip. Step three: charge every trade the real spread for that pair and hour, plus a pip of slippage on entries and stops. Step four: record each result in R in your journal, exactly as you would a live trade. The discipline of the method is the method: the moment you peek ahead, skip a loser, or adjust a rule mid-test, you have stopped testing the strategy and started flattering it.
A worked example
A student tests a simple daily breakout rule on EUR/USD: buy a close above the 20-day high, stop 40 pips, target 80 pips, spread and slippage charged. Over three years the rules generate 60 trades. Twenty-seven win an average of +38 pips after costs; thirty-three lose an average of −22 pips. The arithmetic: (27 × 38) − (33 × 22) = 1,026 − 726 = +300 pips, an expectancy of +5 pips per trade, or about +0.16R. The win rate is only 45 percent, and the maximum drawdown inside the test is 9R. Is this a good strategy? The honest answer is 'promising and unproven': the edge is thin enough that slightly worse fills could erase it, which is exactly why the next stage — forward testing on demo — exists. Notice what the test gave the student: not excitement, but numbers he can defend.
The overfitting trap
The diagram shows the most common way backtests lie. A student tests a rule, dislikes the result, and adds a filter — then another, then a special exception for Mondays — re-running the test after each change until the equity curve is beautiful. He has not improved the strategy; he has memorised the data. Every added filter fits the past a little tighter and the future a little worse. The defence is procedural: split your history in two before you begin. Tune, if you must, on the first half only. Then run the frozen rules once on the second half — the out-of-sample data the rules have never seen. If the second curve collapses, the first curve was fiction, and the kindest thing the test did was tell you before the market did.
Common mistakes
- Peeking: scrolling ahead 'just to see' converts a test into a highlight reel. Your recorded results no longer describe the rule.
- Testing without costs: a scalping rule that wins 6 pips before a 1.5-pip spread is a different business after it. Costs are not a detail; for short trades they are the story.
- Twenty-trade verdicts: twenty trades cannot separate a rule from luck. One hundred is the working minimum we teach, spread across different market conditions.
- Testing only the good years: a trend rule tested only on trending years has been examined by its friends. Include a ranging, miserable stretch on purpose.
- Optimising to the best settings: if 20 and 50 periods work but 19 and 51 collapse, you have found a cliff edge in the noise, not an edge in the market.
Practical application
Run your first honest backtest this week. Choose the simplest rule you actually intend to trade, write it in the stranger test format, and replay fifty trades on one pair — no more, because the lesson is in the discipline, not the volume. Record every trade in R with costs charged, and finish by writing three sentences: the expectancy, the worst drawdown, and what the test cannot tell you. Students who complete this once read every strategy claim differently forever after — including ours, which is precisely the point.