Discussion of article "MQL5 vs QLUA - Why trading operations in MQL5 are up to 28 times faster?"

 

New article MQL5 vs QLUA - Why trading operations in MQL5 are up to 28 times faster? has been published:

Have you ever wondered how quickly your order is delivered to the exchange, how fast it is executed, and how much time your terminal needs in order to receive the operation result?

Meanwhile, there is a way to improve order execution quality by receiving a quicker response and by achieving a faster transaction speed.

September 12, 2016 we simultaneously run three speed tests on a real account with the "Otkrytie" broker in MetaTrader 5 build 1415 and Quik 7.2.23. Each test was aimed to measure specific speed characteristics, which is important for algorithmic trading:
  1. Testing of synchronous operations — a series of 10 synchronous consecutive Buy operations with a confirmation of a successful execution of each transaction on the exchange. The next operation is not executed until a response is received from the trade server confirming that the previous operation has or has not been executed on the exchange. The execution speed depends on the entire chain: the terminal — the trade server — the exchange — the trade server — the terminal. The smaller the average time of the synchronous trading operation, the better.
  2. Testing of asynchronous operations — a series of 10 asynchronous Buy operations without any confirmation of a successful transaction execution. It is a pure rate test, which measures how fast orders are sent to the exchange. The best terminal is the one that can execute 10 asynchronous Buy operations faster.
  3. Testing of order book update — measuring how fast orders in the Market Depth (order book) are updated. This is a simple counting of the number of ticks (updates) in the Market Depth per a unit of time. The more frequent quotes are received by the terminal from the exchange, the faster the order book will be updated. Therefore, the more ticks per second are received by the automated trading application, the quicker it can respond to changes in the market demand/supply structure. The best terminal is the one with the higher speed of order book update.

The results of these tests are featured in a summary table, additional detailed results of each test are available in further sections below.

Test
MetaTrader 5
QUIK
MT5 lead
The average time of a synchronous operation
9.59 ms277.80 ms28.96 times
The average time of an asynchronous operation0.09 ms0.30 ms 3.33 times
Market Depth update speed
42.7 times per second8.4 times per second5.08 times

As you can see, MetaTrader 5 shows much better results in all tests. You can reproduce the same tests using the attached source code. The testing process is demonstrated in the video below.


Author: MetaQuotes Software Corp.

 

Please do another MT5 speed test on a real account

Forum on trading, automated trading systems and testing trading strategies

Testing 'CopyTicks'

fxsaber, 2016.09.13 11:11 AM

if through OrderSendAsync send two limiters (BuyLimit1_price < BuyLimit2_price) inside the spread, will the exchange generate two consecutive ticks with bid-price improvement at the same time (with 1ms accuracy)?


 

Comments from political haters on this article

MetaQuotes Software Corp. / Клуб трейдеров sMart-Lab. Мы делаем деньги на бирже.
MetaQuotes Software Corp. / Клуб трейдеров sMart-Lab. Мы делаем деньги на бирже.
  • smart-lab.ru
Мы рады сообщить об интеграции с LMAX Exchange — многосторонней площадкой (Multilateral Trading Facility, MTF) для торговли валютами, драгоценными металлами и индексами. Шлюз MetaTrader 5 к LMAX Exchange предлагает брокерам, фондам и профессиональным трейдерам доступ к потоковой ликвидности с использованием лимитных ордеров, прозрачное...
 
//--- skip the first ticks for initial queue clearing and warming up
   tickcounter++;
   if(tickcounter<ExtSkipFirstTicks)
      return;

Clarification is required about the effect of queuing and warm-up on performance.

 

MQL5 language itself : when we are talking about milliseconds and even more so about microseconds, the speed of the automation language itself starts to take a significant part in latency.

If a trader uses interpreted languages such as QLUA/EasyLanguage, he simply loses milliseconds on strapping and is not even aware of it. Not to mention that his programme from the core of the platform can receive notifications about market activity with significant delays of hundreds of microseconds or even milliseconds.

That's why we spend so much effort on optimising MQL5 and step by step lick out bottlenecks, winning tens and hundreds of microseconds.


Recently, we have shown the speed of data display in three terminals Quik, MetaTrader 5 and SmartX on MOEX.

You should watch the market opening from 00:50 approximately: the winner is immediately visible


Forum on trading, automated trading systems and testing trading strategies

Order Execution Speed

Renat Fatkhullin, 2016.09.01 20:29

We have a pure transaction based data delivery mechanism unlike our competitors with snapshot based. That is why all single transactions (ticks are also transactions) are delivered instantly and without delays.

For example, Quik's charts live their snapshot-based life in isolation from the ticks flow. That's why charts there are visually slow compared to MetaTrader. The stack in Quick is updated up to 5 times slower compared to MT5 - we have measured it for sure. Most likely, updates are also snapshots, so as not to overload the terminal and infrastructure.

And we honestly stream all data transactionally without delays and snapshots.


 

Мы записали на видео все три теста одним роликом, чтобы было видно:

  1. trading operations were conducted on the same real account;
  2. and on the same instrument Si-9.16;
  3. on the same computer;
  4. trades were executed at the same time;
  5. under the same market conditions;
  6. the rates of stack updates were measured on the same instrument and at the same time;
  7. the network latency to Openreach's servers was 2 ms.

This, unfortunately, is not true. It should have been measured at the same time and shown on the video.

You can run MT5 on a calm market and QUICK on news. And the indicators will be completely different.

 
fxsaber:


Clarification is needed about the effect of queuing and warm-up on performance.

If you watch this video, you will see that before the start of a trading session there are several single updates of the stack. Therefore, the script skips the first N ticks to make sure that there is a real raft of orders in the stack. And only after that it starts counting ticks.


 
fxsaber:

That's unfortunately not true. It should have been measured at the same time and shown on video.

All tests were filmed sequentially in one piece at a time to keep the measurements clean.
 
Rashid Umarov:
All tests were taken sequentially in one piece at a time to keep the measurements clean.
Then the conclusions concerning the glasses can logically be questioned.
 
fxsaber:
Then the conclusions regarding glasses can logically be questioned.
The codes are provided, anyone can check for themselves and see if the conclusions are valid. There is no problem here.
 
Rashid Umarov:

If you watch this video, you will see that before the start of a trading session there are several single updates of the stack. Therefore, the script skips the first N ticks to make sure that there is a real raft of orders in the stack. And only after that it starts counting ticks.


The video shows the beginning of the session. And the video from the article shows the very "juice". And

input ulong ExtSkipFirstTicks=10;  // number of skipped ticks on start

the number is not enough for the beginning of the session. Please explain what "queue" and "warm-up" are.