Your Own Data

DocumentationMarkets

Your Own Data

Bars or ticks you already have, from your broker, from MetaTrader or from any other source, can be tested exactly like downloaded data, with their historical spread. They live under Data, Custom data, on an instrument you define yourself.

In three steps

  1. Add an instrument. Data, Custom data, New Symbol. Give it a symbol, the pip size, the contract size and the digits (MetaTrader shows them in the symbol's specification). A template fills the usual values for a forex pair, an index or a metal.
  2. Export bars or ticks. From MetaTrader 5, see the next section.
  3. Import the file on the instrument: drop it on the import box or pick it. The app sees whether it holds bars or ticks, shows a preview with the spread it found, and Use for runs sets the instrument, the range and the timeframe in Backtest.

From MetaTrader 5

Open View, Symbols (Ctrl+U) and pick the symbol.

Bars. The Bars tab, choose the timeframe and the range, Request, then Export Bars. The file is tab separated with <DATE>, <TIME>, <OPEN>, <HIGH>, <LOW>, <CLOSE>, <TICKVOL>, <VOL> and <SPREAD>. The date and the time are read together, the tick volume becomes the volume, and <SPREAD> gives every bar its spread.

Ticks. The Ticks tab, choose the range, Request, then Export Ticks. The file holds <DATE>, <TIME> (with milliseconds), <BID>, <ASK>, <LAST>, <VOLUME> and <FLAGS>. Date, time, bid and ask are read. MetaTrader leaves a side empty in a tick where only the other one changed; it keeps its last price.

Server time. MetaTrader writes the broker's server time, often UTC+2 or UTC+3. The app reads every time as UTC, so such a file is two or three hours off, and session filters and news windows move by the same amount. Shift the times to UTC before you import, or keep the offset in mind.

Bid, ask and the spread

The candles are the bid, as MetaTrader draws them: that is what a strategy reads and where a stop placed from a candle sits. Beside each candle the app keeps its ask, and every fill is priced on it: a buy at the ask, a sell at the bid.

  • Historical spread from bars. The <SPREAD> column is in points, one point being one unit of the last digit: at five digits 12 points is 0.00012, at three digits 0.012. The ask of each bar is its bid plus that spread. The preview shows the spread it read in points and in pips.
  • Historical spread from ticks. Ticks become one candle a minute: open, high, low and close of the bid, and beside them the bid and the ask of that minute. Every fill gets the real spread of its minute. Every higher timeframe is built from these minutes.
  • No spread in the file. Then the instrument's spread prices the fills. One number in Spread (pips) is a fixed spread; a second, higher number in Random up to (pips) draws a random spread between the two on every fill, the same way on every run of the same settings. With neither, a run is refused rather than filled at no cost.

Formats

WhatRead
FileCSV or TXT, UTF-8 or UTF-16 (as MetaTrader writes it), with a header row
Separatorcomma, semicolon or tab, found from the first line
Barstime, open, high, low, close by name (also <OPEN> and so on); volume and spread optional
Tickstime (or date and time), bid and ask; no open column
TimeISO 8601, 2024.01.15 08:30 (MetaTrader), a date column with a time column, unix seconds or milliseconds
Time zoneUTC unless the time carries its own offset
Timeframesbars M1 to D1, detected from the spacing; ticks become M1

A bar column the app does not recognise can be mapped by hand. A row with an unreadable time or price is skipped and counted, a tick with an ask below its bid too, a time that appears twice keeps the later row, and everything is sorted. Importing again adds to what is there.

Limits

  • A bar file is read at once; a tick file in pieces, so its size is not a problem, only its time: tens of millions of ticks take minutes.
  • The ticks themselves are not kept, only their minutes. The finest an imported tick file gives a backtest is one minute with its bid and ask; the Tick accuracy works on downloaded ticks.
  • A symbol is letters and digits, up to 16. A custom symbol named like a downloaded one shares its data folder: name your own MT5EURUSD rather than EURUSD.
  • Imported data stays on this computer. Runs on it are local runs; a server run cannot read it.
  • A run refuses a gap of more than four days at either end of a month it covers.
Orion Quant Technologies