Download news file
The script allows you to download news starting from 2007 and to save the data to a text file named Calendar.txt.
The news data are downloaded from Forexfactory.com.
Calendar.txt can be later applied in Expert Advisors that use the news in their strategies, for testing or optimization.
To download the news it is necessary to run the script on any chart of any currency.
The download process will be displayed on the chart.
- Start_Year = 2007 - from what year you want to download news
- End_Year = 2017 - till what year inclusive
- GMT_News = 0 - GMT offset of news time
- Use_External_Files_Htm = true - Use .htm files downloaded using FF_htm. This option should be used if an error occurs while downloading pages from the site. The FF_htm script can be downloaded here: https://www.mql5.com/ru/blogs/post/703340
The file is saved to \MQL4\files\Calendar.txt
It is also copied to the common folder for all terminals, for example C:\Users\admin\AppData\Roaming\MetaQuotes\Terminal\Common (for the strategy tester)
It is necessary to add the link https://www.forexfactory.com in the terminal settings. An example is shown in the figure.
A sample of the Calendar.txt file format
This is the news history with GMT 0, it can serve as an example for determining the correctness of the GMT of your file.
2007.01.01 22:30;AUD;L;AIG Manufacturing Index
2007.01.02 02:30;CNY;M;Caixin Manufacturing PMI
2007.01.02 05:30;AUD;M;Commodity Prices y/y
2007.01.02 08:15;EUR;L;Spanish Manufacturing PMI
2007.01.02 08:45;EUR;L;Italian Manufacturing PMI
2007.01.02 09:00;EUR;M;Final Manufacturing PMI
Added possibility to use .htm files, downloaded using another script (https://www.mql5.com/ru/blogs/post/703340)
The possibility was added due to often complaints of users who were unable to download pages from forexfactory.com using the built-in Webrequest function.
The new script version 1.27 is redesigned for the new format of the site.