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

 
Rashid Umarov:
The codes are provided, anyone can check for themselves and see if the conclusions are valid. There's no problem here.

My code

sinput int Interval = 30; // Interval in seconds

class BENCH
{
protected:
  MqlTick FirstTick;
  int Count;
  ulong StartTime;

  int GetAmountTicks( const ulong From = 0, const int Amount = 10000 ) const
  {
    MqlTick Ticks[];

    return(::CopyTicks(this.symbol, Ticks, COPY_TICKS_ALL, From, Amount));
  }
  void Init( void )
  {
    this.Count = 0;

    this.GetAmountTicks(); // warming up
    ::SymbolInfoTick(this.symbol, this.FirstTick);

    this.StartTime = ::GetMicrosecondCount();

    return;
  }

public:
  const string symbol;
  const int TimerInterval;

  BENCH( const int iTimerInterval, const string Symb = NULL ) :
         symbol((Symb == NULL) ? ::Symbol() : Symb), TimerInterval(iTimerInterval * (int)1 e6)
  {
    this.Init();

    this.StartTime = 0;
  }

  ~BENCH( void )
  {
    ::Comment("");
  }

  void Refresh( const string Symb )
  {
    if (Symb == this.symbol)
    {
      if (this.GetBenchTime() >= this.TimerInterval)
      {
        if (Count > 0)
          ::Alert(this.ToString());

        this.Init();
      }

      Count++;
    }

    return;
  }
  int GetBenchTime( void ) const
  {
    return((int)(::GetMicrosecondCount() - this.StartTime));
  }

  string ToString( void ) const
  {
    const ulong BenchTime = this.GetBenchTime();
    const int Amount = this.GetAmountTicks(this.FirstTick.time_msc);

    if ((BenchTime == 0) || (Amount == 0))
     return(NULL);

    const double Velocity1 = 1 e6 * this.Count / BenchTime;
    const double Velocity2 = 1 e6 * Amount / BenchTime;

    return((string)this.Count + "/" + (string)Amount + " = " + ::DoubleToString(100.0 * Count / Amount, 2) + "%, ExChange_History = " +
           ::DoubleToString(Velocity2, 1) + " ticks/sec, MT5_RealTime = " + ::DoubleToString(Velocity1, 1) + " units/sec, Interval = " +
           ::DoubleToString(BenchTime / 1 e6, 1) + " sec.");
  }
};

class BENCH_BOOK : public BENCH
{
public:
  BENCH_BOOK( const int iTimerInterval, const string Symb = NULL ) : BENCH(iTimerInterval, Symb)
  {
    ::MarketBookAdd(this.symbol);
  }

  ~BENCH_BOOK( void )
  {
    ::MarketBookRelease(this.symbol);
  }
};

/*
BENCH Bench(Interval);

void OnTick( void )
{
 Bench.Refresh(_Symbol);

 return;
}
*/

BENCH_BOOK BenchBook(Interval);

void OnBookEvent(const string &symbol )
{
  BenchBook.Refresh(symbol);

  return;
}

Result

2016.09.13 17:18:35.667 Bench (Si-9.16,M1)      851/754 = 112.86%, ExChange_History = 25.1 ticks/sec, MT5_RealTime = 28.3 units/sec, Interval = 30.1 sec.
2016.09.13 17:18:05.524 Bench (Si-9.16,M1)      662/506 = 130.83%, ExChange_History = 16.9 ticks/sec, MT5_RealTime = 22.1 units/sec, Interval = 30.0 sec.
2016.09.13 17:17:35.424 Bench (Si-9.16,M1)      883/1610 = 54.84%, ExChange_History = 53.6 ticks/sec, MT5_RealTime = 29.4 units/sec, Interval = 30.0 sec.
2016.09.13 17:17:05.319 Bench (Si-9.16,M1)      834/2707 = 30.81%, ExChange_History = 90.1 ticks/sec, MT5_RealTime = 27.8 units/sec, Interval = 30.0 sec.
2016.09.13 17:16:35.196 Bench (Si-9.16,M1)      789/627 = 125.84%, ExChange_History = 20.9 ticks/sec, MT5_RealTime = 26.3 units/sec, Interval = 30.0 sec.
2016.09.13 17:16:05.110 Bench (Si-9.16,M1)      900/822 = 109.49%, ExChange_History = 27.4 ticks/sec, MT5_RealTime = 30.0 units/sec, Interval = 30.0 sec.
2016.09.13 17:15:34.993 Bench (Si-9.16,M1)      772/747 = 103.35%, ExChange_History = 24.8 ticks/sec, MT5_RealTime = 25.7 units/sec, Interval = 30.1 sec.

You can clearly see how much the results differ even on neighbouring half minutes. Comparison of glasses should be done ONLY at the same time!

[Deleted]  
Тестирование синхронных операций - a series of 10 synchronousconsecutive Buy trade operationswith confirmation of the success of each transaction on the exchange. Subsequent operation is not performed until a confirmation is received from the trade server that the transaction has passed/failed at the exchange. Execution speed depends on the whole chain terminal - trade server - exchange - trade server - terminal. The less the average time of a synchronous trade operation is, the better.
//--- run the operation loop
      for(int i=0;i<Trades;i++)
        {
         req.price  =SymbolInfoDouble(_Symbol,SYMBOL_ASK);
         req.comment=string(i+1);
         //--- action
         if(!OrderSend(req,res))
           {
            PrintFormat("OrderSend() failed, retcode=%d",res.retcode);
           }
         else
           {
            trades_finished++;
            PrintFormat("#%d Buy %s 1 lot",i+1,_Symbol);
           }
        }

