help with FileWriteArray and FileReadArray code

 

Hi,

I am trying to put one dimensional array into a file so that if I close and subsequently open the terminal the same EA can find the array information in the file and use it.

I have created the attached test EA to this and print the array information once the file is created and populated. I have two issues with this code; first I would expect to see this file in the terminal_directory\tester\files folder after I have run the EA in the Strategy Tester, but I don’t see it there, second the print command shows that all the array elements once they have been read from the file are 0 and not what I have put into them.

Any help would be appreciated.

Vesna

Files:
test2_2.mq4  3 kb
 

You are trying to read past the end of the file that is open for writing:

write the file

CLOSE the file

OPEN the file for reading

read the file

 
WHRoeder:

You are trying to read past the end of the file that is open for writing:

write the file

CLOSE the file

OPEN the file for reading

read the file



Thank you for your help WHRoeder. I have closed the file after writing to it and then re-opened it before reading, and it worked.