MT5 и скорость в боевом исполнении - страница 58

 
fxsaber:

Похоже, причина тормозов SymbolInfoTick в параллельном обращении.


Результат (inAmount = 15).

> 100 ms на выполнение SymbolInfoTick. Понятно, что код самострел. Но он показывает причину, почему проскакивают тормоза на обычных советниках.

 
Такое крайне сложно назвать самострелом.
#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
{
  MqlTick Tick;

  _B(SymbolInfoTick(_Symbol, Tick), 1000);
}


Результат (inAmount = 15).

2020.10.20 07:43:16.687 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1476 mcs.
2020.10.20 07:57:21.730 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1904 mcs.
2020.10.20 08:00:25.089 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1676 mcs.
2020.10.20 08:02:27.279 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1383 mcs.
2020.10.20 08:02:41.126 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1506 mcs.
2020.10.20 08:03:34.680 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3046 mcs.
2020.10.20 08:03:34.742 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 36763 mcs.
2020.10.20 08:10:47.359 Test9 (EURCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1415 mcs.
2020.10.20 08:11:30.653 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 5832 mcs.
2020.10.20 08:13:37.736 Test9 (AUDCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 26816 mcs.
2020.10.20 08:13:47.453 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 21976 mcs.
2020.10.20 08:13:50.815 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 15876 mcs.
2020.10.20 08:14:10.315 Test9 (CADCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 15718 mcs.
2020.10.20 08:14:36.255 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 10142 mcs.
2020.10.20 08:14:36.392 Test9 (EURUSD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2571 mcs.
2020.10.20 08:15:16.985 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7113 mcs.
2020.10.20 08:16:48.631 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2069 mcs.
2020.10.20 08:16:55.178 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 6040 mcs.
2020.10.20 08:17:00.015 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3185 mcs.
2020.10.20 08:23:11.912 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1459 mcs.
2020.10.20 08:25:17.511 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1289 mcs.
2020.10.20 08:25:53.496 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 5905 mcs.
2020.10.20 08:27:20.446 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 8505 mcs.
2020.10.20 08:27:22.821 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1287 mcs.
2020.10.20 08:27:31.528 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1196 mcs.
2020.10.20 08:27:59.563 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 13283 mcs.
2020.10.20 08:28:43.103 Test9 (CADJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1073 mcs.
2020.10.20 08:29:08.284 Test9 (CADJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2493 mcs.
2020.10.20 08:30:01.088 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7911 mcs.
2020.10.20 08:30:24.796 Test9 (EURCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2733 mcs.
2020.10.20 08:30:29.838 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1340 mcs.
2020.10.20 08:31:04.041 Test9 (AUDCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1347 mcs.
2020.10.20 08:31:21.987 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7660 mcs.
2020.10.20 08:32:47.860 Test9 (AUDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1642 mcs.
2020.10.20 08:33:28.522 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3231 mcs.
2020.10.20 08:33:31.120 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1169 mcs.
2020.10.20 08:33:42.686 Test9 (EURGBP,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 22864 mcs.
 
Меня тоже напрягает эта проблема.
HFT не построить при таких задержках.
 
fxsaber:


Может лучше из стакана брать тики?
Не замерял ?

З.Ы. а лучше свой FIX запилить ))

 
fxsaber:

Через бары новый тик лучше не определять.

// Насколько бары отстают от тиков.

#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

// Идентификация нового тика
bool IsNewTick_CopyRates()
{
  static MqlRates PrevRates = {0};
  MqlRates Rates[1];
    
  const bool Res = (::CopyRates(_Symbol, PERIOD_CURRENT, 0, 1, Rates) == 1) &&
//                   (_R(PrevRates) != Rates[0]); // TypeToBytes.mqh
                   ((Rates[0].time != PrevRates.time) ||
                    (Rates[0].tick_volume > PrevRates.tick_volume) ||
                    (Rates[0].close != PrevRates.close)); // Лишнее условие, но на всякий случай.
                   
  if (Res)
    PrevRates = Rates[0];
    
  return(Res);
}

void OnTick()
{
  _BV(while (!IsNewTick_CopyRates());, 100)
}


Результат.

2020.10.20 09:14:03.892 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 116743 mcs.
2020.10.20 09:14:07.467 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 2079963 mcs.
2020.10.20 09:14:13.788 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 4832700 mcs.
2020.10.20 09:14:16.028 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 529991 mcs.
2020.10.20 09:14:18.235 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 353948 mcs.
2020.10.20 09:14:22.198 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 1591809 mcs.
2020.10.20 09:14:25.960 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 117302 mcs.
2020.10.20 09:14:26.103 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 60079 mcs.
2020.10.20 09:14:26.222 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 53880 mcs.
2020.10.20 09:14:26.393 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 40772 mcs.
2020.10.20 09:14:27.054 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 214792 mcs.
2020.10.20 09:14:29.180 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 404409 mcs.
2020.10.20 09:14:42.721 Test9 (AUDCAD,M1)       Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 25 in OnTick: while(!IsNewTick_CopyRates());] = 13207442 mcs.


Отставание баров от актуального состояния на секунды! Привет любителям баров и индикаторов.

 
fxsaber:
Такое крайне сложно назвать самострелом.
#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
{
  MqlTick Tick;

  _B(SymbolInfoTick(_Symbol, Tick), 1000);
}

Результат (inAmount = 15).

2020.10.20 07:43:16.687 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1476 mcs.
2020.10.20 07:57:21.730 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1904 mcs.
2020.10.20 08:00:25.089 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1676 mcs.
2020.10.20 08:02:27.279 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1383 mcs.
2020.10.20 08:02:41.126 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1506 mcs.
2020.10.20 08:03:34.680 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3046 mcs.
2020.10.20 08:03:34.742 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 36763 mcs.
2020.10.20 08:10:47.359 Test9 (EURCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1415 mcs.
2020.10.20 08:11:30.653 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 5832 mcs.
2020.10.20 08:13:37.736 Test9 (AUDCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 26816 mcs.
2020.10.20 08:13:47.453 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 21976 mcs.
2020.10.20 08:13:50.815 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 15876 mcs.
2020.10.20 08:14:10.315 Test9 (CADCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 15718 mcs.
2020.10.20 08:14:36.255 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 10142 mcs.
2020.10.20 08:14:36.392 Test9 (EURUSD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2571 mcs.
2020.10.20 08:15:16.985 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7113 mcs.
2020.10.20 08:16:48.631 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2069 mcs.
2020.10.20 08:16:55.178 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 6040 mcs.
2020.10.20 08:17:00.015 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3185 mcs.
2020.10.20 08:23:11.912 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1459 mcs.
2020.10.20 08:25:17.511 Test9 (GBPJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1289 mcs.
2020.10.20 08:25:53.496 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 5905 mcs.
2020.10.20 08:27:20.446 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 8505 mcs.
2020.10.20 08:27:22.821 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1287 mcs.
2020.10.20 08:27:31.528 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1196 mcs.
2020.10.20 08:27:59.563 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 13283 mcs.
2020.10.20 08:28:43.103 Test9 (CADJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1073 mcs.
2020.10.20 08:29:08.284 Test9 (CADJPY,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2493 mcs.
2020.10.20 08:30:01.088 Test9 (GBPAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7911 mcs.
2020.10.20 08:30:24.796 Test9 (EURCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2733 mcs.
2020.10.20 08:30:29.838 Test9 (GBPCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1340 mcs.
2020.10.20 08:31:04.041 Test9 (AUDCHF,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1347 mcs.
2020.10.20 08:31:21.987 Test9 (EURCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 7660 mcs.
2020.10.20 08:32:47.860 Test9 (AUDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1642 mcs.
2020.10.20 08:33:28.522 Test9 (EURAUD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3231 mcs.
2020.10.20 08:33:31.120 Test9 (USDCAD,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 1169 mcs.
2020.10.20 08:33:42.686 Test9 (EURGBP,H1)       Alert: Bench_Stack = 0, 1000 <= Time[Test9.mq5 95 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 22864 mcs.


Как вы это делаете?

2020.10.20 10:18:05.087 SymbolInfoTick (USDJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:05.185 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:06.093 SymbolInfoTick (CADJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:06.192 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:07.294 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:09.707 SymbolInfoTick (USDJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:11.110 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:11.110 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:11.110 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:11.111 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3 mcs.
2020.10.20 10:18:11.511 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:11.512 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 19 mcs.
2020.10.20 10:18:12.118 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:12.517 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:12.916 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:12.916 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 3 mcs.
2020.10.20 10:18:13.020 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:13.420 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:14.026 SymbolInfoTick (CADJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:14.125 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:14.531 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:15.234 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:15.732 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
2020.10.20 10:18:15.830 SymbolInfoTick (CADJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 7 in OnTick: SymbolInfoTick(_Symbol,Tick)] = 2 mcs.
#include <Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
  {
   MqlTick Tick;

   _B(SymbolInfoTick(_Symbol, Tick), 1);
  }

20 чартов.

Билд 2656.

 

Ааа, там 1000 запросов было?
Просто не у компа, чтоб проверить.

fxsaber, а действительно нафига 1000 запросов делать на текущий тик?

Антон, но все равно проскочило 19 mcs. 
В процентном соотношении с остальными показателями, это 850% 

 

Roman:

Антон, но все равно проскочило 19 mcs. 

В процентном соотношении с остальными показателями, это 850% 

Бывает что тормозит сам замер, т.е. ::GetMicrosecondCount().

Простой пример:

#include <Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
  {
   MqlTick Tick;

   for(int i=0;i<10;i++)
      _B(GetLastError(), 1);
  }

20 чартов.

2020.10.20 10:42:55.843 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 18 mcs.
2020.10.20 10:43:06.371 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 16 mcs.
2020.10.20 10:43:12.098 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 19 mcs.
2020.10.20 10:43:17.716 SymbolInfoTick (GBPCHF,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 15 mcs.
2020.10.20 10:43:31.359 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 2 mcs.
2020.10.20 10:43:35.276 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 17 mcs.
2020.10.20 10:43:45.814 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 8 in OnTick: GetLastError()] = 6 mcs.

GetLastError() - просто чтение ячейки памяти в нативе. Фактически околонулевая стоимость.

Если все еще сомневаетесь, то можно так:

#include <Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
  {
   MqlTick Tick;

   int x=0;
   for(int i=0;i<10;i++)
      _B(x++, 1);
  }
2020.10.20 10:46:09.755 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 20 mcs.
2020.10.20 10:46:17.473 SymbolInfoTick (EURUSD,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 17 mcs.
2020.10.20 10:46:39.039 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 18 mcs.
2020.10.20 10:47:17.661 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 2 mcs.
2020.10.20 10:47:32.000 SymbolInfoTick (CADJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 17 mcs.
2020.10.20 10:47:57.485 SymbolInfoTick (EURUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 17 mcs.
2020.10.20 10:48:00.802 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 19 mcs.
2020.10.20 10:48:01.606 SymbolInfoTick (USDJPY,H1)      Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 17 mcs.
2020.10.20 10:48:06.928 SymbolInfoTick (AUDUSD,M15)     Bench_Stack = 0, 1 <= Time[SymbolInfoTick.mq5 9 in OnTick: x++] = 2 mcs.

Это надо иметь ввиду оценивая замер разовых действий через данный бенчмарк.

Более точный способ замера:

void OnTick()
  {
   MqlTick Tick;

   ulong gstart=GetMicrosecondCount();

   int   count=10000;
   for(int i=0; i<count; i++)
     {
      SymbolInfoTick(_Symbol, Tick);
     }

   ulong gend=GetMicrosecondCount()-gstart;
   Print(count," iterations, total time ", DoubleToString(gend/1000.0,3)," ms; avr time: ",DoubleToString(gend/1000.0/count,3)," ms");
  }

20 чартов.

Билд 2656.

2020.10.20 10:55:12.725 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.031 ms; avr time: 0.001 ms
2020.10.20 10:55:12.726 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.799 ms; avr time: 0.001 ms
2020.10.20 10:55:12.726 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.080 ms; avr time: 0.001 ms
2020.10.20 10:55:12.727 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.181 ms; avr time: 0.001 ms
2020.10.20 10:55:12.727 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.158 ms; avr time: 0.001 ms
2020.10.20 10:55:12.727 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.202 ms; avr time: 0.001 ms
2020.10.20 10:55:12.727 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.206 ms; avr time: 0.001 ms
2020.10.20 10:55:13.030 SymbolInfoTick (GBPCHF,H1)      10000 iterations, total time 0.433 ms; avr time: 0.000 ms
2020.10.20 10:55:13.528 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 6.344 ms; avr time: 0.001 ms
2020.10.20 10:55:13.530 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 8.253 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 9.745 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 9.873 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.392 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.201 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.020 ms; avr time: 0.001 ms
2020.10.20 10:55:13.532 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 10.388 ms; avr time: 0.001 ms
2020.10.20 10:55:14.439 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 11.488 ms; avr time: 0.001 ms
2020.10.20 10:55:14.439 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 12.251 ms; avr time: 0.001 ms
2020.10.20 10:55:14.439 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 12.257 ms; avr time: 0.001 ms
2020.10.20 10:55:14.440 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 12.495 ms; avr time: 0.001 ms
2020.10.20 10:55:14.440 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 12.624 ms; avr time: 0.001 ms
2020.10.20 10:55:14.440 SymbolInfoTick (AUDUSD,M15)     10000 iterations, total time 12.592 ms; avr time: 0.001 ms
 
Anton:

Бывает что тормозит сам замер, т.е. ::GetMicrosecondCount().

Простой пример:

20 чартов.

GetLastError() - просто чтение ячейки памяти в нативе. Фактически околонулевая стоимость.

Спасибо, понятно.
Но может всё же рассмотрите введение предопределенных переменных?
Чтение переменной ведь быстрее наверно будет, чем вызов функции и заполнение структуры.

 
Anton:

Более точный способ замера:

Средняя температура по больнице.