MT5 and speed in action - page 24

 
Artyom Trishkin:

Most likely after the next release version (now in beta)

Thanks
 
Artyom Trishkin:

Most likely after the next release version (now in beta)

Won't there be an array of deals?

 

Forum on trading, automated trading systems and trading strategy testing

MT5 and Speed in Action

fxsaber, 2020.08.13 04:36

  1. Go to the MetaQuotes-Demo demo account with a relatively long trading history.
    1. If your demo account has little trading history, then allow auto-trading and in parallel run the script OrderSend-Test2.ex5 (in the attachment, the source code).

This ancient script shows many brakes if you run it on one MQ-Demo chart and add more trading symbols to Market Watch (I had 100).

Terminal Log.

2020.09.04 17:51:33.112 Trades  '34510052': cancel order #702851395 buy stop 0.01 EURCAD at 1.55852
2020.09.04 17:51:33.512 Trades  '34510052': accepted cancel order #702851395 buy stop 0.01 EURCAD at 1.55852
2020.09.04 17:51:33.514 Trades  '34510052': cancel #702851395 buy stop 0.01 EURCAD at market done in 401.845 ms

The deletion of the pending trade occurred in 401ms. The developers have access to the trading server logs and can see how long the execution lasted there. For example.

Everyone can reproduce it on their site.


Just in case, this is what a trade order with results looks like.

2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Alert: EURCAD 702851395 Request executed 401.915 + 0.003 (0) ms.
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.action = TRADE_ACTION_REMOVE (8)
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.magic = 0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.order = 702851395
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.symbol = EURCAD
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.volume = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.price = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.stoplimit = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.sl = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.tp = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.deviation = 0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.type = ORDER_TYPE_BUY (0)
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.type_filling = ORDER_FILLING_FOK (0)
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.type_time = ORDER_TIME_GTC (0)
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.expiration = 1970.01.01 00:00:00
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.comment = 
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.position = 0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Request.position_by = 0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.retcode = 10009
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.deal = 0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.order = 702851395
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.volume = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.price = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.bid = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.ask = 0.0
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.comment = Request executed 401.915 + 0.003 (0) ms.
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.request_id = 6133
2020.09.04 17:51:33.514 OrderSend-Test2 (EURUSD,M1)     Result.retcode_external = 0


Ping.

2020.09.04 17:51:57.567 AccountInfoString(ACCOUNT_SERVER) = MetaQuotes-Demo
2020.09.04 17:51:57.567 TerminalInfoInteger(TERMINAL_PING_LAST) = 74808


The script worked for about 10 minutes.


I don't care about these slowdowns. I just want to know where and what I can adjust to improve the situation. Is it the Terminal or the trading server? In general, the developers have all possibilities to reproduce and, if desired, to understand.

Особенности исполнения торговых приказов MT5
Особенности исполнения торговых приказов MT5
  • 2020.02.06
  • www.mql5.com
Анализировал с владельцем MT5-сервера тормоза торговых приказов. Запускался OrderSend-Test2.mq5 в том же месте, где MT5-сервер стоит. Т.е. нулевой пинг. Демо, все внутри. Изучались логи MT5-сервера (2170) и MT5-клиента (2280). Логи сервера не буду приводить, просто словами опишу. Думаю, результаты буду интерсны всем, т.к. это поможет раскрыть...
 
fxsaber:

This ancient script will show many brakes if you run it on a single MQ-Demo chart and add more trading symbols to Market Watch (I had 100).

I remember this case

Forum on trading, automated trading systems and strategy testing

New version of MetaTrader 5 platform build 1880: Calculation of full synthetic instrument history

A100, 2018.07.25 21:55

The load needs to be taken into account in any case:

I have a slow computer... and I have a very slow one... So... If I add 63 symbols in Market Watch and press F10 after that, MetaTrader hangs hard (has to restart)... while in all other modes it works fine

I tried to use F10 but it kept on hanging for at least a year - although it was on 32 bit version

 
A100:

I remember a case like this

The number of characters in the Market Review is not crucial to playing brakes. It's just the way I've done it in mine.

