MetaTrader 5: Custom Symbols with Kibot Stock and Futures History

Most MetaTrader brokers are short on US stock and futures history. MetaTrader 5 lets you create a custom symbol and load your own bars or ticks into it, and then chart it and run the Strategy Tester on it. Kibot does not export in MetaTrader's layout, so there is one conversion step, and this guide gives you a script for it. Custom symbols are for charts, indicators and the Strategy Tester only; you cannot place real orders on them. The file layouts follow MetaTrader's own "Custom Financial Instruments" help page.

1. What you get

MetaTrader stores history as 1-minute bars and builds every other time frame from them, so 1-minute data is the natural thing to load. You can also load ticks. Prices are exactly as in the Kibot file (adjusted or not, as you ordered them), and futures continuous contracts are unadjusted, so there is a price jump at each roll (see Continuous Futures).

2. Order the data

In the custom order builder, choose Stocks and ETFs or Futures, the symbol, and the 1-min interval (or Tick + bid/ask if you want ticks). Keep the Kibot CSV output format. If you are testing a stock strategy over years, think about the adjustment setting first; the adjustments page explains the options.

3. The two layouts

MetaTrader's help page gives the layout for a 1-minute bar file as Date, Time, Open, High, Low, Close, TickVolume, Volume, Spread, with dates written as 2016.06.27. Kibot's 1-minute file has seven columns. Real ES rows, Kibot first, then the same minutes as the script below writes them (tab separated):

09/15/2026,09:30,7684.5,7687,7681,7682,11087
09/15/2026,09:31,7682,7683.25,7674.25,7674.75,7129

2026.09.15	09:30:00	7684.5	7687.0	7681.0	7682.0	11087	11087	0
2026.09.15	09:31:00	7682.0	7683.25	7674.25	7674.75	7129	7129	0

For ticks, the help page layout is Date, Time (with milliseconds), Bid, Ask, Last, Volume. Kibot's tick-with-bid/ask file is Date, Time, Price, Bid, Ask, Size, so the columns are rearranged. MetaTrader's help page says not to include tick flags and that values less than or equal to zero are not imported.

4. Convert 1-minute bars (script, tested)

import sys
import pandas as pd

src, dst = sys.argv[1], sys.argv[2]
df = pd.read_csv(src, header=None, dtype={0: str, 1: str},
                 names=["d", "t", "o", "h", "l", "c", "v"])
ts = pd.to_datetime(df["d"] + " " + df["t"], format="%m/%d/%Y %H:%M")
out = pd.DataFrame({"Date": ts.dt.strftime("%Y.%m.%d"), "Time": ts.dt.strftime("%H:%M:%S"),
                    "Open": df.o, "High": df.h, "Low": df.l, "Close": df.c,
                    "TickVolume": df.v, "Volume": df.v, "Spread": 0})
out.to_csv(dst, sep="\t", index=False, header=False)

Run on the IBM sample it turned 24,554 Kibot bars into 24,554 MetaTrader lines. Two choices in it are mine, not MetaTrader's: Kibot's volume goes into both TickVolume and Volume (Kibot volume is traded shares or contracts, not a count of ticks), and Spread is 0 because a bar file has no spread. Change either if your tester needs something else.

5. Convert ticks (script, tested)

import sys
import pandas as pd

src, dst = sys.argv[1], sys.argv[2]
df = pd.read_csv(src, header=None, dtype={0: str, 1: str},
                 names=["d", "t", "price", "bid", "ask", "size"])
ts = pd.to_datetime(df["d"] + " " + df["t"], format="%m/%d/%Y %H:%M:%S")
out = pd.DataFrame({"Date": ts.dt.strftime("%Y.%m.%d"), "Time": ts.dt.strftime("%H:%M:%S.000"),
                    "Bid": df.bid, "Ask": df.ask, "Last": df.price, "Volume": df["size"]})
out.to_csv(dst, sep="\t", index=False, header=False)

Run on the IVE sample (40,703 ticks), the first rows were:

2026.09.09	09:30:00.000	233.79	233.99	233.99	11606
2026.09.09	09:30:01.000	233.63	233.99	233.9	100

Kibot's standard tick file has one-second timestamps, so the milliseconds are filled with zeros and several ticks share a stamp. MetaTrader's help page says several identical ticks are allowed on import, in earlier-to-later order, which a Kibot file already is.

6. Create the custom symbol

From MetaTrader's help page:

  1. Open the symbol management window from the Market Watch context menu and click Create Custom Symbol.
  2. Choose a name. It may contain Latin letters and the characters ., _, & and #, and must not match a symbol your broker provides (if you connect to a server that has a symbol with the same name, the custom symbol is deleted). Something like ES_KIBOT or IBM.K fits those rules.
  3. Optionally use "Copy from" to start from a similar instrument, then set the digits and tick size to suit the instrument (ES moves in 0.25 steps, a stock in 0.01).

Set these before importing. The help page warns that changing tick size, tick value, point value, accuracy or chart mode afterwards deletes the symbol's minute and tick history.

7. Import the history

  1. Select the custom symbol, then open its Bars tab (or Ticks tab for tick data).
  2. Choose Import, give the path to the converted file and set the separator to tab. Leave the skipped columns and rows at 0, since the converted files have no header.
  3. Set Shift (a time shift in hours) if your history must line up with a particular time zone. Kibot times are US Eastern by default, and MetaTrader's help page does not say what time zone it assumes for a custom symbol's data, so decide what you want your tester to see and test on one day. You can also order the data in UTC or another whole-hour offset in the builder instead of shifting.

Importing replaces the history in the date range the file covers, even if the file has less data than what was there. Two bars with the same minute inside the imported file count as an error, so remove duplicates first. A second import over an overlapping range replaces what the first one loaded for that range.

8. Test

Open an M1 chart of the custom symbol and check one bar against your file. The help page says other time frames are built from the M1 bars, so check M5 or M15 as well. Then, according to MetaTrader's documentation, the Strategy Tester can run on a custom symbol; it also notes that for futures and stock margin types the tester needs a currency pair to convert the instrument currency into the deposit currency, and that MQL5 Cloud Network optimization cannot be used with custom symbols.

Get the data

Price a slice in the custom order builder; the price is shown before you pay. Layouts: data format reference.

All guides