Ok, the problem returned, I found the cause and a solution.
More testing revealed the problem was caused by an indicator that's drawing many objects on the chart. Whenever the indicator is removed from a chart it enters OnDeinit() where it iterates over all objects on the chart in a for-loop and calls ObjectDelete() for every object that was created by the indicator. I suppose OnDeinit() is also called when the terminal exits because removing the code to delete the objects solved the problem. I think completing the loop to delete the objects was either taking too long or perhaps it was creating a race condition with the process to exit the terminal.
After some more testing I replaced the for-loop that was calling ObjectDelete() many times with a single call to ObjectsDeleteAll(). With that update to the code the objects are successfully deleted when the indicator is removed from the chart and closing the terminal no longer causes any issues.
I got the same problem but deleting all objects on OnDeinit() didn't help.
I had to do it in 3 steps:
1. Add ObjectsDeleteAll(0,0) to your OnDeinit().
2. Don't close the chart with Indicators or EA still running on it.
3. Apply a different template to the chart, with no indicators. Now you can close the chart or exit terminal.
That releases all threads and terminal64.exe closes on terminal exit without any problems.
I hope the folks at MetaQuotes will find a better way to fix it. That is sure is annoying as hell. Besides that, if terminal64.exe isn't closing on exit, none of your fresh Global Variables are getting saved, they are lost forever. Next time you start the terminal, you only get the older Global Vars from the previous successful exit. I bet some other stuff might get lost too.
Tried that. Changes nothing ... same behaviour. I am having that exact behaviour, when I start the strategy tester via command line, write a report and exit (shutdown option on startup config set to true). What happens is, that one backgroungd process remains open for 50-60 seconds, then closes.
I am using a local network farm with 40 agents and 24 local test agents. When I disable the 24 local test clients on my Ryzen 9 the problem disappears. So it seems to have something to do with properly closing the local testrun processes when local agents are used together with remote clients.
PS: I can confirm that now, disabling the local test agents solves the issue, although I think that is a poor workaround, since I'd like to use my local 24 cores obviously.
Another observation probably interesting for anyone else. I have started the Meta Tester from Windows Command Line and I had the problem, that the terminal64.exe process did not finish when the terminal window (strategy tester) was closed. A solution is to disable local test agents, another solution is to start the Meta Tester from WSDL or GIT Bash. Surprisingly, when I start the platform using
from WSDL Bash or Git Bash, the process communication seems to work, and the terminal64.exe is terminated immediately after the Meta Tester Terminal window closes.
![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
Hi, when closing the terminal it seems the process terminal64.exe isn't properly ended. The terminal window closes normally but in the task manager it still shows with either 0% or a very low cpu % and about 100MB of RAM usage.While this process is running I can't restart the terminal. After I end the process manually I can restart the terminal as normal.
This happens on MT5 build 2006, on Win 10 Pro x64 build 1803.