can I automate History Centre exports?

 
I would like to script for an export of several history files to .csv format. Manually I go into the History Centre select a currency pair, select the time frame and click the export button. Is there a way I can create a script that will do all this automatically for the history of a number of different currency pairs/timeframes?
Thanbks
Ron
 
ronhud:
I would like to script for an export of several history files to .csv format. Manually I go into the History Centre select a currency pair, select the time frame and click the export button. Is there a way I can create a script that will do all this automatically for the history of a number of different currency pairs/timeframes?

The history is stored in *.hst files in the 'history' folder. These files have a known structure (it's in the manual) and they can be accessed via File functions (https://docs.mql4.com/files), so you can have a script read those *.hst files and write *.csv files.

 
gordon:

The history is stored in *.hst files in the 'history' folder. These files have a known structure (it's in the manual) and they can be accessed via File functions (https://docs.mql4.com/files), so you can have a script read those *.hst files and write *.csv files.


If I understand correctly the files in the history folder are only those I create at a specific time by manually going into the History Centre, selecting etc. I would like to be able to avoid having to do that manual bit and have it done automatically by a script. I guess the manual operation calls down the up to date data from the server - can this be done from a script?
 
ronhud:
If I understand correctly the files in the history folder are only those I create at a specific time by manually going into the History Centre, selecting etc.

Not exactly. Files are created for each symbol/time-frame combination in the following cases:

  • Opening a new chart or changing the symbol/time-frame of an already opened chart.
  • Double-clicking on a symbol/time-frame in the history center.
  • Pressing the 'download' button in the history center (in this case files will be created for ALL time-frames for the chosen symbol).


I would like to be able to avoid having to do that manual bit and have it done automatically by a script. I guess the manual operation calls down the up to date data from the server - can this be done from a script?

Na... MT5 has built-in functions to download data, but not MT4. This has been discussed a few times in the past, u can search for it.
 

You can use the "Export-RT-Historical-Data-for-Ramp" MT4 indicator. It creates real time streaming .csv files that you can open in excel or any other program. It is free at http://www.ramprt.com/mt4/Ramp-MT4-Connection-Instructions.htm.