Forex trading guides

How to backtest
a forex strategy.

Turn a trading idea into rules you can repeat. Test what those rules did in historical conditions, then be clear about what the result cannot tell you.

Write a test that another person could repeat

Backtesting applies a set of trading rules to historical data. The useful question is specific: “What happened when these rules were followed in this sample?” A chart full of good-looking entries is not enough. If you can choose the winners only after seeing the next candles, you have not tested an executable process.

Start with one pair and a defined timeframe. Specify the session and timezone, entry trigger, order type, stop placement, target and management rules. Define what disqualifies a setup. Include how you handle scheduled news, positions still open at the session end and multiple signals arriving together.

  • Signal: the exact condition visible when a decision is made.
  • Execution: when the order could fill and at which price.
  • Risk: the sizing rule and maximum simultaneous exposure.
  • Exit: the stop, target and any time-based or trailing rule.

A rule such as “buy a strong breakout” leaves too much room for interpretation. A completed-candle condition is easier to repeat. If the signal requires the candle's closing price, do not assume you could enter earlier inside that same candle.

Make an illustrative rule set executable

A hypothetical EURUSD test could use completed 15-minute candles between 08:00 and 10:00 UTC. Mark the high of the completed 07:00 to 08:00 UTC range. After the first candle closes above that high, buy at the next candle's opening quote, with a 20-pip stop and 40-pip target. Allow one entry per day and close any remainder at 10:00 UTC.

At an assumed entry of 1.10000, those prices would be 1.09800 and 1.10400. In a USD account, 0.25 standard lots risks $50 on the 20-pip price move and targets $100 before costs. These are illustrative rules, not a tested strategy or a recommended setup.

Specify what to do if the entry is unavailable, a price gaps through an order or the final eligible candle closes at the session boundary. Decide those cases before replay. Without them, two people can follow the same headline idea and produce different records.

Save the rules as a named version before looking at the results.

Replay without borrowing information from the future

Choose the date range in advance. Include ordinary periods and losing stretches, rather than selecting only charts where you remember a clean move. Record every eligible signal, including the awkward ones. If an example is unclear, apply a written ambiguity rule and retain the note.

In manual replay, hide future candles and advance at a pace that lets you record decisions before the outcome appears. Use only the information available at that timestamp. A higher-timeframe candle that has not closed yet must not be treated as though its final shape was already known.

State the execution assumptions

Model execution deliberately. A bid-price chart may not show the ask that triggers a buy or closes a short. If a bar touches both stop and target, its high and low alone cannot tell you which was hit first. Use finer data where available or apply a conservative, consistent rule and flag the trade.

Check units and timestamps

Check the units before the first run. A five-decimal EURUSD quote does not make 0.00001 a full pip; it is a pipette. Confirm the contract size, timestamp convention and any daylight saving adjustment used by a session filter.

Save those assumptions with the test. A rule labelled “London morning” can select different candles if the data timezone is misunderstood, even when the entry rule itself has not changed.

Include a realistic spread, commission and any relevant swap or slippage assumptions. Do not subtract spread a second time if the fill model already uses bid and ask prices. Historical quotes and simulated fills may differ from your broker, especially around news or thin liquidity. Keep a record of those limitations.

  • Write repeatable conditionsDefine the signal, execution, sizing and exit before looking at the results.
  • Read the whole resultInspect costs, drawdown, losing sequences and profit concentration alongside the total.
Backtesting

Replay the setup.
Review the session.

Use replay controls to reveal the next candles after recording a decision. The example workspace shows a simulated position with its stop and target on the chart.

See the backtesting workspace
Historical backtesting chart with a XAUUSD position, stop and target, order controls and replay controls.

Elite includes unlimited backtesting sessions and up to 50 saved backtest strategies.

Read a result after costs

Take a hypothetical test of 40 EURUSD trades with equal initial risk of $50 per trade. Sixteen winners earn +1.8R each before costs, and 24 losers lose -1R each. Gross gains are 28.8R and gross losses are 24R. The gross result is +4.8R, or $240.

Before costs, win rate is 16 ÷ 40 = 40%, profit factor is 28.8 ÷ 24 = 1.20, and expectancy is 4.8R ÷ 40 = +0.12R per trade. That is a small margin between gains and losses, not evidence that the next trade will work.

Now assume total round-trip costs average 0.1R, or $5, per trade. Across 40 trades, costs sum to 4R, or $200. Net result falls to +0.8R, or $40, and net expectancy becomes +0.02R per trade. These cost assumptions are hypothetical; use the specifications relevant to your intended account.

Look beyond the final total

Inspect the equity path as well as the total. Note the largest peak-to-trough drawdown, longest losing sequence, time in the market and concentration of profits. A result carried by one exceptional trade deserves a different level of confidence from a broad pattern across many independent opportunities.

Forty trades here demonstrate the arithmetic. They are not a recommended minimum or a validation threshold. Reliability depends on the strategy, how often signals occur, the conditions covered and how much you adjusted the rules after seeing results.

Keep unseen data for the next question

Separate rule development from evaluation. Use one period to clarify the setup, then reserve a later period that you have not used to tune it. Keep the rules fixed while testing that unseen period. If you change them after seeing its results, that period has become part of development.

Record every version you try. Repeatedly adjusting a filter until the historical curve looks good can fit noise rather than a repeatable pattern. Keep the rule set as simple as the idea allows, and ask whether modestly different costs or nearby settings change the conclusion completely.

Carry fixed rules into a forward test

Next, forward test the fixed rules as new market data arrives, often in a demo environment. This checks whether you can identify the setup and follow the process without replay controls. It also exposes practical issues such as missed signals and the time needed to place orders.

Compare forward results with the backtest using the same definitions for costs, trade grouping and risk. Investigate differences before changing anything.

Demo fills are still not live fills, and historical success does not establish future profitability.

Keep the rules, trades and unresolved questions together. The journaling guide helps document decisions, while the R-multiples guide explains the risk units used in this example.

Questions

A little more
before you start.

How many trades should I backtest?

There is no universal count that proves a strategy works. Cover relevant conditions, retain unseen data and keep the sample size visible beside every statistic.

Can I change rules during the test?

You can develop a new version, but mark the change and test it separately. Mixing several rule versions into one result makes that result difficult to interpret.

Does a profitable backtest mean I should trade live?

A historical result leaves execution, changing conditions and your ability to follow the rules unresolved. Forward testing can investigate some of those gaps without treating the backtest as a promise.

Your next trade

Practice the decision.
Keep the evidence.

Start journaling

Start your journal free. Backtesting is included with Elite.