Where is the confirmation you write about? I didn't notice it in the code. If you mean the response from OrderSend(), then from the help:

Return value

In case of successful basic structure checking (pointer checking), true is returned - it does not indicate successful execution of the trade operation. To get a more detailed description of the result of the function execution, you should analyse the fields of the result structure .

Please explain.
 
fxsaber:

The video shows the beginning of the session. And the video in the article is the juice. And

the number is not enough to start the session. Please explain what is a "queue" and "warm-up".

Look at the time in the tests - it is the middle of a quiet day, not the start of the session. So skipping a small number of ticks is reasonable and it's enough to avoid potential residuals of unselected ticks.

It's not like we're forum kids to not know how to run test measurements and then lose out due to poor evidence. Tests were run dozens of times to make sure there were no errors. Only after that was publication.

 
Alexey Kozitsyn:

Where's the confirmation you're talking about? I didn't notice it in the code. If you mean the response from OrderSend(), then from the help:

Please explain.

OrderSend is a 100% synchronous operation that waits for the results of a complete order placement in the server.

That is, in case of external exchange execution, it is a full cycle of processing with exchange confirmation of order placement.

 
Renat Fatkhullin:

Look at the time in the tests - it's the middle of a quiet day, not the start of a session.

Your colleague said about the session

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.


If the code has remained unchanged from the previous video, it's a different matter.
 
fxsaber:

My code

Result

You can clearly see how much the results differ even on neighbouring half minutes. Comparison of glasses should be done ONLY at the same time!

Simultaneous is when you have a difference in measurements floating around like 10%.

But when by the results of dozens of tests you have a stable difference of 4-5 times, there is nothing to discuss.

 
Alexey Kozitsyn:

Where's the confirmation you're talking about? I didn't notice it in the code. If you mean the response from OrderSend(), then from the help:

Please explain.

OrderSend returns the same value as OrderCheck. But in this case, in case of returning true, OrderSend will finish its execution only when the response from the trade server arrives.

The trade server (gateway) is a pipe to the exchange, where only the GO is checked. Therefore, if the GO is wrong, the order will not reach the exchange. And in this sense you are right that it is good to check MqlTradeResult. But in this case the GO was in order every time, so all orders were sent to the exchange. And OrderSend ended its work after receiving exactly the exchange response.

So the result is correct.

 
fxsaber:
Your colleague said about the session
If the code is unchanged from the previous video, that's different.

You are confused with another video presented for visual comparison of session start in three terminals. In this video https://www.youtube.com/watch?v=i5vvD66I3Ik it is easy to see the clear visual superiority of MT5 in data update speed.

In the article https://www.mql5.com/en/articles/2635 we proved the difference in speed on the figures and specially took the middle of the day (2016.09.12 13:57 GMT+1), so that there were no complaints about the potential possibility of someone's brakes at the start of the market. The video from the article https://www.youtube.com/watch?v=J5nqWGQ1zh8 shows a clean sequential measurement for three minutes without any interruptions.

3markets 25082016 blur
3markets 25082016 blur
  • 2016.08.25
  • www.youtube.com
Запись стаканов в терминалах MetaTrader 5, Quik и SmartX 25 августа 2016. Инструмент Si-9.16
 
Renat Fatkhullin:

You are confused with another video presented for visual comparison of session start in three terminals. In this video https://www.youtube.com/watch?v=i5vvD66I3Ik it is easy to notice a clear visual superiority of MT5 in the speed of data update.

In the article https://www.mql5.com/en/articles/2635 we proved the difference in speed on the numbers and took the middle of the day (13:57 GMT+1) on purpose, so that there would be no claims about potential possibility of someone's brakes at the start of the market. The video from the article https://www.youtube.com/watch?v=J5nqWGQ1zh8 shows a clean sequential measurement over three minutes.

I only had a question about the comment in the source to the current article

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "Comparison of MQL5 and QLUA - why are trading operations in MQL5 up to 28 times faster?".

fxsaber, 2016.09.13:25 pm

 //--- skip the first ticks for initial queue clearing and warming up
   tickcounter++;
   if(tickcounter<ExtSkipFirstTicks)
      return;

Need clarification about the impact of queuing and warm-up on performance.

If it is a rudiment (from the previous video) - one thing, if not - another.
 
fxsaber:
I only had a question about the comment in the source to the current article
If it's a rudiment (from the previous video) - one thing, if not - another.

Any test should contain cold start protection.

So skipping N ticks is an indication that we are aware and taking this into account. Just to avoid the obviously expected "why didn't you compensate for the cold start" claim.


The video about the start of the session of three terminals was prepared on 25 August 2016 for another claim of a trader who claimed that MT5 slows down at the start of the session. As it turned out later, this trader did not use MT5 at all, but broadcasted speculations from the forum. It also turned out that some traders were not aware that for exchange instruments charts are built not by Bid, but by traded Last prices. They perceived the change of Bids in the stack and their non-display on the charts as "MT5 brakes".

Of course, there are no brakes.