MT5 Custom Symbols: Where Backtest Data Comes From and How to Build Tick History You Can Trust

A backtest is only as honest as the price history under it. Most traders use whatever history their broker's terminal downloads, and for many tests that is the right choice. But broker history is often short, and sooner or later you want more: a longer period, a second source to compare against, or a cleaner dataset for research. In MetaTrader 5 (MT5), that means building a custom symbol.

Our guide to MT5 backtest data quality explains how to audit history once you have it: modelling modes, the history quality figure, gaps and spikes. This guide covers the step before that. Where the data comes from, how to put it on the right clock, how to join two feeds without hiding the join, and how to build and verify a custom symbol so it behaves like the account you will actually trade.

One point up front: a longer or cleaner history does not make a strategy more robust. It makes the test more informative. If the strategy fails on the extra years, that is the most useful thing the extra data can tell you.

Where backtest data comes from

There is no single official price history for spot FX or CFDs. Each source reflects its own liquidity, its own pricing and its own clock.

SourceTypical clockQuotesSpreadsMain caution
Your broker's terminal historyBroker server timeBid and ask in real ticksThe broker's own recorded spreadsOften limited depth, especially for real ticks
Another broker's terminal historyThat broker's server timeBid and askThat broker's spreadsDifferent feed, clock and symbol specification
Third-party historical datasetsOften UTC, sometimes another zoneSometimes bid only, sometimes bid and askMay be absent, averaged or aggregatedUnknown construction unless documented
Exchange-traded futures dataExchange timeTrades and quotes on a different instrumentExchange spreadsNot the same market: contract rolls, basis and session hours differ

Each row can be useful. None of them is "the market". The aim is to know exactly what each file is, and to make it match the conditions of the account you plan to trade as closely as you can.

Step 1: Decide what the test needs

Before downloading anything, write down what the strategy needs from its data.

  • Ticks or bars. A strategy with intrabar stops, tight targets or tick-level logic needs tick data with bid and ask. A strategy that acts only on completed bars, with no intrabar exits, may be tested adequately on one-minute bars. Our data-quality guide explains how to check that with one real-tick run.
  • Quote side. MT5 opens buys at the ask and sells at the bid. If your data has only one side, the other side will be modelled, and that model becomes an assumption of the test.
  • Depth. Enough history to cover different market conditions and enough trades for every out-of-sample window you plan to use.
  • Match to the live account. The clock, the symbol specification and the costs should match the account the EA will trade, or the differences should be known and tested.

Step 2: Record where every file came from

Keep a short manifest for every dataset. It takes minutes, and it saves hours when two backtests disagree months later.

  • Source and how it was obtained.
  • Instrument and the exact symbol name in the source.
  • Clock: the time zone, and whether daylight saving was applied.
  • Quote side: bid, ask, both, or trades.
  • Date range, and any known gaps.
  • Date downloaded, and any processing applied since.

Store the raw file untouched and do all conversion in a script. If a conversion turns out to be wrong, you can re-run it from the original rather than trying to undo it.

Step 3: Align time zones and daylight saving

This is where most custom-symbol problems start. A clock that is off by one or two hours changes where every daily and four-hour bar opens and closes, which changes the highs, lows and closes the strategy sees. Our guide to Python vs MT5 backtesting shows how that alone can change signals.

Server-time conventions

Brokers choose their own server clock. A common convention sets the server day to end at 17:00 New York time, so that each trading week has five daily bars and no short Sunday bar. In practice that means UTC+2 in the northern winter and UTC+3 in summer, switching on the US daylight-saving dates. Other brokers use a fixed offset, or follow European daylight-saving dates instead.

The US and Europe change their clocks on different weekends. For a few weeks each year, an offset that follows one region's rules is an hour away from one that follows the other's. A conversion that applies the wrong region's dates will be correct most of the year and wrong for those weeks, which makes the error easy to miss.

Converting from UTC

Do conversions from UTC wherever possible. UTC has no daylight saving, so it has no repeated or missing hours. Converting from a local time that observes daylight saving creates an ambiguous hour in autumn and a missing hour in spring.

This pandas sketch converts a UTC tick or bar index to the "New York close" server clock described above. It takes the New York wall-clock time and adds seven hours, which follows the US daylight-saving dates automatically.

import pandas as pd

def utc_to_ny_close_clock(index_utc):
    """UTC DatetimeIndex -> naive server-clock index (UTC+2 winter, UTC+3 summer, US DST dates)."""
    if index_utc.tz is None:
        index_utc = index_utc.tz_localize("UTC")
    ny_wall = index_utc.tz_convert("America/New_York").tz_localize(None)
    return ny_wall + pd.Timedelta(hours=7)

ticks = pd.read_csv("source_ticks_utc.csv", parse_dates=["time"]).set_index("time")
ticks.index = utc_to_ny_close_clock(ticks.index)

Only use this if your broker actually uses that convention. Check first.

Detecting a broker's offset

Do not rely on a broker's description of its server time. Measure it. Take hourly closes from your UTC source and from the broker's terminal over the same period, and for each week find the hour shift that lines them up best.

