Download MetaTrader 5

I get error code 5004 when reading a file (whereas it worked before build 625)

To add comments, please log in or register
Proximus
766
Proximus  

I get error code 5004 when reading a file, whereas it worked with all previous builds.I think it is because of the introduction of FILE_TXT and similar parameters, since i`m not familiar with them yet, so please help me fix my code.Here is it:

int SEARCHARRAY[5000000];
int k=0;
int FILEX;

init()

FILEX=FileOpen("SEARCHDATA.txt",FILE_READ|FILE_TXT);

if(FILEX!=-1)
{

     while(FileIsEnding(FILEX)==false)
     {
     SEARCHARRAY[k]=StrToInteger(FileReadString(FILEX,1));
     k++;
     }
FileClose(FILEX);

}

Here is a sample of my file:

It is just basically integers which represent encoded signals from indicators coded as integers from 0 to 9, so each character represents a signal BUY/SELL. This is why i need to read the characters one-by-one into the SEARCHARRAY[].

But it gives me the nasty 5004 error, please help! Note, that i recompiled the EA, so it still doesnt work!

Files:
qjol
3243
qjol  
Proximus
766
Proximus  
qjol:

FILE_BIN

tried that before the FILE_TXT, both dont work
qjol
3243
qjol  

works great for me

FILEX=FileOpen("SEARCHDATA.txt",FILE_READ|FILE_BIN);

if(FILEX!=-1)
{

     while(FileIsEnding(FILEX)==false)
     {
     SEARCHARRAY[k]=StrToInteger(FileReadString(FILEX,1));
     Print(SEARCHARRAY[k], " k=: ", k);
     k++;
     }
FileClose(FILEX);
Alain Verleyen
Moderator
33503
Alain Verleyen  
Proximus:
tried that before the FILE_TXT, both dont work
Where is your SEARCHDATA.txt saved ?
Proximus
766
Proximus  
angevoyageur:
Where is your SEARCHDATA.txt saved ?


Sorry for so late response i later found out myself what was the problem, and yes you are right, that file was put in the

\MQL4\Files

instead of

\tester\files

Its very hard to get used to the new MT4 updates, but its ok.

To add comments, please log in or register