I would like to erase the log of the Strategy Test automatically, every time I launch the Strategy Tester.
Roughly (something like)... maybe
If(IsTesting() == true)
{
FileDelete("C:Path\Log.txt");
}
Hello,
I would like to erase the log of the Strategy Test automatically, every time I launch the Strategy
Tester.
Is there a solution ?
Thanks,
Pierre
Because the log file is outside the MT5 sandbox, you would need to use a DLL call to delete a log file.
Something like:
// Note, this exists in fileapi.mqh, so you should be able to just include it in your code #import "kernel32.dll" // Unicode version, use this in MT5 bool DeleteFileW(string lpExistingFileName); #import // How to use if( ! DeleteFileW(doomedFile) ) { return false; }
Because the Tester puts a lock on the current log file, it is not possible to delete the log file while the Tester window is open.
Therefore, deleting the file from OnTester() or OnTesterInit() may not be possible. It would be worth trying, though.
The way I handle this is to leave a Windows Explorer window open at all times. When I close the Tester window, I delete the log file. This works every time.
Because the log file is outside the MT5 sandbox, you would need to use a DLL call to delete a log file.
Something like:
Because the Tester puts a lock on the current log file, it is not possible to delete the log file while the Tester window is open.
Therefore, deleting the file from OnTester() or OnTesterInit() may not be possible. It would be worth trying, though.
The way I handle this is to leave a Windows Explorer window open at all times. When I close the Tester window, I delete the log file. This works every time.
In Strategy Tester if you go to the Journal tab and right-click on any of the messages you can select [Clear all Journals] this will also delete the log
In Strategy Tester if you go to the Journal tab and right-click on any of the messages you can select [Clear all Journals] this will also delete the log
Do you mean in the Terminal window, Strategy Tester pane, click Journal tab, right-click, and select [Clear Logs]?
Yes, that's another option with perhaps one fewer click. I hadn't used that before. Thanks for the heads up.
Unfortunately, this doesn't clear the Tester log if the Tester visualization window is open, but it does when it's closed, so that's nice.
Oh, how I wish there were a push-button on the [Settings] tab on the Strategy Tester pane. One-click, goodbye .log file.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I would like to erase the log of the Strategy Test automatically, every time I launch the Strategy Tester.
Is there a solution ?
Thanks,
Pierre