open error [2] & error code 565 on EA optimization

 

Hello all

I'm having a problem when running my optimization on MT5 V 5.00 built 2715 , during some runs everything works well, but other times i get this error which i cannot understand what it is!!

OF      0       15:35:19.008    Core 8  pass 252 returned result 62622920.000000 in 0:00:03.603
EI      0       15:35:19.995    Core 4  pass 87 returned result -41308410.000000 in 0:00:04.455
ER      0       15:35:20.221    Core 5  pass 157 returned result 1631944482.000000 in 0:00:13.166
OG      0       15:35:21.769    Core 1  pass 91 returned result 337765073.000000 in 0:00:04.102
KI      0       15:35:22.226    Core 7  pass 92 returned result 382265001.000000 in 0:00:04.519
GP      0       15:35:22.422    Core 3  pass 94 returned result 1382901875.000000 in 0:00:05.236
RG      0       15:35:22.871    Core 2  pass 90 returned result 1547798883.000000 in 0:00:04.756
LN      0       15:35:23.293    Core 6  pass 89 returned result 231519287.000000 in 0:00:04.537
CS      0       15:35:23.615    Core 4  pass 88 returned result 1538987849.000000 in 0:00:03.619
FE      0       15:35:23.681    Core 5  pass 158 returned result 1609029130.000000 in 0:00:03.459
QP      3       15:35:23.712    Tester  pass 127 not processed and added to task queue
DI      3       15:35:23.712    Tester  pass 159 not processed and added to task queue
OF      3       15:35:23.712    Tester  pass 255 not processed and added to task queue
QM      0       15:35:23.712    Core 1  pass 127 started
EP      0       15:35:23.712    Core 2  pass 159 started
IK      0       15:35:23.712    Core 3  pass 255 started
CN      2       15:35:23.721    Tester  expert file C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77ASG45G1D8BF550E51FF082\MQL5\.ex5 open error [2]
DR      2       15:35:23.722    Tester  expert file C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77ASG45G1D8BF550E51FF082\MQL5\ex5.ex5 open error [2]
IS      2       15:35:23.755    Core 3  pass 255 tested with error "critical runtime error 565 in OnInit function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.009
KP      0       15:35:25.687    Core 1  pass 127 returned result 1381997139.000000 in 0:00:01.973
QJ      0       15:35:26.225    Core 2  pass 159 returned result 1609029130.000000 in 0:00:02.511
IS      0       15:35:26.236    Tester  optimization finished, total passes 262 (successful 261 passes)
LP      0       15:35:26.247    Statistics      optimization done in 3 minutes 01 seconds
FK      0       15:35:26.247    Statistics      shortest pass 0:00:01.973, longest pass 0:01:02.268, average pass 0:00:05.406
PL      0       15:35:26.247    Statistics      261 frames (47.92 Kb total, 188 bytes per frame) received
QO      0       15:35:26.247    Statistics      local 262 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)

This one happened at the end of my passes, but sometimes it happens in the middle of passes and after couple of seconds the tester closes itself!

OM      2       14:36:40.029    Tester  expert file C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77ASG45G1D8BF550E51FF082\MQL5\.ex5 open error [2]
IM      2       14:36:40.030    Tester  expert file C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77ASG45G1D8BF550E51FF082\MQL5\ex5.ex5 open error [2]
HL      0       14:36:40.113    Core 7  pass 163 returned result 661794542.000000 in 0:00:02.821
HL      2       14:36:40.563    Core 6  pass 196 tested with error "critical runtime error 565 in OnInit function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.018
ID      2       14:36:40.563    Core 6  pass 197 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.018
CP      2       14:36:40.563    Core 6  pass 198 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.015
PL      2       14:36:40.563    Core 6  pass 199 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.015
MH      2       14:36:40.563    Core 6  pass 200 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.015
JG      2       14:36:40.563    Core 6  pass 201 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.015
ES      2       14:36:40.563    Core 6  pass 202 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.017
RO      2       14:36:40.563    Core 6  pass 203 tested with error "critical runtime error 565 in global initialization function (error code 565, module Experts\Downloaded\V 0.0.0\V 0.0.0.ex5, file 65535, line 1, col 1)" in 0:00:00.017

i think there might be a problem with the expert trying to open an indicator and not being able to find it!

