How is TerminalInfoInteger(TERMINAL_PING_LAST) in mt5 treated to detect net interruptions.

 

Hi,

I am still using mt4 and I tried to use TerminalInfoInteger(TERMINAL_PING_LAST) to detect net failures.

Sometimes it works:


But sometimes it doesn't! :(

Obviously the ping is executed in another thread than eas and indis (at east in mt4) it cannot be used to detect net failures despite it would be really helpful and easy to use if it were working reliably.

My question now is: does mt5 shows the same behaviour so that even in mt5 the ping cannot be used to detect net-failures to be able to react on that (checks, ..).

Maybe s.o. can convert and run the attached indi on a mt5 and unplug the internet for a couple of minutes several times?

Files:
Test_Ping.mq4  3 kb
 
I think you need put code into OnTimer().
 
Nguyen Nga:
I think you need put code into OnTimer().

If it would be coded smartly there would be no need for that!

But Metaquotes just did not think about this kind of use as the ping seems to be used only for the best connection to one of the servers!

 
Carl Schreiber: If it would be coded smartly there would be no need for that!
If you have a disconnection, OnCalculate will not run. Once it does, you've already missed the problem and are reconnected. Must run in OnTimer, or your results are meaningless.
 
whroeder1:
If you have a disconnection, OnCalculate will not run. Once it does, you've already missed the problem and are reconnected. Must run in OnTimer, or your results are meaningless.

No, one do not have to run OnTimer()!

You can run OnCalculate() and check the time between the ticks or the moments OnCalculate() runs and increase of the amount of ticks.

As an alternative the ping would work if it were coded within the terminal in a smart way!

But my question was how is this ping coded in mt5! The same was as in the mt4?

Reason: