Is it possible to work with txt, csv or other files in the testing strategy? If so, how?
Is it possible to work with txt, csv or other files in the testing strategy? If so, how?
- www.mql5.com
Yes, but only within the tester’s sandbox.
You must use the MQL5\Files (or Tester\Files during testing) directory and standard file functions ( FileOpen , FileRead* , FileWrite* ).
Absolute paths or arbitrary external locations are not allowed in Strategy Tester.
If you need shared access, use FILE_COMMON
One thing to add: the tester doesn't see your normal MQL5\Files folder automatically, because each agent has its own sandbox. Declare the file in the EA and the tester copies it over for you:
#property tester_file "data.csv"
Then just FileOpen("data.csv", ...) as usual. Or put it in the Common\Files folder and open it with FILE_COMMON.