How to check if bar stops updating

 

Sometime due to any issue like internet failure or broker server failure bar may stop receiving to the MT5 terminal

Is there any way to detect this?

 

CopyTicks() to monitor the time of the ticks?

Or the difference between TimeLocal() and TimeCurrent()?

Ping: https://www.mql5.com/en/code/19422 (but ping does not reflect server action).

You can't look for it and find it yourself, even though you've been here for 3 years?

Documentation on MQL5: Timeseries and Indicators Access / CopyTicks
Documentation on MQL5: Timeseries and Indicators Access / CopyTicks
  • www.mql5.com
CopyTicks - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Carl Schreiber #:

CopyTicks() to monitor the time of the ticks?

Or the difference between TimeLocal() and TimeCurrent()?

Ping: https://www.mql5.com/en/code/19422 (but ping does not reflect server action).

You can't look for it and find it yourself, even though you've been here for 3 years?

Ok

difference between time is nice idea, Thanks
 
Arpit T: Is there any way to detect this?

Detect what? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
          "Free-of-Holes" Charts - MQL4 Articles (2006)
          No candle if open = close ? - MQL4 programming forum (2010)

The terminal will automatically reconnect. EA's code only runs when a tick is received.

 
Arpit T: Sometime due to any issue like internet failure or broker server failure bar may stop receiving to the MT5 terminal. Is there any way to detect this?

You can also look into the following terminal properties and see if they help ...

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Client Terminal Properties

TERMINAL_CONNECTED

Connection to a trade server

bool

TERMINAL_PING_LAST

The last known value of a ping to a trade server in microseconds. One second comprises of one million microseconds

int

 
Arpit T:

Sometime due to any issue like internet failure or broker server failure bar may stop receiving to the MT5 terminal

Is there any way to detect this?

Another option is to have an OnTimer() running.

In OnTick, you record the last call time with GetTickCount(). In OnTimer() you create an average of the delay of the calls to OnTick(), then you calculate a standard deviation over that average.

Now, if your delay is larger than 3* stddev, you raise a warning, if it happens more than 3 times in a row, you know, something is wrong.

This will adapt to changes over the day, and to Asia vs London sessions.