Backtesting on Custom Symbols: Method and Pitfalls
Contents
MT5's "custom symbols" let you backtest on periods your broker doesn't provide, or on tick data obtained from outside sources. They're useful when you want to test over a longer period or compare results across multiple data sources.
Let me state the conclusion up front. What breaks most easily with custom symbols is not the tick data itself but the "symbol specification." If even one of digits, contract size, tick value, or swap differs from the broker you actually trade with, the backtest numbers will be something else entirely, no matter how accurate the data is. And in most cases, no error appears. You just get plausible-looking numbers.
How Custom Symbols Work
A custom symbol is a virtual symbol for which you supply both the "price data" and the "symbol specification" yourself.
- Price data: Import ticks (Bid/Ask/time) or 1-minute bars from CSV or similar
- Symbol specification: Number of decimal places, contract size, tick size, margin calculation method, swap, trading hours, and so on
The Strategy Tester applies the imported prices to this specification to calculate profit/loss and margin. So even when the prices are correct, if the specification is wrong, the entire profit/loss calculation drifts. This is why we're more wary of custom symbols than of regular ones: you get to define the specification yourself.
📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators
Right after you sign up, you get a download link for a subscriber-only pack of our 13 MT5 indicators: compiled files (.ex5), source code and a setup guide. Then 8 emails on algo-trading essentials, reading backtests correctly and choosing a broker (one a day for the first 5 days, then 7, 14 and 30 days after signing up). You also get notified before each price rise of the versions sold on the MQL5 Market (launch pricing that steps up as copies sell). Our EAs are free on this site with a live account at a partner broker.
* Privacy strictly protected. You can unsubscribe at any time.
Basic Steps for Creating and Importing
- Right-click in Market Watch → open "Symbols" and choose "Create Custom Symbol"
- Set "Copy from" to the same symbol at the broker you actually trade with (this is the most important step)
- Give the symbol a name (make it distinguishable from the original)
- Import tick CSV in the "Ticks" tab, or 1-minute bars in the "Bars" tab
- After importing, open the chart and visually check for gaps or abnormal values
- In the tester, select the custom symbol and run with "Every tick based on real ticks"
If you haven't yet covered the basics of MT5, setting up your environment first with the MT5 setup guide will make the work easier.
Items That Corrupt Results When Out of Sync
Even if you specify a source symbol to copy from, mismatches can occur if the format of the imported data doesn't fit, or if the broker changed its specification after you created the symbol. Here are the items we actually check.
| Item | What happens when it's off | How to check |
|---|---|---|
| digits (decimal places) | SL/TP distances specified in points end up off by an order of magnitude | Compare the digits of the imported data against the broker's symbol specification |
| Contract size | Profit/loss per lot is off by an order of magnitude (especially watch out for gold) | Calculate by hand the P/L of a 1-point move on 1 lot and compare |
| Tick size / tick value | The profit/loss calculation itself is off | Compare the values on the specification screen with the broker's symbol |
| Margin calculation method / leverage | Passes through situations that should have stopped on insufficient margin | Confirm the margin calculation mode matches |
| Swap (value, method, triple-swap day) | Cumulative P/L is badly off for EAs with long holding periods | Check the swap method, long/short values, and triple-swap weekday |
| Trading hours / time zone | Time-of-day filters and daily bar boundaries shift | Align the data's GMT offset with the server time |
| Presence of Bid/Ask | With Bid-only data, the spread may be treated as zero | Check that the imported ticks include Ask |
digits: The Hardest to Notice
For example, if you run an EA built for a 5-digit broker on a custom symbol created from 3-digit data, the actual price width of a "30-point SL" becomes 100 times larger. The EA keeps running without any error, so the results you get belong to a completely different strategy.
Contract Size: Accidents Are Common with Gold
How many ounces make up 1 lot of XAUUSD differs by broker. If you build the symbol by hand without using "Copy from," this can remain at the default value. Profit/loss becomes off by an order of magnitude, which undermines lot calculation and drawdown evaluation at the root.
Swap: The More Long-Held the EA, the More It Matters
For trend-following EAs with an average holding time of tens of hours, cumulative swap has a non-negligible effect on profit/loss. However, the swap on a custom symbol is a fixed value, so it can't reproduce how swap levels have changed in the past. We don't have a way to reproduce this accurately either. The results should be read with a margin of tolerance.
Limits and Cautions
Even if you match the specification carefully on a custom symbol, the following remain.
- Execution can't be reproduced: Slippage, order rejections, and sudden spread widening during economic releases won't be reflected in the test unless they're in the data.
- External data quality can't be fully verified: We can't fully know whether external ticks have gaps or have been filtered. It's quite normal for performance to change when you switch data sources.
- Price differences from the broker: There's no guarantee that the prices in external data match the feed from the broker you actually trade with. EAs with small price targets, such as scalpers, are more affected.
- The better the result, the more suspicious you should be: A specification mismatch can also work in the direction of making performance look better. When you get better numbers than expected, that's exactly when to re-check the specification.
In the end, custom symbols are a "tool for widening the scope of testing," not a substitute for testing on the broker's own data. We make a point of checking whether the results point in the same direction on both the broker's real data and the custom symbol.
The testing conditions for each EA are published on the individual pages of the measured ranking. We've also summarized our approach to testing in EA & MT5 know-how.
Summary
- What breaks most easily on custom symbols is the symbol specification, not the data
- When creating one, always set the same symbol at your trading broker as the copy source
- Check digits, contract size, tick value, swap, and time zone every time
- Calculating P/L per 1 lot and 1 point by hand is the quickest way to verify
- Swap history, execution, and slippage can't be reproduced
- If the results look too good, suspect a specification mismatch first
Related
📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators
Right after you sign up, you get a download link for a subscriber-only pack of our 13 MT5 indicators: compiled files (.ex5), source code and a setup guide. Then 8 emails on algo-trading essentials, reading backtests correctly and choosing a broker (one a day for the first 5 days, then 7, 14 and 30 days after signing up). You also get notified before each price rise of the versions sold on the MQL5 Market (launch pricing that steps up as copies sell). Our EAs are free on this site with a live account at a partner broker.
* Privacy strictly protected. You can unsubscribe at any time.
Have a question about EAs or FX?
You can post it on the Nattzy trading forum (free sign-up). Questions beyond this article are welcome too — EA settings, choosing a broker and more.
Ask on Nattzy ↗