in my EA, i'm trying to backtest a strategy with different set of indicators per symbol (a multi symbol expert). Too choose the best indicators per symbol, and do it as fast as possible, I created an "enum ENUM_Indicator" listing all the indicators available in my system:

enum ENUM_Indicator
  {
   absolute_strength___averages,
   absolutestrength_v2,
   Acceleration_Deceleration_AC_MTF,
   ...
  }

then I have a two structure and a function that fills the structure with each indicator parameters that are necessary:

struct indicator_properties
  {
   string                  IndicatorFolder;             //
   string                  IndicatorName;               //
   uchar                   BufferIndexBuy;              //
   uchar                   BufferIndexSell;             //

                     indicator_properties()
     {
      IndicatorFolder="";               //
      IndicatorName="";                 //
      BufferIndexBuy=0;                 //
      BufferIndexSell=0;                //


     }
  };
----------------------------------------
//-- variable to hold each indicator parameters

indicator_properties  indic;

------------------------------------------------------

struct properties
  {
   indicator_properties prop[];

                     properties()
     {
      ArrayResize(prop,6);
     }
  };

-----------------------------------------------
//-- Array to hold indicators parameters per symbol

properties indicators[3];


------------------------------------------------
void GetIndicator(ENUM_Indicator indicator)
  {
//---
   switch(indicator)
     {
      case absolute_strength___averages :
         indic.IndicatorFolder="Downloaded";
         indic.IndicatorName="absolute_strength_-_averages";           
         indic.BufferIndexBuy=0;     
         indic.BufferIndexSell=1;
         break;

      case absolutestrength_v2 :
         indic.IndicatorFolder="Downloaded";
         indic.IndicatorName="absolutestrength_v2";           

         indic.BufferIndexBuy=0;     
         indic.BufferIndexSell=1;
  
         break;
      }
}

on the OnInit(), i call a function that fills the indicators[] Array:

void IndicatorConstants()
  {   
   ArrayResize(indicators,NUMBER_OF_SYMBOLS);
   for(int i=0; i < NUMBER_OF_SYMBOLS; i++)
     {
      GetIndicator(IndicatorName_2);
      indicators[i].prop[2].IndicatorFolder  = indic.IndicatorFolder;
      indicators[i].prop[2].IndicatorName    = indic.IndicatorName;
      indicators[i].prop[2].BufferIndexBuy   = indic.BufferIndexBuy;
      indicators[i].prop[2].BufferIndexSell  = indic.BufferIndexSell;
        ...
        }
}

and for the iCustom():

 
 string IndicName_2 = indicators[symbol_number].prop[2].IndicatorFolder + "\\" + indicators[symbol_number].prop[2].IndicatorName;

 signal_indicator_handles_2[symbol_number]=iCustom(Symbols[symbol_number],IndicatorPeriod_2,IndicName_2);

So there are mulitple indicators with different parameters per each symbol. In my code "IndicatorName_2" is an input which an "ENUM_Indicator " type and i can choose to optimize EA per this position of indictor and it makes it really fast. 

Previously i was getting an array out of range Error in IndicatorConstants() when calling "indicators[i]", even though i was initializing and resizing the indicators[] array before calling IndicatorConstants() , i was getting this array out of range Error. Then i added constructors to my structures and used static array when declaring and then resizing the arrays.  Array out of range error was gone but after this part that ".ex5 open error [2]" began to happen.

My guess is that on some passes " indicators[i].prop[2]"   doesn't get filled and consequently neither does the "IndicName_2" in the ICustom()  and the tester cannot find the indicator since the default value for indicator name and folder are empty strings and that's why the Error doesn't show the name of the indicators that it fails to open.

i'm not sure if my logic to optimize indicators is correct or not, but why there's this error and why it only happens half of the times!

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
Did you solve it? i have also a multisymbol EA with exactly the same error..
 
expert file C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77ASG45G1D8BF550E51FF082\MQL5\.ex5 open error [2]I

You do not have a file selected. If you open that file location it will give you all of the mql5 folder. You need it to say MQL5\Experts\*ExpertName*.ex5

 
Claudius Marius Walter #:
Did you solve it? i have also a multisymbol EA with exactly the same error..

I have found the problem in the log of the remote agents.

In my case my EA uses a custom indicator which was in DEBUG mode, while the EA was in normal mode. After recompiling my custom indicator, the remote agents run my EA properly.

So in short, check that everything your program refers to is compiled properly.

I hope this applies to your error 565 as well.