In MT5 strategy test, the FileOpen() function deletes the files.
Why is this happening and what is the solution, please?
FileOpen() doesn't delete files, they are delete automatically.
You have to use #property tester_file. See documentation.
FileOpen() doesn't delete files, they are delete automatically.
You have to use #property tester_file. See documentation.
Thanks for your info.
So in my case to maintain the file "data.csv" I add:
#property tester_file "Data.csv"
But then I still see the file being deleted. What am I doing wrong?
Thanks for your info.
So in my case to maintain the file "data.csv" I add:
But then I still see the file being deleted. What am I doing wrong?
You didn't do anything wrong. As I said it's deleted automatically.
You need to use #property°tester_file, so it will be copied (automatically) again when needed.
What's the problem ?
You didn't do anything wrong. As I said it's deleted automatically.
You need to use #property°tester_file, so it will be copied (automatically) again when needed.
What's the problem ?
Hi there,
I also need some help with this automatically file being deleted. How do I use #property°tester_file in order to copy the file I need?
I created a csv file wich is erased every time I run the EA, so I'd like to keep this file in folder.
Hi there,
I also need some help with this automatically file being deleted. How do I use #property°tester_file in order to copy the file I need?
I created a csv file wich is erased every time I run the EA, so I'd like to keep this file in folder.
Hello,
Did anyone get a definitive answer to this question. The documentation is unclear. I use the #property tester_file and still the file gets deleted from
the directory every time I run the strategy tester. Clearly the file is in the right place because it gets read and deleted. However, I cannot be sure that
the file to be copied by the system is in the correct place, other than that it is in MQL5/Files as it is when I run the EA on a chart normally. Other that this
I have no idea. Any assistance appreciated.
Thanks
Jeff
Just add a comment here for future references as some random person happens to google this.
The document sucks at this part. I have used the
#property tester_file "testfile"
And it just does not work.
I suggest the easier solution:
Place your file in the: "%AppData%\MetaQuotes\Terminal\Common\Files" . If you do not see the folder "Files" in "%AppData%\MetaQuotes\Terminal\Common" then create one first.
Anyway, once you have done so, to interact with files, use "File Common", like this:
int h=FileOpen("test.txt",FILE_READ|FILE_ANSI|FILE_TXT|FILE_COMMON);
The files in the "Files" common folder won't even get deleted.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In MT5 strategy test, the FileOpen() function deletes the files.
Why is this happening and what is the solution, please?