
MT4 accepts CSV files through its History Center as long as the file matches MT4's expected column order: Date, Time, Open, High, Low, Close, and an optional Volume field. Go to Tools โ History Center (or press F2), pick your symbol and timeframe, and click Import. That's the whole process in one sentence.
Before you touch the import dialog, run through this:
- Strip any header row from the CSV. MT4 reads the first line as data, not labels.
- Confirm your separator (comma, semicolon, or tab) matches what you select in the import dialog.
- If you're loading years of history, raise Max. bars in history under Tools โ Options โ Charts, or MT4 will silently truncate what it loads.
If your file still won't load after that, the troubleshooting section below covers the usual suspects. If you need cleaner data or higher-fidelity backtests, skip ahead to the FXT/HST conversion section.
Key Takeaways
Successful CSV import into MT4 depends on exact column order, matching separators, and clean date/time formatting, while FXT conversion is what actually improves backtest accuracy.
| Point | Details |
|---|---|
| Column order is non-negotiable | MT4 requires Date, Time, Open, High, Low, Close, and optional Volume in that exact sequence. |
| Separator mismatch causes most failures | Check your file in a text editor before blaming MT4's import dialog. |
| Skip lines instead of guessing | Use the Skip lines option in the import dialog if you can't remove header rows manually. |
| CSV import has a ceiling | Strategy Tester needs FXT/HST files for realistic spread and execution modeling, not raw CSV. |
| Ready-made data cuts prep time | Backtestmarket's Nasdaq 1m dataset arrives pre-formatted for direct MT4 import or FXT conversion. |
Table of Contents
- MT4 CSV Import Format: Columns, Dates, and Separators
- Preparing Your CSV File Before Import
- How to Import CSV to MT4 Using the History Center
- Why MT4 CSV Imports Fail (and How to Fix Each One)
- When CSV Import Isn't Enough: Converting to FXT/HST
- What I've Learned Running CSV Imports for Backtesting
- Get Import-Ready Data Without the Cleanup Work
- Sources
MT4 CSV Import Format: Columns, Dates, and Separators
MT4's History Center is strict about structure. The official documentation specifies the required column order: Date, Time, Open, High, Low, Close, and Volume if you're including it. Get the order wrong and MT4 either rejects the file outright or imports garbage bars that ruin your backtest.
A valid row looks like this, based on a real working example from a forex import walkthrough:
2015.01.05,00:00,1.2511,1.2590,1.2492,1.2530,8515
Date uses YYYY.MM.DD format. Time uses 24-hour HH:MM. Some feeds combine both into a single timestamp column, which MT4 can still parse if you tell it to skip the right number of columns.
Separator note: MT4 supports comma, semicolon, space, or tab as the field separator, and this is documented directly in the History Center help page. The catch is regional settings. If your CSV comes from a European data source using a comma as the decimal separator (like 1,2530 instead of 1.2530), MT4 will misread your price data even if the column order is perfect.
- Save your file as plain CSV, not Excel's default XLSX.
- Use UTF-8 or ANSI encoding. Files saved with unusual encodings can introduce hidden characters MT4 won't parse.
- If you're planning to run a conversion script later, drop the CSV into your
MQL4/Filesfolder now. It saves a step.
Preparing Your CSV File Before Import
Getting the file import-ready takes five steps, and skipping any one of them is the most common reason a "successful" import produces broken charts.
- Remove headers and extra columns. Open the file in a plain text editor (not Excel, which can silently reformat dates) and delete the first row if it contains column labels like "Date, Time, Open."
- Reorder columns if needed. Some data vendors export Volume before Close, or bundle Bid/Ask separately. Match the exact MT4 order before saving.
- Normalize date and time formatting across every row. A single row with
01/05/2015mixed into a file otherwise formatted2015.01.05will break the import or corrupt that bar. - Handle timezone offsets. If your data source uses a different time zone than your broker's server time, use MT4's Time shift field during import rather than trying to manually reformat every timestamp.
- Convert decimal separators and re-save as plain text CSV. Then test with a 20 to 30 row sample before running the full file.
For the actual transformations, Excel or LibreOffice's Text to Columns feature handles date reformatting well. If you're comfortable with scripts, a short Python one-liner using pandas.read_csv() and to_csv() with explicit date formatting is faster for files with tens of thousands of rows.
Pro Tip: Always import a small slice of your data first, maybe one week's worth, before committing to a multi-year file. It takes thirty seconds and saves you from re-cleaning an entire dataset because of one formatting mistake in row one.
How to Import CSV to MT4 Using the History Center
Once your file is clean, the actual import inside MT4 is mechanical. Here's the exact sequence:
- Open Tools โ History Center, or press F2.
- Find your symbol in the left panel and expand it to see available timeframes.
- Select the timeframe that matches your CSV data (M1 for one-minute bars, for example).
- Click Import, then browse to your CSV file.
- Configure the import dialog: set Separator to match your file, use Skip columns if your CSV has extra fields MT4 doesn't need, and Skip lines if you couldn't remove headers beforehand.
- Set Time shift if your data's timestamps don't align with your broker's server time.
- Check Volumes if your file includes a volume column; leave it unchecked if it doesn't, or MT4 will misread the following column as volume data.
- Click Import, then OK to close the dialog.
Once it's done, verify the import actually worked. Check the timeline shown in History Center against your expected date range, then close and reopen the chart to force a refresh. Bar counts should roughly match what you'd expect for the date range and timeframe you imported.
If the chart looks unchanged, don't assume the import failed. MT4 sometimes needs a restart before new history data displays properly, especially on charts that were already open before you imported.
Why MT4 CSV Imports Fail (and How to Fix Each One)
Three issues account for most CSV import failures in MT4, according to recurring reports on the MQL4 community forum: separator mismatch, leftover header rows, and date/time format mismatches.
- Separator mismatch: Open the file in a plain text editor and look at one raw row. If MT4's import dialog is set to comma but your file uses semicolons, every field shifts and the import either fails or produces nonsense values.
- Header rows or extra columns: Use the Skip lines option in the import dialog if you can't easily strip the header, or remove it manually with a text editor first.
- Date/time format mismatches: If some rows use
MM/DD/YYYYand others useYYYY.MM.DD, MT4 will reject the file or misread specific bars. In Excel, use Text to Columns with a specified date format to force consistency across the whole column. In Python,datetime.strptime()with an explicit format string catches these instantly. - Locale and encoding issues: A decimal comma instead of a decimal point is the classic mistake with data from European vendors. Fix it with a find-and-replace pass before import, not after.
If your data checks out clean on all four points and the backtest results still feel off, especially around spreads and execution timing, that's usually a sign you've outgrown basic CSV import and need FXT/HST conversion instead.
When CSV Import Isn't Enough: Converting to FXT/HST
History Center imports work fine for chart analysis and quick strategy checks, but MT4's Strategy Tester doesn't actually run backtests off your CSV. It uses its own FXT and HST file formats, and a straight CSV import doesn't give you control over spread modeling or tick-level execution detail. That's the gap CSV2FXT conversion tools exist to close.
The high-level workflow:
- Install a CSV2FXT script (or a script from the open-source Birt-CSV2FXT repository) into your
MQL4/Scriptsfolder. - Drop your prepared CSV into
MQL4/Files. - Configure spread and timeframe settings inside the script before running it.
- Run the script to generate FXT and HST files MT4's Strategy Tester can use directly.
Here's where a ready-made dataset saves real time. Backtestmarket's Nasdaq 1m dataset comes pre-formatted for MT4 import, so you skip the column reordering and date normalization entirely and go straight to either a History Center import or FXT conversion. Backtestmarket has built minute-bar datasets since 2014, with engineers on hand if a conversion step trips you up.
Pro Tip: If you're testing a scalping or high-frequency strategy, don't rely on History Center imports for your final backtest. Convert to FXT first. Spread and execution modeling only kick in through that format.
What I've Learned Running CSV Imports for Backtesting
Quick CSV imports are fine for eyeballing a chart or confirming price action. For anything you're about to trade on, though, converting to FXT first is worth the extra fifteen minutes. Always run a small sample import before the full file to better understand live P&L verified results versus backtests. It catches formatting problems before they cost you a rebuild.
โ Start
Get Import-Ready Data Without the Cleanup Work
If you've made it this far, you already know the real cost of CSV import isn't the click sequence in History Center. It's the hours spent reordering columns, fixing date formats, and chasing down a stray semicolon in row 40,000. Backtestmarket's Nasdaq 1m dataset skips that entirely: clean minute-bar data, correctly ordered columns, and consistent date and time formatting from the first row to the last.
The dataset works either way, whether you want a straightforward History Center import for chart review or a full FXT conversion for Strategy Tester backtests. Every purchase includes access to Backtestmarket's converter tool and direct support from the engineers who built it, so a format question doesn't turn into a lost afternoon. Head to the Nasdaq 1m product page to download the dataset and get it running in MT4 today.
Sources
- History Center - Tools - MetaTrader 4 Help
- CSV2FXT conversion workflow (CSV2FXT product info)
- Historical data MetaTrader 4 - CSV file import
- EA31337/Birt-CSV2FXT
Recommended
- How to Import Data in MetaTrader (MT4 / MT5) | BacktestMarket | BacktestMarket
- How to Import Data in NinjaTrader | BacktestMarket | BacktestMarket
- Blog | BacktestMarket | BacktestMarket
- BTM Data Converter | BacktestMarket | BacktestMarket
Related resources
Explore BacktestMarket's Expert Advisor robots to put the ideas in this article into practice.