import pandas as pd

def weekly_offset(src_utc, broker, shifts=range(-6, 7)):
    """src_utc: hourly closes on a UTC clock. broker: hourly closes on the server clock.
    Both are pandas Series with naive DatetimeIndex. Returns the best shift (hours) per week."""
    rows = []
    for week, b in broker.groupby(pd.Grouper(freq="W-SUN")):
        if len(b) < 24:
            continue
        scores = {}
        for h in shifts:
            s = src_utc.copy()
            s.index = s.index + pd.Timedelta(hours=h)
            j = pd.concat([b, s], axis=1, join="inner").dropna()
            if len(j) > 20:
                scores[h] = (j.iloc[:, 0] - j.iloc[:, 1]).abs().mean()
        if scores:
            rows.append((week.date(), min(scores, key=scores.get)))
    return pd.DataFrame(rows, columns=["week_ending", "server_minus_utc_hours"])

Read the result as a timeline. A broker on the New York close convention shows +2 for most of the winter and +3 for most of the summer, with the switches on the US dates. A fixed-offset broker shows the same number all year. Weeks where the shift jumps around usually mean missing data in one of the two series, not a real change.

Step 4: Deal with quote side and spreads

If the source has both bid and ask ticks, keep both. The spread then comes from the data itself, which is the most realistic option.

If the source has only bid prices, the ask has to be built: ask equals bid plus a spread model. That model is now one of the most important assumptions in the backtest, so choose it deliberately.

  • A fixed spread is simple but understates costs at the session open, around rollover and during news.
  • A time-of-day profile is better: measure the broker's median spread for each hour of the week from its recent real ticks, and apply that profile to the older data.
  • A conservative profile goes further, using a high percentile rather than the median for each hour, which is a sensible choice for strategies that trade in the busiest windows.

Write the chosen model into the manifest. Then test the strategy with a wider spread profile as well, the same way our guide to the backtest vs live gap stresses costs. If the result depends heavily on the spread model, the old data cannot settle the question on its own.

Step 5: Splice two feeds without hiding the join

A common reason to build a custom symbol is to extend a broker's short real-tick history with older data from another source. Joining them is fine. Joining them invisibly is not.

  1. Put both feeds on the same clock first, using Step 3.
  2. Choose an overlap period where both sources have data, ideally several months.
  3. Compare the feeds over the overlap before deciding anything.
  4. Splice at a quiet point, such as a weekend, never in the middle of a trading session.
  5. Never blend the two feeds tick by tick or average them. Each part of the history should come from one source.
  6. Record the splice date and keep it in the manifest.

This function compares one-minute bars from two sources over their overlap.

def compare_overlap(a, b):
    """a, b: one-minute OHLC DataFrames on the same clock, covering the overlap period."""
    j = a.join(b, lsuffix="_a", rsuffix="_b", how="inner")
    diff = j["close_a"] - j["close_b"]
    return {
        "matched_bars": len(j),
        "bars_only_in_a": len(a.index.difference(b.index)),
        "bars_only_in_b": len(b.index.difference(a.index)),
        "median_close_diff": diff.median(),
        "p95_abs_close_diff": diff.abs().quantile(0.95),
        "avg_range_ratio_a_to_b": (j["high_a"] - j["low_a"]).mean() / (j["high_b"] - j["low_b"]).mean(),
    }

How to read it:

  • A median difference close to zero means the two feeds price the instrument at the same level. A steady offset suggests different pricing or quote side, for example mid prices against bid prices.
  • A large 95th-percentile difference with a small median means the feeds mostly agree but disagree sharply at times, usually during fast markets or thin hours.
  • A range ratio well away from 1.0 means one feed is noisier than the other. Strategies that use bar ranges, such as volatility filters or breakouts, will behave differently on each side of the splice.
  • Many bars present in only one feed usually means a clock or session-hours mismatch, not missing data. Recheck Step 3.

After the splice, run the strategy on each side separately as well as on the whole. If its behaviour changes sharply at the splice date, the change may come from the data rather than the market.

Step 6: Build the custom symbol

MT5 lets you create a custom symbol from the Symbols window and import bars or ticks into it, or do the same from MQL5 code.

  • Start from a copy of the broker's symbol, so the contract size, digits, tick size, tick value and trading hours begin from real values. MQL5's CustomSymbolCreate can take an existing symbol as the origin to copy its properties.
  • Check every cost setting: spread handling, swaps and commission. Then run a short test and confirm the costs appear in the results, rather than assuming the settings took effect.
  • Get the import format right. The simplest way is to export a few ticks or bars from an existing symbol and copy that layout exactly, including the date and time format and the column order.
  • Import ticks for tick-level tests. If you import only bars, MT5 can only generate ticks from them, and tests run on generated rather than real ticks.

From MQL5, a script can load your converted file and write it with CustomTicksReplace, which replaces ticks over a date range. That makes it easy to rebuild the symbol from your conversion script whenever the source or the conversion changes.

