Hi, Can You Help Me How Restart MT5 Automatically Every NewDay - page 2

 
Alain Verleyen:
I do agree with William and Chris. If it works well and then at some point it doesn't any more and you think you need to restart MT5, that's due to a memory issue. Your code is broken.
Bro I remove EAS and Disconnect Programme How related With MT5 And RAM Busy And Most Used But CPU Free
 

I Have Probleme With RAM When MT5 Free CPU Free But RAM Stay Used (I Use VPS)

Thank You Very Much

 
Hamza Ghennami:

I Have Probleme With RAM When MT5 Free CPU Free But RAM Stay Used (I Use VPS)

Thank You Very Much

It is relatively trivial to create a script to close and reopen Meta Trader.  Something like this:

taskkill /im terminal64.exe
timeout 10
start C:\Program Files\MetaTrader 5\terminal64.exe

This could then be added to the Windows Task Scheduler to run once a day at a certain time.  Not sure how the VPS factors in, however.

 
Shalem:

It is relatively trivial to create a script to close and reopen Meta Trader.  Something like this:

taskkill /im terminal64.exe
timeout 10
start C:\Program Files\MetaTrader 5\terminal64.exe

This could then be added to the Windows Task Scheduler to run once a day at a certain time.  Not sure how the VPS factors in, however.

I will Try Thanks
 
Hamza Ghennami:
Bro I remove EAS and Disconnect Programme How related With MT5 And RAM Busy And Most Used But CPU Free

I am not your "Bro" whatever that means.

Yes when memory is not released, it's a memory leak, it could eventually be an MT5 issue caused by your code or it comes from your code directly. It's always better to find the reason, but if you don't want to listen, it's as you wish.

If you think automatic restart will solve your problem, several solutions have already been proposed.

 
Alain Verleyen:

I am not your "Bro" whatever that means.

Yes when memory is not released, it's a memory leak, it could eventually be an MT5 issue caused by your code or it comes from your code directly. It's always better to find the reason, but if you don't want to listen, it's as you wish.

If you think automatic restart will solve your problem, several solutions have already been proposed.

thank you very much sir for all several solutions.
 

I'd like to add some contribution to this. 

While we see some rude comments telling the OP that there's a bug in his code, I might remind you that when you ask MT5 to bring historical data from a symbol, it freezes in the memory for about 15 minutes.

It's already discussed here: https://www.mql5.com/en/forum/327384

When you're working with a lot symbols and a lot of historical data, it becomes a nightmare on RAM usage.

So, yes, the only way to iterate over thousands of symbols historical data, you need from time to time to shutdown MT5 and start from the last item iterated.

I've migrated to Python to do this, as it (magically) makes MT5 consume a lot less memory while doing these heavy iterations.

How to release memory after massive CopyRates()?
How to release memory after massive CopyRates()?
  • 2019.11.28
  • www.mql5.com
I've noticed that after copying history with CopyRates MT5 keeps copied array in memory...