MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  File functions  FileOpenHistory

 
int FileOpenHistory( string filename, int mode, int delimiter=';')
Opens file in the current history directory (terminal_directory\history\server_name) or in its subfolders. Returns the file handle for the opened file. If the function fails, the returned value is -1. To get the detailed error information, call the GetLastError() function.
Notes: Client terminal can connect to servers of different brokerage companies. History data (HST files) for each brokerage company are stored in the corresponding subfolder of the terminal_directory\history folder.
The function can be useful to form own history data for a non-standard symbol and/or period. The file formed in the history folder can be opened offline, not data pumping is needed to chart it.
Parameters:
filename   -   Filename.
mode   -   Opening mode. Can be one or combination of values: FILE_BIN, FILE_CSV, FILE_READ, FILE_WRITE.
delimiter   -   Delimiter for csv files. By default, the ';' symbol will be passed.
Sample:
  int handle=FileOpenHistory("USDX240.HST",FILE_BIN|FILE_WRITE);
  if(handle<1)
    {
     Print("Cannot create file USDX240.HST");
     return(false);
    }
  // work with file
  // ...
  FileClose(handle);