It's easy to reproduce.
2020.09.04 18:25:06.131 Trades  '34510052': buy limit 0.01 USDPLN at 3.77653
2020.09.04 18:25:06.202 Trades  '34510052': accepted buy limit 0.01 USDPLN at 3.77653
2020.09.04 18:25:06.202 Trades  '34510052': order #702911224 buy limit 0.01 / 0.01 USDPLN at 3.77653 done in 70.966 ms
2020.09.04 18:25:06.202 Trades  '34510052': cancel order #702911224 buy limit 0.01 USDPLN at 3.77653
2020.09.04 18:25:06.274 Trades  '34510052': accepted cancel order #702911224 buy limit 0.01 USDPLN at 3.77653
2020.09.04 18:25:06.274 Trades  '34510052': cancel #702911224 buy limit 0.01 USDPLN at market done in 71.859 ms
2020.09.04 18:25:06.274 Trades  '34510052': buy stop 0.01 USDPLN at 3.79653
2020.09.04 18:25:06.481 Trades  '34510052': instant sell 0.1 NZDSGD at 0.91421, close #702903930 buy 0.1 NZDSGD 0.91462
2020.09.04 18:25:06.982 Trades  '34510052': accepted buy stop 0.01 USDPLN at 3.79653
2020.09.04 18:25:07.030 Trades  '34510052': order #702911229 buy stop 0.01 / 0.01 USDPLN at 3.79653 done in 755.302 ms
2020.09.04 18:25:07.030 Trades  '34510052': accepted instant sell 0.1 NZDSGD at 0.91421, close #702903930 buy 0.1 NZDSGD 0.91462
2020.09.04 18:25:07.030 Trades  '34510052': deal #681898561 sell 0.1 NZDSGD at 0.91421 done (based on order #702911234)
2020.09.04 18:25:07.031 Trades  '34510052': cancel order #702911229 buy stop 0.01 USDPLN at 3.79653
2020.09.04 18:25:07.031 Trades  '34510052': order #702911234 sell 0.1 / 0.1 NZDSGD at 0.91421 done in 550.273 ms
2020.09.04 18:25:07.103 Trades  '34510052': accepted cancel order #702911229 buy stop 0.01 USDPLN at 3.79653
2020.09.04 18:25:07.103 Trades  '34510052': cancel #702911229 buy stop 0.01 USDPLN at market done in 72.558 ms
2020.09.04 18:25:07.103 Trades  '34510052': instant buy 0.01 USDHUF at 297.871 (deviation: 100)
2020.09.04 18:25:07.130 Trades  '34510052': instant sell 0.01 GBPCAD at 1.73255, close #702904086 buy 0.01 GBPCAD 1.73271
2020.09.04 18:25:07.174 Trades  '34510052': accepted instant buy 0.01 USDHUF at 297.871 (deviation: 100)
2020.09.04 18:25:07.174 Trades  '34510052': deal #681898572 buy 0.01 USDHUF at 297.871 done (based on order #702911246)
2020.09.04 18:25:07.175 Trades  '34510052': order #702911246 buy 0.01 / 0.01 USDHUF at 297.871 done in 72.051 ms
There is only 1ms between the two red local times, which should actually be 550ms (consecutive OrderSend). Apparently, Print-snapshots have an effect here too.
 
Renat Fatkhullin:

For the sake of your position, any self-shooting is in order?

// Демонстрация тормозов HistorySelect.
#include <fxsaber\Benchmark.mqh> // https://c.mql5.com/3/321/Benchmark.mqh

input int inAlertTime = 1; // Нижний порог в миллисекундах

#define _B2(A) _B(A, inAlertTime)

const bool Init = EventSetTimer(1);

void OnTimer()
{
  static MqlTradeRequest Request = {0};
  static MqlTradeResult Result = {0};

  if (Request.tp) // Если позиция выставлена - меняем тейк.
  {
    static bool Flag = false;

    Request.action = TRADE_ACTION_SLTP;
    Request.tp += (1 - ((Flag = !Flag) << 1)) * _Point;
        
    if (Result.order)
      Request.position = Result.order;
  }
  else // Иначе выставляем позицию.
  {
    Request.action = TRADE_ACTION_DEAL;
    Request.symbol = _Symbol;
    Request.volume = 0.1;
    Request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
    Request.tp = Request.price + 1000 * _Point;         
  }

  if (OrderSend(Request, Result))
    _B2(HistorySelect(0, INT_MAX)); // В каком месте самострел?
}


Result on b2592 MQ-Demo.

2020.09.04 23:30:32.661 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:33.681 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:34.655 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:35.674 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:36.657 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:37.668 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:38.661 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.04 23:30:39.666 Alert: Time[Test6.mq5 35: HistorySelect(0,INT_MAX)] = 5 ms.

There is a lag on every call.

 
Also about delays

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

A100, 2020.08.31 15:55

I have a very good timeframe, especially for EURUSD, crosshair moves very slowly following the cursor, it is enough to move the cursor smoothly diagonally to reproduce it. It is OK in other timeframes. There was no such delay before

And all manual plotting (trend, Fibonacci, etc.) is also slow

All settings are by default:

  • Server: MetaQuotes-Demo
  • History: available since 01.01.1971
  • Precise time frame: none
  • Max bars in window: 100000
  • Chart type: candlesticks
  • Scaling down of the chart: Maximum

Symbol, period bars latency
EURUSD, Mounthly 597 go to
EURUSD, Weekly
2590 Check out
EURUSD, Daily

12797

no

Some kind of inverse dependence: the less bars, the slower

On monthly and weekly charts for example EURGBP (where there is no such deep history) - no delays

 
A100:

Some kind of inverse relationship: the lower the bars, the slower

Rather, it is direct - the higher the TF, the longer the delay.

Apparently, this is due to precise calculation of coordinates by the lower TF. Somewhere messed up with getting the indices of the bars included in the weekly/monthly bar we're looking for.

ps: everything works for me, same number of bars

 
Andrey Khatimlianskii:

More like a straight line - the higher the TF, the greater the delay.

Apparently, due to accurate calculation of coordinates on the lower TF. Somewhere they messed up with getting indices of bars included in the required weekly/monthly bar.

ps: everything works for me, same number of bars

Of course no EAs/indicators/scripts are running - only manual creation. The latency shown is reproducible on any average modern 64bit tablet. If you have an i7 computer, I assume you haven't encountered this delay
 
A100:
Naturally, no experts/indicators/scripts are running - only manual builds. The latency indicated is reproducible on any average modern 64-bit tablet. If you have an i7 computer, I assume you haven't encountered this delay

I probably should have specified that a tablet was being used.

I have an i5