try this:
handle=FileOpen(filename, FILE_CSV|FILE_READ|FILE_WRITE, ';');
handle = FileOpen(filename, FILE_CSV|FILE_WRITE, ";"); // File is now empty
- Don't truncate the file, append to it.
int APPEND = FILE_CSV|FILE_WRITE|FILE_READ; string nameOPT = WindowExpertName() + ".OPT"; int handleOPT = FileOpen(nameOPT, APPEND, '~'); if(handleOPT < 1){ AlertMe( "OptComplete: FileOpen(", nameOPT,") Failed: ", GetLastError() ); return; } FileSeek(handleOPT, 0, SEEK_END); FileWrite( handleOPT, ...
- You don't need to open a close each tick, but you won't be able to read the file externally while it is open, and on a crash, not all data will be written to disk (unless you also use fileFlush)
WHRoeder:
- Don't truncate the file, append to it.
- You don't need to open a close each tick, but you won't be able to read the file externally while it is open, and on a crash, not all data will be written to disk (unless you also use fileFlush)
thank you very much I modify my code.
I could not test it because expert doesn't seem to execute after loading successfully : it doesn't even print in terminal

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
In my expert start() I have
But I got only one line in my file whereas I did ask to append to the file with FileSeek(handle, 0, SEEK_END);
How to fix this ?
Also do I need to open / close handle at every tick ?