Detect when connection to network is lost or active

 

Hi there beautiful people. 

i am currently trying to make an EA check if connection to internet is been active or not so as to delete an object on the chart. eg. lets say whenever the user connects his computer to the internet i wan to be able to know and create an object to the chart and also delete an object when internet connection is no longer avaliable. any help with the code please?

Documentation on MQL5: Integration / MetaTrader for Python / order_calc_margin
Documentation on MQL5: Integration / MetaTrader for Python / order_calc_margin
  • www.mql5.com
order_calc_margin - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

I am not sure that it helps but it is what I found -

IsConnected - expert for MetaTrader 5
IsConnected
IsConnected
  • www.mql5.com
Checks if Metatrader5 Terminal is connected to Internet or not. The expert will Print a message for the connectivity status
 
Sergey Golubev #:

I am not sure that it helps but it is what I found -

IsConnected - expert for MetaTrader 5
thanks for the response, but i am talking about the code not an EA, i am trying to add the code into a custom EA.
 
yomadestephens #:
thanks for the response, but i am talking about the code not an EA, i am trying to add the code into a custom EA.

The answer of your question migth be inside that EA

 
IsConnected returns the current state. But when the network goes down, it will take ~30 seconds until the timeout/retry fails and the state changes.
 
William Roeder #:
IsConnected returns the current state. But when the network goes down, it will take ~30 seconds until the timeout/retry fails and the state changes.
Thanks so much. All done
Reason: