Latency Monitor EA for MT5

HUE_HUE  

Hi. I need help to write an EA that monitors latency of the exchange to create/alter orders. For example sometimes it takes 10 seconds to change a Stop Loss and they say it's my internet but I'm sure it is not.

Idea:

Create and change orders that will never be executed and measure how long the exchange takes to apply the changes.

At the same time the EA will ping google. This way I know when the latency problem is because of my internet or the exchange.

I want the EA to draw 2 lines in a indicator: 1) Exchange delay 2) My internet delay

idea

Problem:

I know how to create custom indicators using iCustom() but I don't know how to pass delay values from the EA to the custom indicator.

How can I do this?

fxsaber  
https://www.mql5.com/en/code/19422
Ping
Ping
  • votes: 20
  • 2018.01.22
  • fxsaber
  • www.mql5.com
An important parameter in trading is the relevance of the current price. It depends on a lot of factors, one of the most popular being the network ping between the terminal and the trade server. However, another parameter is often ignored: the so-called "internal terminal ping", which is an additional lag of quotes inside the terminal (the...
fxsaber  

ENUM_TERMINAL_INFO_DOUBLE

Identifier

Description

Type

TERMINAL_RETRANSMISSION

Percentage of resent network packets in the TCP/IP protocol for all running applications and services on the given computer. Packet loss occurs even in the fastest and correctly configured networks. In this case, there is no confirmation of packet delivery between the recipient and the sender, therefore lost packets are resent.

 

It is not an indication of the connection quality between a particular terminal and a trade server, since the percentage is calculated for the entire network activity, including system and background activity.

 

The TERMINAL_RETRANSMISSION value is requested from the operating system once per minute. The terminal itself does not calculate this value.

double


Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties
  • www.mql5.com
Information about the client terminal can be obtained by two functions: TerminalInfoInteger() and TerminalInfoString(). For parameters, these functions accept values from ENUM_TERMINAL_INFO_INTEGER and ENUM_TERMINAL_INFO_STRING respectively. Knowing the parameter value, you can set the size of graphical objects so that they look the...
HUE_HUE  

Thanks but this is not what I want. This just asks Windows once a minute how he thinks things are going with my internet. It says nothing about the Exchange's order creation/altering performance.

I want to write an EA that actually perform actions that a trader would (without executing orders) and analyzes how long they take for the exchange to process. At the same time ping some site on the internet and analyze how long it takes. This way I can tell when the lag problem is my internet or the exchange, in real time.

I've already coded most of it but I need a way to draw the ping lines in an efficient manner. I don't want to draw hundreds or thousands of lines in a chart because it will use too much resources. 

Is there a way for an EA to set the indicator values instead of the indicator using PRICE_CLOSE?

Icham Aidibe  
HUE_HUE:

No my friend. I need my indicator to draw lines based on values sent by the EA. CopyClose simply copy close price from the instrument.

For example I want my EA to send "ping" numbers to indicator so it can draw them.

Your indicator to send ping numbers to EA. That's the way we do it.

HUE_HUE  
Icham Aidibe:

Your indicator to send ping numbers to EA. That's the way we do it.

Indicator can't place orders. I need EA to place orders and alter SL/TP, measure delay and send numbers to Indicator.

I've figured all parts except the send numbers from EA to indicator part.

Icham Aidibe  
HUE_HUE:

Indicator can't place orders. I need EA to place orders and alter SL/TP, measure delay and send numbers to Indicator.

I've figured all parts except the send numbers from EA to indicator part.

Then you should draw using the expert. An EA can retrieve data from an indicator, that's how it works. Sure, it's possible to find a workaround, but it's much more complicated & memory consuming than drawing using a single expert.

Reason: