Hidden Costs in Your Backtests: Spread, Swaps and Commissions

Hidden Costs in Your Backtests: Spread, Swaps and Commissions

3 November 2026, 18:13
Tamara Garcia Infantes
0
28



This article is for informational and educational purposes only. It does not constitute financial advice or an investment recommendation. Trading in financial markets carries a high risk of loss.

Introduction

A backtest can look profitable and still lose money in live trading. One of the most common reasons is costs: spread, commission and swap are small on each trade, but they are paid on every trade, and over hundreds of trades they can absorb most of a strategy's edge.

This article is divided into three sections. The first explains the three costs and how each one is paid. The second shows how much they can change a strategy's results. The third covers how to check them in the MetaTrader 5 Strategy Tester.

1. The three costs of a trade

Spread, commission and swap

Cost When it is paid What it depends on Where to see it in MT5
Spread On every trade, at entry Symbol, broker, account type and time of day Market Watch and symbol specification
Commission On every trade, per lot Broker and account type Broker's conditions and the trade history
Swap For each night a position stays open Symbol, direction (long or short) and interest rates Symbol specification (swap long and swap short)

Conditions vary by broker and account type. Always check your own symbol specification and account conditions.

The spread changes during the day

The spread shown in Market Watch is the spread at that moment. On most currency pairs it is tightest during the main sessions and widens around the daily rollover, when liquidity drops.

Figure 1. Average spread by server hour (illustrative)

A strategy that opens trades near the rollover pays a much higher spread than the average suggests. The same happens around major news releases.

Swap: the cost of holding overnight

The swap is applied to every position open at the daily rollover. It can be negative or, on some symbols and directions, positive. Two details are easy to miss:

  • Triple swap day: one day of the week is charged three times to cover the weekend. The day depends on the symbol and is shown in the symbol specification.
  • Swaps change over time: they follow interest rates, so the swap paid today may be very different from the one paid a few years ago.

For intraday strategies the swap is usually irrelevant. For swing strategies that hold positions for days or weeks, it can become the largest cost.

2. How costs change the results

A small edge disappears quickly

The effect of costs is easiest to see by comparing the same trades with and without them. The strategy below wins 43% of its trades with a 1:1.5 ratio, slightly above its breakeven win rate of 40%.


Figure 2. The same 500 trades with and without costs (simulated)

Without costs, the result is +37.5R. With costs of 0.12R per trade, it ends at −22.5R. The trades are identical; only the cost per trade has changed. As explained in the article on risk/reward and win rate, costs raise the breakeven line, and a strategy with a thin margin above it is the first to fall below.

Costs in R: why timeframe matters

To compare strategies, it helps to express costs as a fraction of the risk per trade:

Cost in R = Total cost per trade ÷ Stop distance


Figure 3. The same cost as a fraction of R on different timeframes (illustrative)

A cost of 1.2 pips is 1.5% of R with an 80-pip stop, and 20% of R with a 6-pip stop. Strategies on low timeframes, with tight stops and small targets, need a much larger edge just to cover their costs.

Step-by-step example: cost per trade of a swing strategy

Suppose a strategy on EURUSD that trades 1 lot, holds positions for about four nights and earns an average of 50 USD per trade before costs.

Step Calculation Result
1. Average trade before costs From the backtest 50 USD
2. Spread 0.8 pips × 10 USD per pip 8 USD
3. Commission 7 USD per lot, round turn 7 USD
4. Swap 4 nights × 6.5 USD 26 USD
5. Total cost per trade 8 + 7 + 26 41 USD
6. Average trade after costs 50 − 41 9 USD

Illustrative values. Spread, commission, swap and pip value depend on the broker, the account and the date.

Costs take 82% of the average trade, and the swap alone is larger than the spread and the commission together. If the swap rate rises, or the strategy holds positions one or two nights longer, the edge is gone.

3. Checking costs in the MT5 Strategy Tester

What the tester includes

  • Spread: with the modelling mode "Every tick based on real ticks", the tester uses the spread recorded in the broker's tick history. In other modes, it uses the spread stored with the price bars, which may not reflect short spikes such as the rollover.
  • Commission: the tester applies it only if the broker has configured it on the server for your account type. Check the Commission column in the Deals list of the report: if it shows zero but your account pays commission, you have to add it yourself.
  • Swap: the tester applies the swap values currently set in the symbol specification to the whole test period. A test over several years therefore uses today's swap rates for past trades, which can make old results look better or worse than they really were.
  • Execution: the Delays option in the tester settings allows simulating execution delays instead of ideal execution.

Measuring the margin for extra costs

The Expected Payoff in the report is the average result per trade after the costs the tester has applied. It is also a simple measure of how much extra cost per trade the strategy can absorb before it stops being profitable.

If a strategy trading 1 lot has an Expected Payoff of 12 USD, any additional cost above 12 USD per trade, such as a wider spread or a commission the tester did not apply, turns it into a losing strategy. The smaller this margin compared with the spread, the more fragile the result.

Common mistakes

  • Testing with a fixed, optimistic spread. The real spread is wider at rollover and during news.
  • Assuming the tester includes the commission. Check the Commission column in the report.
  • Ignoring swaps on swing strategies. On positions held for days, they can be the main cost.
  • Comparing results from different brokers without checking their costs. The same strategy can be profitable with one and not with another.
  • Optimising on a strategy with a very small average trade. A small change in costs decides whether it works.

Conclusions

  • The three costs: spread, commission and swap are paid on every trade or every night. The spread changes during the day, and the swap depends on the direction, the triple swap day and interest rates.
  • Their effect on results: costs can turn a small edge into a loss. Expressed in R, they weigh much more on low timeframes, and on swing strategies the swap can be the largest cost.
  • Checking them in MT5: real ticks give the most realistic spread, but commission and swap need to be verified in the report. The Expected Payoff shows how much extra cost the strategy can absorb.

A backtest is only as realistic as the costs it includes. Checking them before trusting a result avoids many unpleasant surprises in live trading. Test any strategy with your own broker's data on demo or in the Strategy Tester, and combine it with disciplined risk management.

References

  • MetaTrader 5 Help: Strategy Tester, tick generation modes, testing settings and the testing report.
  • MQL5 Reference: symbol properties (SYMBOL_SPREAD, SYMBOL_SWAP_LONG, SYMBOL_SWAP_SHORT, SYMBOL_SWAP_ROLLOVER3DAYS).

Disclaimer

This content is for informational and educational purposes only. It does not constitute financial advice or a recommendation to buy or sell any instrument. Backtest results are not a forecast. The charts and examples are illustrative, and every asset and every broker is different. Trading forex, CFDs and other leveraged products carries a high risk of loss. Every trading decision, and its outcome, is the sole responsibility of the reader. The author accepts no liability for any loss arising from the use of this information.