Home Market News Calendar Forex Tools Brokers
Strategy & Practical Guides

Backtesting Your Strategy: A Step-by-Step Guide

August 8, 2026 · Strategy & Practical Guides · 6 min read

What Backtesting Actually Proves (and Doesn't)

Backtesting means running a strategy's rules against historical data to see how it would have performed. Done properly, it's the difference between a strategy you genuinely believe has an edge and one you simply "feel" works because you remember the times it hit.

It's worth being precise about what backtesting does and doesn't prove: it shows that a strategy had a documented edge in the past, under the specific conditions tested. It does not guarantee that edge persists going forward — markets change, and volatility regimes shift. What it does provide is a foundation: a strategy with no historical edge has no real basis for live trading at all, while one with a documented edge across varied conditions gives you something concrete to build on.

Step 1: Write Mechanical, If/Then Rules

Before opening a single historical chart, your strategy needs to be specific enough that two different people could apply the same rules and reach the same conclusions. "Buy when it looks like support" isn't testable. "Buy when RSI(14) crosses below 30 and price is above the 200 EMA on the H1 timeframe" is.

Every element needs a clear rule: entry trigger, stop-loss placement, take-profit or exit condition, and position sizing. If you can't write it as an if/then statement, you can't backtest it meaningfully.

Step 2: Hide Future Data to Avoid Hindsight Bias

This is widely considered the single most common backtest-killing mistake: hindsight bias, where seeing future price action while reviewing past entries makes trades look far more obvious than they actually were in real time. Scrolling backward through a chart with everything already visible naturally biases you toward "seeing" setups that worked.

The fix: test with future candles hidden, scrolling forward one bar at a time, and only marking an entry when your rules would have genuinely triggered at that exact moment — not because you can see what happened three days later.

Step 3: Log Every Trade, Including Losers

Every trade your rules would have triggered needs to be logged, including the ones that lost badly. Skipping uncomfortable losing trades, even unintentionally, skews the results toward a rosier picture than the strategy actually deserves. A backtest's value comes specifically from including the full, honest picture — wins, losses, and everything the mechanical rules would have actually done.

Step 4: Split Your Data for Out-of-Sample Testing

A common, effective approach: split your historical data into two periods. Use the earlier roughly 70% to develop and refine the strategy. Then test the final 30% — data you haven't touched during development — without making any further adjustments.

If performance holds up reasonably well on that untouched data, the edge is more likely genuine. If results fall apart, the strategy was probably overfitted — tuned to match the specific historical window it was built on, rather than reflecting a real, repeatable pattern. A more rigorous version of this same idea, walk-forward analysis, repeats the process across multiple rolling periods rather than just one split.

Step 5: Read the Metrics That Actually Matter

Win rate and profit factor need to be read together, not separately — a 40% win rate with a strong reward-to-risk ratio can outperform a 70% win rate with a poor one.

Step 6: Account for Real Trading Costs

A backtest that ignores spread, commission, and slippage will overstate performance — sometimes turning what would be a losing live strategy into an apparently profitable backtest. Building realistic frictional costs into the test from the start, rather than adding them as an afterthought, is essential for results that actually mean something.

Common Backtesting Mistakes

A Common Backtesting Trap

Say you're backtesting a strategy on EUR/USD daily charts, scrolling forward candle by candle. If you catch yourself glancing slightly ahead — even unconsciously noticing that a big move is coming a few candles later — your entries start getting subtly influenced by information you wouldn't have had in real time. This is hindsight bias, and it's one of the most common ways backtests produce misleadingly good results.

A more reliable approach uses dedicated backtesting software that reveals price one candle at a time, with no ability to see ahead, or strictly disciplined manual scrolling with a ruler or cover over the future price action. The extra friction is worth it — a backtest contaminated by hindsight bias isn't just unhelpful, it's actively misleading about how a strategy will perform going forward.

Frequently Asked Questions

What is hindsight bias in backtesting and how do you avoid it?

Hindsight bias happens when you can see future price action while testing past entries, making trades look more obvious than they actually were in real time. It's avoided by testing with future candles hidden, scrolling forward one bar at a time so decisions are made with only the information that would have been available at that moment.

How many trades do you need for a reliable backtest?

Most serious backtesting guidance suggests at least 100, and ideally 200 or more trades, before drawing meaningful conclusions. A sample of 50 trades or fewer is generally considered too small to distinguish genuine edge from random variance.

What is out-of-sample testing?

Out-of-sample testing means reserving a portion of historical data — commonly the most recent 30% — that isn't used while developing or refining the strategy. Testing the finished rules against this untouched data checks whether the edge is real or the strategy was simply overfitted to the data it was built on.

What is profit factor and what is considered a good number?

Profit factor is gross profit divided by gross loss. A value below 1.0 means the strategy loses money overall. A range of roughly 1.3 to 1.8 is commonly considered solid for a realistic trading strategy, while values above 2.0 are excellent but also worth double-checking for overfitting.

← PreviousHow to Build a Trading Plan
Ask DeskAi
DeskAi
AI Assistant
Hi! I'm DeskAi — ask me anything about Backtesting Your Strategy or trading strategy.