Testing 'CopyTicks' - page 12

 
Dmitriy Skub:

After a year, we summarise the intermediate results:

- the CopyTicks function works correctly (as described);

- current tick data of the futures market obtained using this function coincides with the exchange data;

- futures market tick data history for the most liquid instruments is correct starting from 28.07.2016 (obviously, start of the latest server version);

All of the above applies to the MT5 terminal version 1395 and the real accounts of the derivatives market in Open-Broker. In principle, the topic is closed.

Have you checked the direction of the trades as well?
 

I had a question about CopyBuffer

Forum on trading, automated trading systems and trading strategies testing

Does mql5 allow you to write an indicator that draws charts in different windows or access indicator buffers in other windows?

fxsaber, 2016.09.09 10:20

I have this question. Is it reasonable (from performance point of view) when using CopyBuffer to add buffers by number of changed values(input parameter count is not zero) or always make a full copy of buffer?

but almost the same question about CopyTicks.

Is it reasonable (from performance point of view) when using CopyTicks to add new values to already collected ticks or to always make full request from the place, where the ticks are required and not to store previously collected values?

 
When adding ticks to a dynamic array, how much reserve_size in ArrayResize is best?
 
fxsaber:
When adding ticks to a dynamic array, how much reserve_size in ArrayResize is best?
A dynamic array is limited to INT_MAX, so it's best to set this size right away.
 
prostotrader:
A dynamic array is limited to INT_MAX, so it's best to set the array to this size right away.
It's a pity about the bird's memory.
 
prostotrader:
A dynamic array is limited to INT_MAX, so it's best to set the array to this size right away.
Mikalas, is that you? :-)
 
Dennis Kirichenko:
Mikalas, is that you? :-)
Примечание

Функция может быть применена только к динамическим массивам. При этом необходимо иметь ввиду, что нельзя изменять размер для динамических массивов, 
назначенных в качестве индикаторных буферов функцией SetIndexBuffer(). Для индикаторных буферов все операции по изменению размера производит 
исполняющая подсистема терминала.

Общее число элементов в массиве не может превышать 2147483647.
 
prostotrader:
I can see from your handwriting that you are ;-)
 

The script outputs ticks when the best gangs changed in the same millisecond

#property script_show_inputs

sinput int Count = 10000; // Количество тиков на проверку

#define  TOSTRING(A) " " + #A + " = " + (string)Tick.A

string TickToString( const MqlTick &Tick )
{
  static int i = 0;
  
  i++;
  
  return("Tick" + (string)i + ":" + TOSTRING(time) + "." + (string)(Tick.time_msc %1000) +
         TOSTRING(bid) + TOSTRING(ask) + TOSTRING(last)+ TOSTRING(volume));
}

void OnStart()
{
  MqlTick Ticks[];
  
  const int Amount = CopyTicks(_Symbol, Ticks, COPY_TICKS_INFO, 0, Count);
  
  for (int i = 1; i < Amount; i++)
    if (Ticks[i].time_msc == Ticks[i - 1].time_msc) // ищем соседние тики с одним временем (с точностью до мс)
//      if ((Ticks[i].bid > Ticks[i - 1].bid) ||(Ticks[i].ask < Ticks[i - 1].ask)) // ищем выставление лимитной заявки внутрь спреда
        Print(TickToString(Ticks[i - 1]) + "\n" + TickToString(Ticks[i]) + "\n");
}

Part of the result:

2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick14: time = 2016.09.13 10:12:55.819 bid = 98220.0 ask = 98240.0 last = 98240.0 volume = 2
2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick13: time = 2016.09.13 10:12:55.819 bid = 98230.0 ask = 98240.0 last = 98240.0 volume = 2

Here, within the same millisecond someone managed to withdraw their BuyLimit= 98230. Exactly withdrew it, not it was smatted with the marker.

Checking has shown that all such actions within one millisecond are withdrawals (not executions) of the best limit from the cup.

Another part of the result:

2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick4: time = 2016.09.13 10:00:00.235 bid = 98490.0 ask = 99040.0 last = 98500.0 volume = 8
2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick3: time = 2016.09.13 10:00:00.235 bid = 98490.0 ask = 98600.0 last = 98500.0 volume = 8
2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      
2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick2: time = 2016.09.13 10:00:00.235 bid = 98490.0 ask = 98600.0 last = 98500.0 volume = 8
2016.09.13 11:58:46.861 Test (RTS-9.16,M1)      Tick1: time = 2016.09.13 10:00:00.235 bid = 98500.0 ask = 98600.0 last = 98500.0 volume = 8

Here, somehow at the opening of the session someone managed to remove both SellLimit and BuyLimit in one millisecond. That is, two actions in one millisecond!

How can this be? After all, even HFT cannot remove a limit order within less than 1 ms.

Or if through OrderSendAsync two limit orders (BuyLimit1_price < BuyLimit2_price) are sent inside the spread, then the exchange will generate two consecutive ticks with bid-price improvement at the same time (with an accuracy to 1ms)?

 
fxsaber:


How can this be? After all, even HFTs cannot remove a limit order in less than 1ms time.


Where did you get such knowledge?

Besides Plaza II, there is a FAST/FIX protocol

There are hundreds of operations in 1ms.