What happens to EAs when the chart freezes on MT5?

 

Hi,

I run on my MT5 platform some EAs on several charts. To be more precise, I have 17 charts opened with an EA on each of them.

All of this EAs have been written by myself, I have already re-writen some of the code to make them lighter/faster.

The problem is that the charts and the "trade tab" keeps freezing. It stays frozen for several minutes! But the "Market Watch" Clock keeps counting the time, as if MT5 was running.

Task Manager shows MT5 running, it does not show "Not Responding". MT5 is using less than 4Gb of RAM, my server has 8Gb of RAM. CPU usage is around 20%.

My question is: while the chart is frozen, does the EA stops working too? I'm not sure if this "freeze" is only visual and the EAs keep working on the background or if everything is frozen and the EAs are not working.

Any idea?

Thanks!

 
I never have this "frozen charts" case.
I have it when I am switching my trading account to an other one with opened charts (it is necessary to close the charts first, and after that only - switch between the trading accounts in Metatrader).
 
Sergey Golubev:
I never have this "frozen charts" case.
I have it when I am switching my trading account to an other one with opened charts (it is necessary to close the charts first, and after that only - switch between the trading accounts in Metatrader).

Actually everything is frozen, the entire interface. I can't click anywhere, can't interact with MT5 in any way, can't close, minimize, maximize, etc. But the Market Watch Clock keeps counting time. After some seconds or minutes it unfreezes and then after some more minutes, it freezes again.

I'm running a demo account on this MT5, but I want to connect my real account on it because the EAs are working as expected despite all the freezing. But I am worried something could go wrong...

I thought about running a couple chart per MT5, so I would run several MT5 instanes connected ti the same account.

The problem is that each of those EAs communicate between each other using Global Variables and I am not sure if I can make that communication work if they are on different MT5 instances.

------------------------

I have a few questions:

- Any idea what is going on? (interface frozen and Market Watch counting time)

- Is it possible the EAs are working on this condition?

- Is there a way to use some kind on Global Variables between MT5 instances, so I can split my EAs on several instances?

Thank you in advance!

 

I do not know ...

Did you try to connect Metatrader with the other broker?
Many brokers are proposing demo accounts.

I tried more than 80 brokers by openning demo accounts with them; it is less than 1 minutes to open demo accounts for many brokers directly from Metatrader, and it is about 5 minutes for me to open demo accounts with some other brokers in case they are validating my email and phone number to open demo accounts.

Because it may be the broker's related issue.

 

What is the build? 

Start eliminating. Like empty terminal does it freeze? How about with 2 charts, 7 charts?

Also check if there is any swapping going on while the freeze is happening. 


 
Sergey Golubev:

I do not know ...

Did you try to connect Metatrader with the other broker?
Many brokers are proposing demo accounts.

I tried more than 80 brokers by openning demo accounts with them; it is less than 1 minutes to open demo accounts for many brokers directly from Metatrader, and it is about 5 minutes for me to open demo accounts with some other brokers in case they are validating my email and phone number to open demo accounts.

Because it may be the broker's related issue.

Thank you for the advice, I'll try that!

 
Rafael Grecco:

Thank you for the advice, I'll try that!

Do not bother, a broker can not freeze your terminal on your hardware.

True, some brokers send more ticks for same symbol vs other. More ticks == more resources for bad code and slow indicators but still this is not an issue of the broker.

 
Enrique Dangeroux:

What is the build? 

Start eliminating. Like empty terminal does it freeze? How about with 2 charts, 7 charts?

Also check if there is any swapping going on while the freeze is happening. 


Build is 2815.

Empty terminal does not freeze. I'll start adding more chart with and without EAs to see how it behaves.

The imagem below shows no swap and plenty of free ram memory. MT5 was frozen when I took this screen shot:

Thanks! If you have any other idea, let me know!

 
Enrique Dangeroux:

Do not bother, a broker can not freeze your terminal on your hardware.

True, some brokers send more ticks for same symbol vs other. More ticks == more resources for bad code and slow indicators but still this is not an issue of the broker.

Alright, thank you for letting me know.

EDIT:

I also thought about "bad code"... not actually bad, I thought that maybe I'm asking my EAs to do too much processing. But since CPU usage is at 20% (it never gets higher than that) and RAM usage is low, I discarded the code.

I also have some more info:

My EAs start their work at 9 am. They will stop trading on two conditions - my daily target is met or if it's 3 pm and today's balance is positive.

On this condition there is almost zero processing, because there is no trades running. My EAs are only checking a value (comparing today's balance and target) and checking current server time.

Even on this condition MT5 keeps freezing... I'll do some more testing (eliminate EAs and charts, as you said) and post results here.

Thanks

 

The problem seems to be the number of charts opened simultaneously.

At first I said I had 17 charts, but it's actually 15. Even without the EAs (keeping only the charts opened), MT5 kept using nearly 4Gb RAM and still got some freezes.

So I started 2 new MT5 instances connected to the same account.

I divided that charts like this: 9 charts on the 1st instance, 4 charts on the 2nd instance and 2 charts on the 3rd instance (this was tecnically required because of the way the EAs work, comunicating with each other on the same instance).

The 1st instance, with 9 charts, still get some freezes. There are few of them and they unfreeze faster. It's using 2.2 Gb of RAM

The 2nd instance, with 4 charts, don't get any freeze, but it eventually stutters for some seconds. It's using 1.4 Gb of RAM

The 3rd instance, with 2 charts, I didn't notice any freeze or stutter. It's using 950 Mb of RAM.

So it seem it comes down to how many charts MT5 can run simutaneously.


I'll keep using 3 instances and have thought of a way of congragating some EAs on a single chart. I'll probably be able to make it 4 charts, 3 charts and 3 charts (each instance).


I hope this info proves usefull if someone is passing through this same problem.


Regards,
Rafael.