History of quotes for MetaTrader 4

A detailed check of the operability of the investigated trading tactics in the strategy tester MetaTrader 4 (MT4) requires the quotation history of a particular trading instrument. The deeper and more complete is the quotation history, the more market situations can be simulated.

Available depth stories in MT4 is measured in candlesticks (bars). By default, the number of available historical bars in the terminal is set to 512 000 (main menu item "Tools" -> "Settings", tab "Charts"), and the maximum visible in the window is 65 000 (see Figure 1).

History of quotes for MetaTrader 4

Fig. 1. MetaTrader 4 terminal settings.

This amount of history is quite enough if we are talking about large timeframes: monthly, weekly, daily. The lack of data will be felt especially sharply on small timeframes, for example, on the minute (M1), for which 65 000 bars - a month and a half.

It should be noted that M1 timeframe is basic for all timeframes, because, having data on the M1 timeframe, you can synthesize the history of quotes for any other timeframe, even non-standard. Apart from that, M1 timeframe allows you to consider in detail the process of formation of a candle of a larger timeframe. If there is no detailed minute history for, for example, an hour candle, we can only guess about the development of the situation inside it. During the testing of strategies for such candlesticks, the simulation of minute candlesticks is performed, which can be close to the truth, but does not give an absolute accuracy in the reproduction of real events. For this reason it is important to have as deep as possible rate historydetailed to the level of M1 timeframe.

Getting Quotes History in MetaTrader 4

In the MT4 terminal there are standard tools to obtain a deep detailed quotes history. Let's consider this process step by step.

Step 1. Set a sufficient number of available bars in the history and the number of visible bars in the window (see Fig. 1). Let's calculate this value. The maximum available history for most instruments is 11.5 years (from 01.01.1999 to the present time). There are about 260 workdays per year (52 weeks consisting of 5 workdays). Each day consists of 1440 minutes (24 hours * 60 minutes per hour). Total we get: 11.5 years x 260 days per year x 1440 minutes per day = 4,305,600 minutes. Considering the fact that the history will accumulate over time, let's set the available history depth with the reserve, i.e. 5 000 000 bars.

Step 2. Download the full story from the server of MetaQuotes Software Corp.. To do this, open the window "Quotes Archive" (main menu "Tools" - "Quotes Archive" or press F2), select the required instrument and timeframe (see Figure 2). Please note that the icon of the selected timeframe should be highlighted. Then press the button "Download" and you will see a warning window, according to which the quotes will be downloaded not from the server of the broker, but from the server of MetaQuotes. You can dismiss this warning by pressing the "OK" button and wait for the end of the loading process, which, depending on the connection speed, can take different time. If you access the archive of quotes for the first time, the downloaded information will be about 40 Mb.

Quotes archive for MetaTrader 4

Fig. 2. Using the "Quote Archive".

Step 3. After the data download is complete, it is advisable to reboot the terminalThe value of the maximum number of bars changes only when you start the terminal.

Having restarted MT4, let's check the availability of the downloaded data. For this purpose let's open the chart of the instrument, for which the above actions were carried out, set timeframe M1 and press the Home key, which will lead to a transition on the timeline to the beginning of the available data. If you observe the candles corresponding to January 4, 1999, then the process of obtaining quotes history was successful.

It would seem that the job is done, and you can start testing the developed strategy. But it was not to be. We encounter an unpleasant surprise when we check in details the integrity of the obtained quotes: the history of quotes is replete with data gaps - "holes" (see fig. 3). Unfortunately, such "gaps" are not uncommon in the downloaded quote history. Only in 2010 we can easily find two more serious gaps: 07.05.2010 - 08.07.2010 and 23.07.2010 - 05.08.2010.

hole in MetaTrader 4 quotes

Fig. 3. One of the "holes" in the quotes history.

To use such a quotes history when testing strategies means to deceive yourself. So for serious research we should prepare a quotes history, which does not contain any "holes" or at least those "holes", which were formed in an unnatural way (absence of really existed data due to inexplicable reasons). In turn, the natural "holes" mean the gaps in the data, which correspond to no real quotescaused by the low volatility of the market, for example, at night.

Import quotes to MetaTrader 4

Find a deep detailed history of quotes for MT4 in the free access is proving to be a problem. It is much easier to find it for another trading platform - MetaStock. The data for MetaStock was taken as the basis for getting quotes history for MT4. Formats of history quotes presentation in MT4 and MetaStock are quite similar, though they need some correction, which was carried out by the author of the article for 14 most common financial instruments. As a result the files of quotes history attached to this article can be used for importing into MT4 terminal environment.

