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
Looking for like-minded people? You will find lots of them on the Forum!
Proximus
760
Proximus 2014.04.04 19:05 

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 2014.04.05 21:58  
Proximus
760
Proximus 2014.04.06 01:05  
qjol:

FILE_BIN

tried that before the FILE_TXT, both dont work
qjol
3243
qjol 2014.04.06 01:30  

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
30752
Alain Verleyen 2014.04.06 09:42  
Proximus:
tried that before the FILE_TXT, both dont work
Where is your SEARCHDATA.txt saved ?
Proximus
760
Proximus 2014.05.24 09:06  
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