Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Import "Minute Bars" from forexite.com - MetaTrader 4 Script - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

Sometimes, mql4.com quote archive is missing "small" data (for example, "minute bars"). For example, for Gold: Minute Bar history covers the period from 2006 to present. This is clearly not enough to provide a proper test of a "rough" strategy that works on medium and higher timeframes, and the strategy is less sensitive to differences in data from different traders on smaller timeframes. However, it is possible to use quotes up to 2001 available on forexite.com - and more importantly, this data has gained quite a reputation.

The website has "minute bar" quotes in a format more or less friendly to MetaTrader 4: MetaStock format. Unfortunately, QuoteRoom's quotes have a more complex format, although they are collected into a single file each year. This script is designed to process data in MetaStock format.

The problem is that the "minute bars" are collected in separate files by trading day. Furthermore, each file contains data not only for the required instrument (e.g. gold), but also for all other instruments traded by the trader. Third: There are quotation documents on weekends, which are usually unnecessary. Therefore, in order to import the required gold data into MetaTrader 4 History Center, it is necessary to somehow process all these files and collect all "minute bars" in one file.

This script performs this specific task. But first, the data needs to be prepared for processing:

2. Go to the section of the website corresponding to the Minute Bar for the desired year and download all daily files. Separate projects need to be created for each year, but files from different years can be stored in a single directory. Only *.zip extensions should be specified in file download settings, as these are the only required files. This will allow you to download approximately 1500 files from 2002-2007.

3. Extract all files in batches to the "\experts\files\Forexite\" folder. Batch unpacking is built into Explorer. The result is a list of files in the folder with names similar to 250705.txt (cited July 25, 2005).

4. Then open MetaTrader 4 and attach the script. There are the following external parameters:

one. The name of the tool as it appears in the forexite.com file. For gold it is "XAUUSD",
b. The import start date is a string in the format of "YYYY.MM.DD",
c. Import the end date as a string in the same format.

Run the script. The script does not process files corresponding to holidays. You can manually add missing scripts and run the script again by viewing the script execution log or the Experts tab. It has been found empirically that early years generally do not contain files for January 1st (New Year's Day) and December 25th (Christmas Day). An updated line with the number of days processed is displayed in the upper left corner so as not to lose realism during script execution (processing the data from 2002 to 2007 to extract gold quotes lasted approximately 8 minutes).

5. There is a large file named XAUUSD_ALL.csv in the "\experts\files\" folder. This is a preliminary file ready for import (it's nice to see MetaTrader 4 being able to differentiate between "different" formats of dates). It is enough to set the omission of the first column (since the first column in the created file is "XAUUSD", which is unnecessary), specify the column separator (comma), check the volume (if not) and specify the offset in hours. I don't have to specify the offset separately because the quotes correspond to the server time of Alpari I'm using.

After importing all files in the directory "\experts\files\Forexite\", you can delete the file (XAUUSD_ALL.csv) received as a result of the script operation.

Finally: there is no volume data for minute bar quotes on forexite.com. When importing into MetaTrader 4, the volume is calculated if the volume is not specified in the source data or if the volume data is conflicting, because it turns out that testers do not test data without volume. If your strategy does not take volume into account and is "rough" enough that different quotes from different dealers will not affect it, then this is the right tool.

Note to the moderator (and others): In order to facilitate the test of the operability of the script, a small file is attached, which contains the quotes of all trading instruments of MetaStock from 01.02.2006 to 12.02.2006 (including holidays), in the format of forexite.com. Extract the archive to the "\experts\files\Forexite\" folder, set the external parameters of the script (tool and two dates) and run the script. It is also possible to use external parameters by simply changing the _s symbol .


Attachment download

📎 collect_forexite_quotes.mq4 (3.11 KB)

Source: MQL5 #7190

Verification code Refresh