Hi,
Finally, I found the good path for the file by using this
TerminalInfoString(TERMINAL_DATA_PATH)
I find that there is a lot of lack in the MQL5 documentation or it is not intuitive. Hope this can help

Documentation on MQL5: Checkup / TerminalInfoString
- www.mql5.com
TerminalInfoString - Checkup - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
hi,
i have same problem!!! But did not resolved with your help
I found the location by looking in the tester log file in the terminal files area:
...\AppData\Roaming\MetaQuotes\Terminal\....\Tester\logs\20241116.log
with a line near the end of:
log file "...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\logs\20241116.log" written
which gave me the path for Files in the tester as
...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\MQL5\Files
and when I put the files I wanted to open under that directory it worked EXCEPT that the files were deleted after a run.
Why should I have to copy my files for every test run?
A better solution is required please.
...\AppData\Roaming\MetaQuotes\Terminal\....\Tester\logs\20241116.log
with a line near the end of:
log file "...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\logs\20241116.log" written
which gave me the path for Files in the tester as
...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\MQL5\Files
and when I put the files I wanted to open under that directory it worked EXCEPT that the files were deleted after a run.
Why should I have to copy my files for every test run?
A better solution is required please.
AutoAbacus #:
I found the location by looking in the tester log file in the terminal files area:
...\AppData\Roaming\MetaQuotes\Terminal\....\Tester\logs\20241116.log
with a line near the end of:
log file "...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\logs\20241116.log" written
which gave me the path for Files in the tester as
...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\MQL5\Files
and when I put the files I wanted to open under that directory it worked EXCEPT that the files were deleted after a run.
Why should I have to copy my files for every test run?
A better solution is required please.
Update. My input files were deleted by the tester only when the test tun ended abnormally on an error condition. They remained in place when the test run completed normally.I found the location by looking in the tester log file in the terminal files area:
...\AppData\Roaming\MetaQuotes\Terminal\....\Tester\logs\20241116.log
with a line near the end of:
log file "...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\logs\20241116.log" written
which gave me the path for Files in the tester as
...\AppData\Roaming\MetaQuotes\Tester\....\Agent-127.0.0.1-3000\MQL5\Files
and when I put the files I wanted to open under that directory it worked EXCEPT that the files were deleted after a run.
Why should I have to copy my files for every test run?
A better solution is required please.
But why are they being deleted at all?
AutoAbacus #:
Update. My input files were deleted by the tester only when the test tun ended abnormally on an error condition. They remained in place when the test run completed normally.
But why are they being deleted at all?
Ah the better or easier anyway solution is to put the file or files to be read in the common files area and then use FILE_COMMON when opening the files, Update. My input files were deleted by the tester only when the test tun ended abnormally on an error condition. They remained in place when the test run completed normally.
But why are they being deleted at all?
as per "Open Files during backtest" and several posts there. Reading files there works when running normally or via the tester with no changes required.
Use of "#property tester_file" is also possible but use of the common files area seems simpler and easier.

Open Files during backtest - How to make file referencing easy.
- 2018.05.16
- chinaski
- www.mql5.com
Ok, after some research, i found the property tester_file. When disable #property, still not working. Of course you need to tester_file directive. Thank you but i did this and it is was working. Now restarting or next day and it works

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
Hello,
I'm trying to read a value from a csv file. Everything works fine when I attach the EA on a chart. The problem is only with the strategy tester.
As per the documentation : The file is opened in the folder of the cli ent terminal in the subfolder MQL5\files (or testing_agent_directory\MQL5\files in case of testing).
I tried to put the files in AppData\Roaming\MetaQuotes\Terminal\XXXXXXXXXXXXXXXX\Tester\Files or AppData\Roaming\MetaQuotes\Terminal\XXXXXXXXXXXXXXXX\testing_agent_directory\MQL5\files but I always got the same error (error code 5004).
I also use the following directive in mycode :
Obviously there is something that I don't understand.
My question is what or where is testing_agent_directory\MQL5\file directory.
Can someone help me locate the folder please