Step 7: Verify it against the broker's own symbol

Before any strategy test, check that the custom symbol behaves like the market you will trade, over a period where the broker has its own history.

  • Daily bars. Compare daily opens, highs, lows and closes. They should line up on the same days, with small differences only.
  • Bars per day. The number of bars each day, including whether a short Sunday bar appears, should match the broker's.
  • Spread profile. Compare the median spread for each hour of the week. A custom symbol with a flatter or tighter profile is a kinder trading environment than the real account.
  • The same EA on both. Run the strategy on the broker's symbol and the custom symbol over the overlap, then compare the trade lists trade by trade, as described in our Python vs MT5 guide. Matching summary statistics are not enough. The individual trades should broadly match.
  • The standard audit. Run the gap and spike checks from our data-quality guide on the whole custom history, including the older part.

Only when the custom symbol matches the broker's symbol over the overlap is it reasonable to trust it over the older period, where there is nothing to compare it with.

Common data-sourcing mistakes

  1. Not knowing the source's clock. An undocumented time zone is a guess, and every daily bar depends on it.
  2. Applying the wrong daylight-saving dates. The data is right most of the year and an hour out for a few weeks, so the error is easy to miss.
  3. Converting from local time instead of UTC. That creates duplicated and missing hours at each clock change.
  4. Treating bid-only data as complete. The ask is then a model, and the spread model drives the result.
  5. Splicing feeds without an overlap check. A level or volatility difference at the join can create or hide trades.
  6. Blending two feeds. Averaging sources produces a price history that no market ever traded.
  7. Leaving the custom symbol on default settings. Costs and contract details then rarely match a real account.
  8. Skipping the side-by-side test. If the EA trades differently on the custom symbol and the broker's symbol over the same period, the custom history is not ready.

Custom symbol checklist

  • Test requirements written down: ticks or bars, quote side, depth, target account
  • Manifest kept for every dataset: source, clock, quote side, range, processing
  • Raw files stored untouched, with all conversion done in a script
  • Source and broker clocks measured, including daylight-saving switches
  • All conversions done from UTC
  • Spread model chosen and recorded for any bid-only data, and stressed wider
  • Feeds compared over an overlap before splicing, with the splice date recorded
  • Custom symbol created from a copy of the broker's symbol, with costs checked in a test
  • Daily bars, bars per day and spread profile compared with the broker's symbol
  • Same EA run on both symbols over the overlap, with trade lists compared
  • Gap and spike audit run on the full custom history

Frequently asked questions

Can I import my own tick data into MT5?

Yes. Create a custom symbol, then import ticks or bars from a file through the Symbols window, or write them from an MQL5 script. Put the data on the broker's server clock first, and set the symbol's contract and cost settings to match your account.

Why do my custom symbol backtests differ from my broker's?

The most common causes are a clock or daylight-saving mismatch, a different quote side or spread model, and contract or cost settings that differ from the broker's symbol. Compare daily bars, bars per day and spreads over a period where both have data, then compare the trade lists.

How do I handle daylight saving in MT5 backtest data?

Work from UTC and convert to the broker's server clock using the same daylight-saving rules the broker uses. Measure the broker's offset week by week against a UTC source rather than assuming it, because US and European clock changes fall on different dates.

Is it safe to merge tick data from two sources?

It can be, if you put both on the same clock, compare them over an overlap, splice at a quiet point such as a weekend, and record where the join is. Never blend or average the two feeds, and test the strategy on each side of the splice separately.

Does a longer custom history make my backtest more reliable?

It makes it more informative, as long as the extra data is aligned and verified. It does not make the strategy itself more robust, and no amount of history predicts future market conditions.

Want a second pair of eyes?

Start with our free Sample Stress-Test Report. It walks one anonymized, illustrative strategy through a full stress test, start to finish, so you can see what rigorous validation looks like before you test your own.

Read the Sample Stress-Test Report

Want your own backtest checked? The Strategy Audit + 60-minute call is a paid service at a launch price of £100, credited in full against our build and portfolio offers. You send an MT4/MT5 Strategy Tester report or trade-list CSV; what we can check depends on the files you supply, and walk-forward and parameter sweeps are not included because they need the strategy itself. It is analysis of strategy testing, not investment advice, and does not promise any trading or evaluation outcome. See the Strategy Audit

Disclaimers

CollosoTrading provides educational content and analytical services for retail and professional algorithmic traders. We do not provide regulated investment advice, financial advice, or personal recommendations. Trading derivatives, leveraged products, and CFDs carries a high level of risk and may result in losses exceeding deposits. Past performance, including any verified or unverified historical results referenced on this site, is not indicative of future results. Consult an independent regulated financial adviser before making investment decisions.

All figures are backtests or simulations unless marked LIVE. Hypothetical or backtested performance results have inherent limitations and may not reflect actual trading. No representation is made that any account will or is likely to achieve profits or losses similar to those shown. Individual results vary. This article contains no performance figures from any strategy or account. We do not guarantee the outcome of any prop firm challenge.