I am trying to log variable values using File Functions but for unknown reason no file is created and nothing is logged :( Below is a simple example. Is it so that these functions are not usable with the tester?
You should check the filehandle after you attempt to open the file, if it is returned as INVALID_HANDLE Print("Error opening file, error# ", GetLastError() ) and see what the error is. If the handle is OK then it might be a UAC issue, what folder do you have MT5 installed in ?
Where do you close the file ?
Br, Candles
Its hard to tell if the problem is in UAC. This code works just fine when I attach it to the chart. So MetaTrader has correct user privileges. It may well be tha Strategy Tester does not have them. I wonder does that code log data on someone elses computer. I cannot do any changes to UAC on my current system.
Br, Candles
Ah, it works but not in the Strategy Tester, it's probably not a UAC issue then.
Where are you looking for the file ? I ran you code and found log.txt in here: \tester\Agent-127.0.0.1-3000\MQL5\Files\
Ah, it works but not in the Strategy Tester, it's probably not a UAC issue then.
Where are you looking for the file ? I ran you code and found log.txt in here: \tester\Agent-127.0.0.1-3000\MQL5\Files\
Good that solved it. I was looking from \MetaTrader 5\MQL5\Files as per references. It seems that tester uses a different location to save the file. Thank you.
Br, Candles

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to log variable values using File Functions but for unknown reason no file is created and nothing is logged :( Below is a simple example. Is it so that these functions are not usable with the tester?