MT5 e la velocità in azione - pagina 81

 

Se durante una lunga esecuzione a freddo (con upload dal server) CopyTicks fa una modifica dell'ordine, questa avverrà (non sul server, ma nel terminale - OnTradeTransaction) con un ritardo significativo.

Per esempio, in modalità normale 100 ms, in modalità superiore - 2000 ms.

 
Bisogna imparare a lavorare con le zecche con parsimonia in qualche modo. Non funziona.

Come rendere CopyTicks per tick più vicini veloce e non consumare centinaia di megabyte?

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

Stringa di ricerca: Oshibka 024.

File:
 
fxsaber:
Bisogna imparare a lavorare con le zecche con parsimonia in qualche modo. Non funziona.

Come rendere CopyTicks per tick più vicini veloce e non consumare centinaia di megabyte?

Stringa di ricerca: 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:

Grazie, i log mostrano bene il problema del CopyTicks.

 
fxsaber:

Grazie, i log mostrano bene il problema del CopyTicks.

Sab, indicatore spia non ci lavori?, ho un sacco di domande

Attraverso l'id, invece della stringa il robot ottiene un simbolo funzionante, ma oggi 2 terminali hanno ottenuto uno stato diverso sulle transazioni

su M1 in spyro via calculated=, c'è un controllo per un nuovo calcolo e poi inviato al robot

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

Sub, indicatore spia non ci lavori, ho un sacco di domande

Solo sotto MT4 - in bugie 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:

Solo sotto MT4 - in bugie KB.

non guardare le basi personalizzate, è per i deboli

 

Forum sul trading, sistemi di trading automatico e test di strategie di trading

MT5 e la velocità in azione

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

Se aumentate il numero di simboli, vedrete il problema dell'elevato utilizzo della memoria.

 
Fast235:

Non guardo le basi personalizzate, è per i deboli.

Non rispondo ai post che non capisco.