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

 

Si durante la ejecución larga en frío (con la carga desde el servidor) CopyTicks hacer la modificación de la orden, que va a pasar (no en el servidor, pero en el Terminal - OnTradeTransaction) con un retraso significativo.

Por ejemplo, en modo normal 100 ms, en modo superior - 2000 ms.

 
Hay que aprender a trabajar con garrapatas de alguna manera. No funciona.

¿Cómo hacer que CopyTicks por ticks más cercanos sea rápido y no consuma cientos de megabytes?

#property description "Если ваш робот использует тики (таких не встречал!),"
#property description "то вы сталкиваетесь либо с тормозами,"
#property description "либо с запредельным использованием памяти."
#property description "Что не позволит вам спокойно поставить робота на VPS.\n"
#property description "Для тех, кто считает возможным для себя участие в деле исправления этого бага,"
#property description "просто опубликуйте результат выполнения этого скрипта по ссылке ниже.\n"
#property description "https://www.mql5.com/ru/forum/342090/page81#comment_20534660"
#property description "Эта ссылка доступна к копировнию в буфер обмена в Журнале (Эксперты)."

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

const bool Init = EventSetTimer(1);

// Вызывается CopyTicks для каждого символа из Обзора рынка.
void CopyTicks_Test()
{
  static MqlTick Ticks[2000];    
  
  for (int i = SymbolsTotal(true) - 1; !IsStopped() && (i >= 0); i--)
  {
    const string Symb = SymbolName(i, true);
    
    if (!SymbolInfoInteger(Symb, SYMBOL_CUSTOM))
    {
      CopyTicks(Symb, Ticks, COPY_TICKS_ALL, TimeCurrent() * 1000, 1);
//      CopyTicksRange(Symb, Ticks, COPY_TICKS_ALL, TimeCurrent() * 1000);        
    }
  }
  
}

// Вызывается CopyTicksRange для каждого символа из Обзора рынка.
void CopyTicksRange_Test()
{
  static MqlTick Ticks[2000];    
  
  for (int i = SymbolsTotal(true) - 1; !IsStopped() && (i >= 0); i--)
  {
    const string Symb = SymbolName(i, true);
    
    if (!SymbolInfoInteger(Symb, SYMBOL_CUSTOM))
    {
//      CopyTicks(Symb, Ticks, COPY_TICKS_ALL, TimeCurrent() * 1000, 1);
      CopyTicksRange(Symb, Ticks, COPY_TICKS_ALL, TimeCurrent() * 1000);        
    }
  }  
}

#define  PRINT(A) Print(#A + " = " + (string)(A))

void OnDeinit( const int )
{  
  PRINT(SymbolsTotal(true));
  PRINT(TerminalInfoInteger(TERMINAL_MEMORY_USED));
  
  Print("https://www.mql5.com/ru/forum/342090/page81#comment_20534660");
}

void OnTimer()
{  
  static int Count = 0;
  
  _BV(CopyTicks_Test(), 1);      // Очень много потребляет CPU, выполняется медленно, память не использует.
  _BV(CopyTicksRange_Test(), 1); // Очень много потребляет RAM, выполняется быстро
  
  Comment(TimeCurrent());
  
  if (Count++ > 9)
    ExpertRemove();
}

Cadena de búsqueda: Oshibka 024.

Archivos adjuntos:
 
fxsaber:
Hay que aprender a trabajar con garrapatas de alguna manera. No funciona.

¿Cómo hacer que CopyTicks por ticks más cercanos sea rápido y no consuma cientos de megabytes?

Cadena de búsqueda: Oshibka 024.

