MT4 historical data and how to use it for testing

MT4 historical data and how to use it for testing

The historical data of MetaTrader4 is an extended version of the price movement for a selected asset. This data showcases the minute-by-minute trend fluctuations going back almost 15 years.

Historical data records hold detailed price fluctuations for every product of any financial market, and they can be downloaded from MetaTrader's marketplace.

The historical data in MetaTrader allows users to perform more accurate backtesting using a larger volume of data for a specific asset.

"[With] 20 years of successful business in the field of technical solutions and industry support our platform today is an integral part for any brokerage business" - Demis Gavrielides

The download process is simple, yet a trader needs to be careful while dealing with this data, otherwise, the information it contains might become duplicated or just messed up altogether. You can download MetaTrader4 historical data using the following steps:

  • Removing the default dataset
  • Importing the historical data
  • Backtest

When you download the MT4 software for the first time, you will automatically have a dataset inserted into the trader. However, depending on where you download the MT4 from, you might need to import additional data sets, depending on what you are looking for.

The reason for this is that if you want to do backtesting, the current data that MT4 provides might not be sufficient, and the testing results will be less accurate.

To generate more accurate testing results you will need to get extended MT4 tick data. This data will provide you with the minimum price movement of an asset for a set period of time.

Remove the Default MT4 History


Let's start from scratch. First, you will need to clear the already existing data from MT4.

To do so, open the MetaTrader4 trading platform and log in.

Go to “Tools”. Next, select “History Center” from the drop-down tab, or simply hit the F2 key on your keyboard.


You will see a window with the MT4 history data of the assets provided by the broker. You will see candles that represent the price movements according to the timeframe you are going to select.


You can edit/delete candles individually if you want, but we do not recommend that because obviously, it is going to ruin the dataset that you have.


After you expand the Forex market tab from the panel on the left-hand side, you will see symbols for the currency pairs. Expand the currency pair you would like to import historical data for.

Select the timeframe you would like to import data for. In this case, we are importing MT4 tick data for the M1 time frame, which shows the one-minute price movement of the selected currency pair.

Now, we are going to delete this dataset and then we are going to import extended historical data.


To delete the dataset you will need to select all the candles that represent the price movements and click Delete at the bottom of the window.

You will then see that all the data we had is removed.

Import Historical Data

You need to make sure that you have the proper MT4 historical data file downloaded, and stored in the file location where MetaTrader is installed on your computer, and placed in the "History" folder.


Now, before we start importing MT4 historical data, we need to adjust the charting option to enable the representation of the maximum bars.

To do this go to Tools >> Option >> Charts and in the “Max bars in history” field type as many nines as possible, e.g 99999999999. The trader will understand this as the maximum possible and will import as much historical data as possible.


However, take into consideration that importing the maximum MetaTrader 4 history for a certain currency pair might take up a large portion of your computer's memory. So, if you are running low on memory you might need to limit the max bars shown in the history.

Now, go to the history center as we did at the beginning (Tools >> History center), and navigate to the symbol or the asset from which we have erased the datasets.

Here we are going to import the new data set by clicking “Import” at the bottom of the window. A smaller window will open up where you will set the configuration for the downloaded data.

The most important thing here is to select the file path for the download. Make sure you choose the right path.

Using the “Browse” button, find the folder where MetaTrader is located, then navigate to the “History” folder and select the correct file corresponding to the asset name that you are importing data from.

Hit “OK” and the data will shortly be imported into MetaTrader. You will need to close the MetaTrader4 platform and open it again for the changes to take effect.


Ensuring that the correct MT4 historical data is ready is very important because it will be used for setting the ground rules for the backtesting you are about to start doing. When you have checked to ensure that the correct data has been uploaded, we move on to the remaining steps which are much easier. This is where the fun begins.


The reason we do backtesting is simply to try out trading strategies based on historical price trends, and see how a specific strategy will work out before applying that to our trades.

Go to “View “ and then to ”Strategy Tester”. more options and drop lists will appear to select the parameters of your testing.

Select a testable element - for example the Expert Advisor, then select the currency pair that you are conducting your test on. This will be the same symbol for which we have imported the historical data.

After that, you will select the timeframe you want from the 7 options available. Then select the backtesting model from the 3 options available for that, and for accurate MT4 tick data, we select the “Every Tick” model.


Then we select the spread from the 6 available options, which are (2 - 5 - 10 - 30 - 50 - 100) pips. However, the best option is to keep it “Current”, because it will use the current spread offered for the selected currency pair.

In “Expert Properties”, you can enter information about opening your position such as the amount deposited, type of position, and the currency.

Hit “Start” and the backtesting will start working in the background. The process ideally takes a few seconds. However, it depends on the timeframe you select and how powerful your device’s processor is. The results will be shown in the tester window.

The outcome includes information about the number of winning/losing positions, the overall loss or profit for using this specific trading strategy, etc.

Traders prefer using this way of backtesting their strategy before implementing it in a real market situation. By doing that, traders can understand whether a strategy is profitable or not, or if it requires some enhancements.

Things We Learned About Using MT4 Historical Data

  • Backtesting on default MT4 historical data gives an inaccurate outcome
  • The default dataset needs to be removed before downloading new data
  • Importing a data set allows you to test trading strategies more accurately
  • Based on the parameters set in the expert advisor, the outcome can be 99% accurate


FAQ About Historical Data for Backtesting

Why is historical data important?

Historical data allows you to generate more accurate testing results. When backtesting is done on the default data of MT4 history, the testing outcomes might not be as accurate as they will be when conducting the same analyses on an extended set of data.

Why is backtesting important?

Traders do backtesting in order to try out different trading strategies, and their effectiveness on real data. However, since they cannot do it on a current data set, traders implement their trading strategies on historical datasets, and if the strategy shows that it has generated gains in the past, it is more likely to be beneficial in a current real market situation.

From where can I import historical data?

When you download the MT4 historical data, the program will automatically download data from MetaQuotes which is the marketplace of the trading software. However, you might find any other source for historical data with the file format .csv or .hst as you will be able to import these into the platform and use them for backtesting.

Can my broker’s historical data be used for backtesting?

Yes, some brokers provide customized historical data for the products they offer. This data comes in the form of downloadable files that can be found on the broker’s website. The files’ format is usually .csv or .hst, and you need to save them in the file location of MetaTrader, in the History folder. And then you can import it from the MetaTrader terminal.