MT5 y la velocidad en acción - página 58

 
fxsaber:

La razón del frenado de SymbolInfoTick parece ser el manejo paralelo.


Resultado (inAmount = 15).

> 100 ms para la ejecución de SymbolInfoTick. Está claro que el código se dispara solo. Pero muestra la razón por la que se ralentiza en los Asesores Expertos habituales.

Foro sobre comercio, sistemas de comercio automatizados y pruebas de estrategias

MT5 y Speed en acción

Roman, 2020.10.14 04:54

Las variables predefinidas, para el tick actual, serían mejores.



 
Esto es extremadamente difícil de llamar un autodisparo.
#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
{
  MqlTick Tick;

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


Resultado (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.
 
A mí también me estresa este problema.
La HFT no puede construirse con esos retrasos.
 
fxsaber:


¿No sería mejor sacar el tiki del vaso?
¿No lo has medido?

Z.u.s. o mejor aún FIX it ))

 
fxsaber:

Es mejor no identificar una nueva garrapata a través de las barras.

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

#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)
}


Resultado.

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.


¡Los bares se retrasan unos segundos con respecto al estado real! Hola amantes de las barras y los indicadores.

 
fxsaber:
Es muy difícil llamar a eso un autodisparo.
#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnTick()
{
  MqlTick Tick;

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

Resultado (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.


¿Cómo se hace esto?

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 gráficos.

Construye 2656.

 

Ahh, ¿había 1000 consultas allí?
Sólo que no está en el ordenador para comprobarlo.

fxsaber, y realmente ¿por qué habría 1000 consultas para el tick actual?

Anton, pero aún así se deslizó 19 mcs.
Como porcentaje del resto, es el 850%

 

Roman:

Anton, pero aún así se deslizó 19 mcs.

Como porcentaje del resto, es el 850%.

A veces la propia medición es lenta, por ejemplo ::GetMicrosecondCount().

Un ejemplo sencillo:

#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 gráficos.

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() sólo está leyendo una celda de memoria en la nativa. En realidad, el coste es cero.

Si todavía tienes dudas, puedes hacerlo de esta manera:

#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.

Esto es algo que hay que tener en cuenta a la hora de evaluar la medición de las acciones puntuales a través de este parámetro.

Una forma más precisa de medir:

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 gráficos.

Bild 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:

A veces la propia medición es lenta, por ejemplo ::GetMicrosecondCount().

Un ejemplo sencillo:

20 gráficos.

GetLastError() sólo está leyendo una celda de memoria en la nat. En realidad, el coste es cero.

Gracias, ya veo.
Pero, ¿aún así se puede considerar la introducción de variables predefinidas?
La lectura de una variable sería probablemente más rápida que llamar a una función y llenar una estructura.

 
Anton:

Una forma más precisa de medir:

Temperatura media del hospital.