MT5とスピードの関係 - ページ 58

 
fxsaber:

SymbolInfoTickのブレーキがかかる原因は、パラレルハンドリングにあるようです。


結果(inAmount = 15)。

> SymbolInfoTick実行の場合、100ms以上。コードが自撮りであることは明らかです。しかし、通常のExpert Advisorで遅くなる原因を示しています。

トレーディング、自動売買システム、ストラテジーテストに関するフォーラム

MT5とスピードの関係

ローマン, 2020.10.14 04:54

現在のティックに対して、あらかじめ定義された変数があれば、より良い。



 
これはセルフショットと呼ぶには極めて難しい。
#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:


ガラスからチキを取り出した方がいいのでは?
測定していないのですか?

Z.u.s. or better yet FIX it ))

 
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マソ滑りました。
残りの割合としては、850%です。

 

Roman:

アントンですが、それでも19mcs滑りました。

残りの割合としては、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() は、natのメモリセルを読み込んでいるだけです。実はコストゼロくらい。

それでも疑問がある場合は、このようにするとよいでしょう。

#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()は、natのメモリセルを読み込んでいるだけです。実はコストゼロくらい。

ありがとうございます、そうですか。
でも、定義済み変数の 導入は検討してもいいのでは?
変数を読み込む方が、関数を呼び出して構造体を埋めるより速いだろう。

 
Anton:

より正確な測定方法です。

病院の平均温度。