Indicators: Ping - page 3

 

There is a logical issue with your indicator.

Ping = PrevTime ? MathAbs(Tick.time_msc - PrevTick.time_msc - (NowTime - PrevTime) / 1e3) : 0;

You can't just take the absolute value and count it as a delay. A -250 ms "in advance" will be counted as a 250 delay, that's not good.

Ticks are often received by packets by MT5, that's why there are negative values.

I don't think it's possible to calculate something precise about it. I removed the MathAbs() and allow negative values, all is well balanced between plus and minus values.


 

Forum on trading, automated trading systems and testing trading strategies

Indicators: Ping

Alain Verleyen, 2023.03.09 20:58.

There is a logical problem with your indicator.

Ping = PrevTime ? MathAbs (Tick.time_msc - PrevTick.time_msc - (NowTime - PrevTime) / 1 e3) : 0 ;

You can't just take an absolute value and consider it a delay. -250 ms "in advance" would be considered a delay of 250, this is not good.

Ticks often come into MT5 in packets, hence the negative values.

I don't think it's possible to calculate anything accurately about this. I removed MathAbs() and allowed negative values, everything is well balanced between positive and negative values.



 
Alain Verleyen #:

There is a logical issue with your indicator.

Any deviation from zero is not ideal.
 
Alain Verleyen #:

Leading question: does the terminal set the time in ticks? IMHO, the tick history is generated by the server. Then what terminal ping are we talking about?

 
Stanislav Korotky # :

Leading question: does the terminal set time in ticks? IMHO, the tick history is generated by the server. Then what terminal ping are we talking about?

Of course, I agree, it's not from the Terminal.

It is impossible to know exactly the real latency in the network.

 
Stanislav Korotky #:

Leading question: does the terminal set the time in ticks? IMHO, the tick history is generated by the server. Then what terminal ping are we talking about?

Forum on trading, automated trading systems and testing trading strategies.

New version of MetaTrader 5 build 3620: web terminal improvements, ONNX support and accelerated matrix multiplication in MQL5.

fxsaber, 2023.03.09 07:31 pm

Delays in the arrival of ticks happen. On the example of two neighbouring ticks it looks like this.

Tick.time_msc = 08:00:00.000, время прихода 08:00:00.000.

Tick.time_msc = 08:00:00.200, время прихода 08:00:00.490.

The tick came 290 milliseconds later than it should have.


I observe a similar situation with such bursts of tick arrival delay on a dedicated server with almost zero ping. From network applications there is only Terminal.

The average delay is 200 microseconds, i.e. much less than a millisecond.

Can you recommend what should be done to remove latency?


I used this indicator to visualise the lags.


Two differences are compared: between the times of ticks generation on the server and between the times of their arrival in the terminal.

 
Does it support MT4?
 
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])

Change the code to this function compatible with mt4 version