I have a function I'm trying to convert to MQL5 from MQL4, it works perfectly in MQL4 but MQL5 for some reason breaks without finding the string. The complier shows no errors, I think something is wrong with one of the strings. I attached the file I'm trying to read as txt as well. Any help would be greatly appreciated.
Where it breaks:
Full function:
has sdata loaded ?
try this funion also if it says cannot open fle check file permissions , if you are sent the file and not downloading it
#property version "1.00" int OnInit() { EventSetMillisecondTimer(44); return(INIT_SUCCEEDED); } void OnTimer(){ EventKillTimer(); string longstring=""; uchar bytes[]; int f=FileOpen("ff_calendar_thisweek.txt",FILE_READ|FILE_BIN); if(f!=INVALID_HANDLE){ Print("Opened , file size "+FileSize(f)); ArrayResize(bytes,(int)FileSize(f),0); FileReadArray(f,bytes,0,ArraySize(bytes)); FileClose(f); longstring=CharArrayToString(bytes,0,ArraySize(bytes),CP_ACP); }else{ Print("Cannot open file"); } Print("Size of data "+StringLen(longstring)); int eveid=StringFind(longstring,"<event>",0); if(eveid!=-1){ Print("Found event"); }else{ Print("Cant find event"); } Print("Done"); ExpertRemove(); } void OnTick() { }
has sdata loaded ?
try this funion also if it says cannot open fle check file permissions , if you are sent the file and not downloading it
The function was able to open it, but when I tested sData it is reading in non-latin characters in the log even though file is in english.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a function I'm trying to convert to MQL5 from MQL4, it works perfectly in MQL4 but MQL5 for some reason breaks without finding the string. The complier shows no errors, I think something is wrong with one of the strings. I attached the file I'm trying to read as txt as well. Any help would be greatly appreciated.
Where it breaks:
Full function: