QuantForge
en

Importing price history

Backtests run on history you bring yourself, usually exported from your own broker’s MetaTrader. That keeps results close to what MetaTrader’s tester shows for the same account, and your data stays private: it is stored for your account only and used only for your backtests.

M1 (one-minute) bars are best. The tester builds every higher timeframe from them and uses them to simulate prices inside each bar.

Practice data

Every account also has a year of simulated M1 history for EURUSD, GBPUSD, XAUUSD and US500, listed as Practice data (simulated). Use it to learn the tester and to check that a strategy does what you meant before you import anything. QuantForge generates these prices: they have quieter and busier sessions, news spikes, weekend gaps and wider spreads at rollover, but no real-market patterns, so results on them say nothing about live trading. On the free plan, practice data also runs on M5 and M15.

  1. Download the export script, QuantForge_HistoryExport.ex5, from the Market data page or the Strategy Tester. It is ready to run; the .mq5 source is offered too.
  2. In MetaTrader 5, open File → Open Data Folder → MQL5 → Scripts and copy the script there.
  3. Using the .mq5 source instead? Press F4 to open MetaEditor, open the script and press Compile (F7). MetaTrader only lists compiled programs.
  4. Set Tools → Options → Charts → Max bars in chart to Unlimited and restart MetaTrader. Otherwise exports stop at about three months of M1.
  5. In the Navigator, drag Scripts → QuantForge_HistoryExport onto any chart, enter the symbols (for example EURUSD,XAUUSD) and the number of years, and press OK.
  6. Import the files from MQL5 → Files → QuantForge on the Market data page, or drop them into the Strategy Tester, which imports them and switches the backtest to them.

The script writes the symbol’s digits, contract size and broker into each file, so the import needs no extra details.

Without the script

  • MetaTrader 5: View → Symbols → Bars, choose M1 and a date range, Request, then Export Bars.
  • MetaTrader 4: Tools → History Center, pick the symbol and M1, then Export.

These files carry no contract details, so check the digits and contract size on the review step before importing.

What the importer checks

Before anything is stored you see the detected symbol, timeframe, digits and contract size, and you can correct them. Duplicate bars are dropped, unreadable rows are reported, and gaps of an hour or more during trading days are listed so you can judge them. History is stored month by month; importing the same symbol again merges the new months in.

Once you press import, the upload carries on while you use the rest of the app; a small panel in the corner shows its progress. Only closing or reloading the tab stops it (the months already stored are kept).

Spread

MetaTrader’s exports include the spread of each bar, and the tester uses it by default. Histories without a spread column use the fixed spread set in the tester.