- void OnStart()
- {
-
- string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);
- string filename=terminal_data_path+"\\MQL4\\Files\"+"fractals.csv";
- int filehandle=FileOpen(filename,FILE_WRITE|FILE_CSV);
- if(filehandle<0)
- {
- Print("Failed to open the file by the absolute path ");
- Print("Error code ",GetLastError());
- }
- ResetLastError();
- filehandle=FileOpen("fractals.csv",FILE_WRITE|FILE_CSV);
- if(filehandle!=INVALID_HANDLE)
- {
- FileWrite(filehandle,TimeCurrent(),Symbol(), EnumToString(ENUM_TIMEFRAMES(_Period)));
- FileClose(filehandle);
- Print("FileOpen OK");
- }
- else Print("Operation FileOpen failed, error ",GetLastError());
- string subfolder="Research";
- filehandle=FileOpen(subfolder+"\\fractals.txt",FILE_WRITE|FILE_CSV);
- if(filehandle!=INVALID_HANDLE)
- {
- FileWrite(filehandle,TimeCurrent(),Symbol(), EnumToString(ENUM_TIMEFRAMES(_Period)));
- FileClose(filehandle);
- Print("The file most be created in the folder "+terminal_data_path+"\"+subfolder);
- }
- else Print("File open failed, error ",GetLastError());
- }
-
复制代码
|