The process of importing quotes is performed in several steps:

Step 1. Close MT4 terminal.

Step 2. In the history\\\ folder of the terminal delete all hst files that belong to the instrument, for which you intend to import the quotes history. For example, for EURUSD it will be the following files: EURUSD1.hst, EURUSD5.hst, EURUSD15.hst, EURUSD30.hst, EURUSD60.hst, EURUSD240.hst, EURUSD1440.hst, EURUSD10080.hst and EURUSD43200.hst.

Step 3. Download the terminal.

Step 4. Open the "Quotes Archive" window and select the desired instrument and timeframe from the list, as shown in Fig. 2.

Step 5. Click the "Import" button, which brings up the window shown in Fig. 4. 4. Then, by pressing the "Browse..." button, you must select one of the unpacked files, which were obtained through the links presented in the article.

Import Quotes History for Metatrader 4

Fig. 4. Importing the quotes history.

Step 6. Depending on the broker with which the user works, it is necessary to set time shift of quote history. The presented history is based on the broker's server time GMT+1. Therefore, if your broker's server is set to that time, you should leave the value 0 in the "Shift" field. For the GMT server time, you should specify a shift of -1 hour, and for the GMT+2 time the shift will be +1 hour. Please note that we are not talking about the local time of the user's computer, namely the time accepted on the broker's server.

MetaTrader 4 Server Time Offset

Calculate server time offset You can open the terminal window "Market Watch" (the main menu "View" - "Market Watch" or press Ctrl+M) and compare the time specified in the header of the window with the local time of the computer. If the local time of the computer is ahead of the value specified in the "Market Watch", you must subtract the obtained difference from the local time zone (you can see it in the Windows settings when setting the time). If the local computer time is behind the time of the broker's server, the difference in hours is added to the local time zone (see Fig. 5).

Calculating the time zone of the broker's server

Fig. 5. Calculating the time zone of the broker's server.

Step 7. Press the "OK" button and wait until the quotes history is downloaded.

Implementation of these steps will lead to a high-quality minute history of quotes from 03.01.2001 to 22.06.2011.

Synthesis of different timeframes from M1

As mentioned above, having a minute history, you can synthesize any other timeframe. To do this, it is sufficient to use the standard period_converter script:

Activate the chart window of the required instrument and set the M1 timeframe.

Open the "Navigator" window (main menu "View" - "Navigator" or Ctr+N).

3. Open the "Scripts" list and find the period_converter script.

4. Double-click on the line with the script name, which brings up the program settings window.

5. Select the "Input parameters" tab.

6. Assign to the ExtPeriodMultiplier parameter a value corresponding to the number of minutes contained in the desired timeframe. For example, for the hour timeframe this value is 60, for H4 - 240, for D1 - 1440, for W1 - 10080, for MN1 - 43200.

7. Click "OK" and wait a few seconds for the conversion to complete, after which you can right-click on the chart and select "Delete Script". In order to make sure that the data synthesis is finished before forcibly removing the script from the chart, you should open the "Terminal" window (main menu "View" - "Terminal" or press Ctrl+T) and select the "Experts" tab. After the line of the form: "2011.07.22 22:56:52 period_converter EURUSD,M1 inputs: ExtPeriodMultiplier=60" should be followed by a line of the form: "2011.07.22 22 22:56:55 period_converter EURUSD,M1: 75673 record(s) written". After that you can safely delete the script and proceed to the synthesis of other necessary timeframes.

Warning! For the most correct synthesis of timeframes from the M1 timeframe, it is not recommended to switch the chart period until all generated timeframes are synthesized.

Download quotes for MetaTrader 4

History of M1 quotes on AUDJPY

History of M1 quotes on AUDUSD

History of M1 quotations for CHFJPY

History of М1 quotations for EURCAD

History of М1 quotations for EURCHF instrument

History of М1 quotations for EURGBP instrument

History of М1 quotations for EURJPY

History of М1 quotes on EURUSD

M1 quotation history for GBPCHF

History of M1 quotations for GBPJPY

History of M1 quotes on GBPUSD

History of M1 quotations for GOLD instrument

History of M1 quotations for the instrument SILVER

History of М1 quotations for USDCAD

History of M1 quotations for USDCHF

History of М1 quotations for USDJPY

Комментарии ( 3 )

  1. Good afternoon.
    I uploaded the quotes, everything is OK.
    I can't convert from M1 to larger periods. What could be the problem? More precisely, the script runs, I see the message in the terminal, but the history does not appear on the chart.

Leave a Reply

Back to top button