2021.02.05 14:07:08.788 CopyTicks_bug024 (GBPAUD,H1)    Benchmark.mqh: TimeAvg[GetMicrosecondsCount()] = 0 mcs.
2021.02.05 14:07:08.790 CopyTicks_bug024 (GBPAUD,H1)    Benchmark.mqh is On.
2021.02.05 14:07:11.829 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 2030928 mcs.
2021.02.05 14:07:11.829 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 34 mcs.
2021.02.05 14:07:11.850 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 20451 mcs.
2021.02.05 14:07:11.850 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 23 mcs.
2021.02.05 14:07:12.853 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 23877 mcs.
2021.02.05 14:07:12.853 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 24 mcs.
2021.02.05 14:07:13.867 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 22943 mcs.
2021.02.05 14:07:13.868 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 32 mcs.
2021.02.05 14:07:14.848 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 19409 mcs.
2021.02.05 14:07:14.848 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 27 mcs.
2021.02.05 14:07:15.845 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 16222 mcs.
2021.02.05 14:07:15.845 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 37 mcs.
2021.02.05 14:07:16.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 4710 mcs.
2021.02.05 14:07:16.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 34 mcs.
2021.02.05 14:07:17.835 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 5493 mcs.
2021.02.05 14:07:17.835 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 38 mcs.
2021.02.05 14:07:18.842 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 13423 mcs.
2021.02.05 14:07:18.842 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 33 mcs.
2021.02.05 14:07:19.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 5197 mcs.
2021.02.05 14:07:19.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 47 mcs.
2021.02.05 14:07:20.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 5274 mcs.
2021.02.05 14:07:20.834 CopyTicks_bug024 (GBPAUD,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 20 mcs.
2021.02.05 14:07:20.835 CopyTicks_bug024 (GBPAUD,H1)    ExpertRemove() function called
2021.02.05 14:07:20.835 CopyTicks_bug024 (GBPAUD,H1)    SymbolsTotal(true) = 10
2021.02.05 14:07:20.850 CopyTicks_bug024 (GBPAUD,H1)    TerminalInfoInteger(TERMINAL_MEMORY_USED) = 670



2021.02.05 14:13:27.814 CopyTicks_bug024 (USDJPY,H1)    Benchmark.mqh: TimeAvg[GetMicrosecondsCount()] = 0 mcs.
2021.02.05 14:13:27.814 CopyTicks_bug024 (USDJPY,H1)    Benchmark.mqh is On.
2021.02.05 14:13:41.880 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 13066082 mcs.
2021.02.05 14:13:41.880 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 34 mcs.
2021.02.05 14:13:41.947 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 66608 mcs.
2021.02.05 14:13:41.947 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 35 mcs.
2021.02.05 14:13:43.026 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 78854 mcs.
2021.02.05 14:13:43.026 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 34 mcs.
2021.02.05 14:13:43.902 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 22992 mcs.
2021.02.05 14:13:43.902 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 31 mcs.
2021.02.05 14:13:44.926 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 57102 mcs.
2021.02.05 14:13:44.926 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 32 mcs.
2021.02.05 14:13:45.967 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 41355 mcs.
2021.02.05 14:13:45.967 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 33 mcs.
2021.02.05 14:13:46.955 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 34721 mcs.
2021.02.05 14:13:46.955 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 35 mcs.
2021.02.05 14:13:47.969 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 62453 mcs.
2021.02.05 14:13:47.969 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 35 mcs.
2021.02.05 14:13:49.025 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 86697 mcs.
2021.02.05 14:13:49.025 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 33 mcs.
2021.02.05 14:13:50.048 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 84251 mcs.
2021.02.05 14:13:50.048 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 32 mcs.
2021.02.05 14:13:51.018 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 63193 mcs.
2021.02.05 14:13:51.018 CopyTicks_bug024 (USDJPY,H1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 38 mcs.
2021.02.05 14:13:51.018 CopyTicks_bug024 (USDJPY,H1)    ExpertRemove() function called
2021.02.05 14:13:51.018 CopyTicks_bug024 (USDJPY,H1)    SymbolsTotal(true) = 18
2021.02.05 14:13:51.032 CopyTicks_bug024 (USDJPY,H1)    TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1082
 
Enrique Dangeroux:

Gracias, los registros muestran bien el problema de CopyTicks.

 
fxsaber:

Gracias, los registros muestran bien el problema de CopyTicks.

Sab, el indicador de espionaje no trabaja con él?, tengo muchas preguntas

A través del id, en lugar de la cadena el robot obtiene el símbolo de trabajo, pero hoy 2 terminales obtuvieron diferentes estados en las operaciones

en M1 en spyro a través de calculated=, hay una comprobación de un nuevo cálculo y luego se envía al robot

Обработчик события "новый бар"
Обработчик события "новый бар"
  • www.mql5.com
Язык программирования MQL5 позволяет решать задачи на совершенно новом уровне. Даже те задачи, которые уже вроде имеют решения, благодаря объектно-ориентированному программированию могут подняться на качественно новый уровень. В данной статье специально взят простой пример проверки появления нового бара на графике, который был преобразован в достаточно мощный и универсальный инструмент. Какой? Читайте в статье.
 
Fast235:

Sub, indicador de espía no trabaja con él?, tengo muchas preguntas

Sólo bajo MT4 - en las mentiras de KB.

 
2021.02.05 11:49:25.391 Terminal        Windows 10 build 19042, AMD Ryzen 5 1600 Six-Core, 8 / 15 Gb memory, 138 / 446 Gb disk, IE 11, UAC, GMT+3

2021.02.05 16:23:06.902 CopyTicks_bug024 (EURUSD,D1)    Benchmark.mqh: TimeAvg[GetMicrosecondsCount()] = 0 mcs.
2021.02.05 16:23:06.902 CopyTicks_bug024 (EURUSD,D1)    Benchmark.mqh is On.
2021.02.05 16:23:08.386 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 475620 mcs.
2021.02.05 16:23:08.386 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 21 mcs.
2021.02.05 16:23:08.916 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 5638 mcs.
2021.02.05 16:23:08.916 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 7 mcs.
2021.02.05 16:23:09.904 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 23 mcs.
2021.02.05 16:23:09.904 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 5 mcs.
2021.02.05 16:23:10.910 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 2970 mcs.
2021.02.05 16:23:10.911 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 10 mcs.
2021.02.05 16:23:11.899 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 25 mcs.
2021.02.05 16:23:11.899 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 6 mcs.
2021.02.05 16:23:12.916 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 25 mcs.
2021.02.05 16:23:12.916 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 5 mcs.
2021.02.05 16:23:13.898 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 20 mcs.
2021.02.05 16:23:13.898 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 5 mcs.
2021.02.05 16:23:14.913 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 6697 mcs.
2021.02.05 16:23:14.913 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 11 mcs.
2021.02.05 16:23:15.929 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 6709 mcs.
2021.02.05 16:23:15.929 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 8 mcs.
2021.02.05 16:23:16.920 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 6611 mcs.
2021.02.05 16:23:16.921 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 13 mcs.
2021.02.05 16:23:17.921 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 584 in OnTimer: CopyTicks_Test()] = 3830 mcs.
2021.02.05 16:23:17.921 CopyTicks_bug024 (EURUSD,D1)    Alert: Bench_Stack = 0, 1 <= Time[CopyTicks_bug024.mq5 585 in OnTimer: CopyTicksRange_Test()] = 6 mcs.
2021.02.05 16:23:17.921 CopyTicks_bug024 (EURUSD,D1)    ExpertRemove() function called
2021.02.05 16:23:17.921 CopyTicks_bug024 (EURUSD,D1)    SymbolsTotal(true) = 3
2021.02.05 16:23:17.929 CopyTicks_bug024 (EURUSD,D1)    TerminalInfoInteger(TERMINAL_MEMORY_USED) = 657
 
fxsaber:

Sólo bajo MT4 - en las mentiras de KB.

no mires las bases personalizadas, es para los débiles

 

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

MT5 y Speed en acción

Dzmitry Manannikov, 2021.02.05 14:38

2021.02.05 16:23:17.921 CopyTicks_bug024 (EURUSD,D1)    SymbolsTotal(true) = 3
2021.02.05 16:23:17.929 CopyTicks_bug024 (EURUSD,D1)    TerminalInfoInteger(TERMINAL_MEMORY_USED) = 657

Si aumentas el número de símbolos, verás el problema del alto uso de la memoria.

 
Fast235:

No miro las bases personalizadas, es para los débiles.

No responderé a los mensajes que no entienda.

Razón de la queja: