
MetaTrader 5 accepts CSV data through its Custom Symbols feature, and the one rule that determines whether your import works or fails is formatting: dates as YYYY.MM.DD with times as HH:MM:SS and a period as the decimal separator. Get that right, create a Custom Symbol, and open the Bars or Ticks import dialog. Everything else is cleanup.
TL;DR:
- Correctly formatted CSV files must use the date format YYYY.MM.DD, times as HH:MM:SS, and periods for decimal points to ensure successful import.
- Deviating from the required column order or file format, such as using comma decimals or headers, is the main reason imports produce errors or garbage candles.
- For large histories, splitting CSV files by year or month improves import reliability and avoids slowdowns or failures during processing.
- Using ready-made datasets from BacktestMarket eliminates common formatting issues, as they are pre-structured for immediate import without adjustments.
- Import errors related to date formats, decimals, file size, or timezone mismatches can be quickly fixed with simple spreadsheet edits or by adjusting import parameters.
Table of Contents
- Preparing your CSV: columns, date formats, and file size
- Step by step: creating a custom symbol and importing bars or ticks
- Fixing the import errors you will actually see
- Verifying the import actually worked
- Skipping the cleanup with ready-to-import datasets
- M1 or ticks: the practical tradeoff
- Where to get data that imports cleanly the first time
- Where to check the official rules yourself
- Sources
- FAQ
Preparing your CSV: columns, date formats, and file size
MT5 expects bar data in a fixed column order: Date, Time, Open, High, Low, Close, TickVolume, Volume, Spread. Tick files follow a similar but separate layout. The MetaTrader 5 help documentation specifies this order exactly, and deviating from it is the most common reason an import silently produces garbage candles instead of an error message.
A few rules matter more than the rest:
- Dates must read YYYY.MM.DD and times HH:MM:SS in 24 hour format, with no AM/PM markers.
- Decimal values use a period, never a comma, regardless of where the data originated.
- The file should have no header row and should be saved as UTF-8 without a byte order mark.
- Volume fields need to be whole numbers, not decimals, or MT5 will reject the row.
The column order and date format requirements come directly from MetaTrader 5's own documentation, which means there is no ambiguity to troubleshoot around, only compliance.
If your source data uses comma decimals or a different date order, fix it before touching MT5. A text editor with column-aware find and replace, or a spreadsheet formula that rebuilds the date string, handles most of this in a few minutes. For very large histories, split files by year so each import stays manageable and easier to debug if something goes wrong. Our MT4 CSV import guide covers the same cleanup steps in more detail, since the formatting rules carry over almost unchanged between platforms.
Step by step: creating a custom symbol and importing bars or ticks
Once your CSV is clean, the import itself is a short sequence inside MT5.
- Open the Market Watch window, right click, and choose Symbols, then Custom, then Create to start a new custom symbol.
- Set the basic properties: digits (decimal precision), contract size, and the group the symbol belongs to, matching what your broker or dataset uses for that instrument.
- Open the new symbol's properties, go to the Bars or Ticks tab depending on your file type, and click Import.
- In the import dialog, set the Separator to match your file (usually comma), configure Skip columns or rows if your file has extras, and set the Shift value if your data's timezone does not match your terminal.
- Use the "Use selected only" option if you want to import a highlighted subset rather than the whole file, then preview the first rows before confirming.
- Click Start to run the import, then check the row count against your source file.
The release notes covering custom symbol creation document these exact dialog parameters, including how the Shift value works as a time offset in hours rather than a full timezone conversion. New imports overwrite existing history for the same date range, so re-importing a corrected file is safe and expected. Custom symbol data is stored separately from broker-fed symbols, which keeps your imported history isolated from the terminal's live feeds.
Pro Tip: Import a one week sample first and check it on the chart before committing to a multi-year file. It takes two minutes and saves you from discovering a formatting error after a ten minute import.

Fixing the import errors you will actually see
Most MT5 CSV problems fall into four categories, and each has a quick fix.
- "Invalid date format" almost always means your dates are not in YYYY.MM.DD order. Rebuild the column with a spreadsheet formula or text editor before retrying.
- Comma decimal separators break numeric columns without throwing an obvious error. Use a column-aware replace (not a blanket find and replace, which can corrupt comma-separated fields) to swap commas for periods only inside numeric columns.
- Files that are too large to import in one pass should be split by year or month. MT5 handles CSV imports most reliably when file size stays manageable, a constraint confirmed by MetaTrader 5's tick storage documentation, which notes that tick data is stored by month precisely because full histories get unwieldy otherwise.
- Timezone mismatches show up as candles that look shifted on the chart compared to what you expect. Adjust the Shift parameter in the import dialog and compare a known session's open and close times against your source.
Verifying the import actually worked
Confirming the import is correct takes a few minutes and prevents wasted backtests later.
- Open the custom symbol's chart and manually check two or three timestamped rows from your CSV against the candles MT5 drew for those same times.
- Run a short Strategy Tester backtest over a recent week or month to confirm higher timeframe bars aggregate correctly from the imported data.
- Check that M1 data is present across your full date range, since MT5 builds every higher timeframe from one-minute bars. If your strategy depends on tick-level fidelity, import tick files instead of relying on M1 alone.
- Before any bulk import, export and back up your existing history so an overwrite does not cost you data you cannot easily rebuild.
Pro Tip: If you want a second check on execution quality once your data is loaded and a strategy is running, a resource on verifying trading performance walks through validation methods worth applying alongside your own chart checks.
Skipping the cleanup with ready-to-import datasets
Formatting a CSV by hand works, but it is also where most import errors originate. BacktestMarket builds minute-bar historical datasets already structured to MT5's column order, date format, and decimal convention, so the Custom Symbols import dialog accepts them without the usual back-and-forth.
- Datasets are formatted for direct use in the Bars import tab, with no decimal or date conversion needed.
- The EURUSD Pack is one example, covering clean minute-bar history for that pair formatted for immediate import.
- Support comes directly from the data assemblers, for anyone who hits an import question specific to their setup.
| What you handle yourself | What a prepared dataset handles |
|---|---|
| Date and time reformatting | Already in YYYY.MM.DD and HH:MM:SS |
| Decimal separator conversion | Already period-based |
| File splitting for size limits | Pre-structured by instrument |
| Verifying column order | Matches MT5's required order from the start |
M1 or ticks: the practical tradeoff
M1 bars are enough for most strategies and are what MT5 uses to build every higher timeframe, so they are the minimum worth importing. Tick data adds microstructure detail that matters for execution-sensitive systems, at the cost of far larger files and slower tests. Keep backups and organize imports by symbol and year to avoid confusion later.
— Start
Where to get data that imports cleanly the first time
If you would rather spend your time testing strategies than reformatting spreadsheets, BacktestMarket's Historical Data library covers forex, metals, bonds, and stock indices in the same ready-to-import structure.
- The EURUSD Pack gives you clean minute-bar history for that pair without touching a single date field.
- An Annual Plan at €119 per year covers ongoing access if you work across multiple instruments and update your data regularly.
- Expert Advisors and Indicators are available for traders who want to automate testing once the data is loaded.
Buy a dataset and it drops straight into the Custom Symbols import dialog, no Shift adjustments or decimal fixes required. If anything looks off after import, support comes from the engineers who built the dataset.
Where to check the official rules yourself
- MetaTrader 5's Custom Symbols help page documents the exact column order and date format for imports.
- MQL5's article on history import and export shows sample CSV layouts you can use as a formatting template.
- Our guide to importing historical data in MetaTrader 4 and 5 walks through the interface with screenshots for both platforms.
Sources
- Custom financial instruments - MetaTrader 5 Help
- Creating history and import/export examples - MQL5 article
FAQ
How do I import a CSV file into MT5?
Create a Custom Symbol in MT5, open its properties, go to the Bars or Ticks tab, and use the Import option to load your CSV. Your file needs the correct column order and date format specified in MetaTrader 5's documentation before the import will succeed.
Why is my CSV not importing correctly into MT5?
The most common causes are a wrong date format, comma decimals instead of periods, or columns in the wrong order. Checking your file against the exact format MT5 requires resolves most import failures without needing to recreate the file from scratch.
How do I both import and export CSV data in MT5?
Export existing history by right clicking a symbol's chart, choosing Save As, or using the Symbols dialog to export to CSV, which also gives you a correctly formatted template. Import works the same way in reverse through the Custom Symbol's Bars or Ticks import tab, as shown in MQL5's walkthrough of the process.
How do I import a CSV file in TradingView?
TradingView handles CSV import differently from MT5, generally through its own data import tools within chart settings rather than a Custom Symbols system. If your goal is backtesting in MetaTrader 5 specifically, the Custom Symbols workflow described above is the relevant path rather than TradingView's import process.
What is the maximum file size MT5 can import from a CSV?
MT5 does not publish a single hard limit, but very large files slow down or fail during import, which is why splitting data by year or month is standard practice. Tick files in particular grow large fast, since MetaTrader 5 stores tick history by month rather than as one continuous file.
Recommended
- How to Import CSV Data Into MT4 for Backtesting
- Fixing MT4 Missing Data: A Complete Recovery Guide
- How to Import Historical Data in MetaTrader 4 & 5
- Audit First MT5 Backtesting Data: Gap, Timestamp, Ready to Import
Related resources
Explore BacktestMarket's how to import data into MetaTrader to put the ideas in this article into practice.

