Now you are reading
Historical data MetaTrader 4 - CSV file import

Historical data MetaTrader 4 - CSV file import

created Paweł Mosionek18 Września 2017

Historical data MetaTrader 4 / 5

We very often encounter a situation in which our broker provides a limited range of historical quotes of financial instruments on its platform. If we want to make an analysis in a very long term or, more often, to check the effectiveness of our system, we need access to at least several years of history. In one of the previous articles, I described how we can extend the scope of data using quick methods and by importing data from an ECN broker - Dukascopy.

Read: Extending chart history on MT4 and Dukascopy tiki data

This time I will describe another method - importing data from other external sources from files in CSV format.

Where to get historical data from MetaTrader

This task is both simple and difficult at the same time :-). There is everything in the network. There are also quite websites that provide historical data. By entering the appropriate phrases without any problem you will find such services as:

The files are available for download for free, however, before you start testing, perform data quality checks and check their correctness at random.

Data format

The data must be in the appropriate format - most often it is the CSV or TXT extension. There is also a second condition. If you want to use them on the MT4 / 5 platform, individual elements must be saved in the correct order. It should look like this: 2015.01.05,00:00,1.2511,1.2590,1.2492,1.2530,8515.

This is the record for a single candle for the daily chart. In turn, it is the quote date, candle opening time, OHLC instrument price (open - high - low - close), volume (number of ticks). Everything separated by commas, no spaces. If we come across data that looks different, we have a problem. However, it is often possible to deal with it, e.g. by changing period separators (sometimes separators are dots instead of commas, which can be easily changed in Excel) or by removing redundant columns.

Sometimes, the surgery is a bit more complicated though. This is the case, for example, if you want to use the data from the website. However, there is a simple but quite labor-intensive way to use them on MT4. Detailed instructions on the conversion can be found on the website

How to add data to MetaTrader

If we have prepared files in the right format, the task becomes very easy. We start the platform, and then go to History Center (F2) from the tab Tools.

historic metatrader data

Then we look for the instrument to which we want to import our file and double-click on it, which results in expanding the list of intervals. If you've never been here before, don't be surprised that the window is empty and all values ​​are "gray". Only double-clicking on a given interval causes that any data will be shown to us. The next step is to choose the Import option.

history date mt4

In this window, we need to select the file in .csv (or .txt) format. We also have the option of truncated data editing, such as time offset, disregarding the volume or separator settings. If everything is ok, then we approve by clicking Ok and we are enjoying our new, prolonged history of quotes on the charts.

What do you think?
I like it
Heh ...
I do not like
About the Author
Paweł Mosionek
An active trader on the Forex market since 2006. Editor of the Forex Nawigator portal and editor-in-chief and co-creator of the website. Speaker at the "Focus on Forex" conference at the Warsaw School of Economics, "NetVision" at the Gdańsk University of Technology and "Financial Intelligence" at the University of Gdańsk. Twice winner of "Junior Trader" - investment game for students organized by DM XTB. Addicted to travel, motorbikes and parachuting.

Leave a Response