Here is your fault.
int file_handle=FileOpen("ES3.txt",FILE_READ|FILE_TXT|FILE_ANSI);
https://www.mql5.com/en/docs/constants/io_constants/codepageusage
https://www.mql5.com/en/docs/constants/io_constants/fileflags
int n=0; string line="Empty"; ResetLastError(); int file_handle=FileOpen("ES3.txt",FILE_READ|FILE_TXT|FILE_ANSI); if(file_handle!=INVALID_HANDLE){ Comment("Success !"); while(!FileIsEnding(file_handle)){ line=FileReadString(file_handle); n++; } FileClose(file_handle); } else Comment("Failed to open file",GetLastError()); Comment(n); FileClose(file_handle);
Documentation on MQL5: Standard Constants, Enumerations and Structures / Input/Output Constants / Use of a Codepage
- www.mql5.com
Standard Constants, Enumerations and Structures / Input/Output Constants / Use of a Codepage - Documentation on MQL5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello ...
I am trying to generate bars with data from another program.
First step is to read a text file located in \files\ES3.txt, with the content below.
The file reads fine, indicated by the comment "Success", however, when I try to loop through the lines it appears the code created an infinite loop. Is there anything I am doing wrong here?
When I get each line, I want to parse out the values to create bars.
Thanks for any suggestion.