Errors, bugs, questions - page 2672

 
fxsaber:

There is only the data in the opt file. The format is available.

I do not want to read from file, I have already done what I wanted - unique file name - MD5 of input parameters, like this:

string getMD5(const SSaveStruct &inpstr)
{
   const uchar key[1]= {0};
   uchar data[],md5[];
   StructToCharArray(inpstr,data);
   CryptEncode(CRYPT_HASH_MD5, data, key, md5);
   string result = "";
   for(int i = 0; i < ArraySize(md5); i++)
      result += StringFormat("%02x", md5[i]);
   return(result);
}

void SaveInputParam()
{
   SSaveStruct savestruct;
   FillSaveStruct(savestruct);
   string fname = "EA_TST//" + getMD5(savestruct) + ".bin";
   int handle = FileOpen(fname,FILE_WRITE|FILE_COMMON|FILE_BIN);
   FileWriteStruct(handle,savestruct);
}

double OnTester()
{

   if(!IS_OPTIMIZATION)
   {
      SSaveStruct savestruct;
      FillSaveStruct(savestruct);
      Print("fname = " + getMD5(savestruct));
      return(AccountInfoDouble(ACCOUNT_BALANCE));
   }

#define  BADTEST() { srand((int)TimeCurrent()); return (-(rand() % 1000)); }
   if(EA_STOP || TesterStatistics(STAT_TRADES) < EA_MIN_TRADEES)  BADTEST();
   SaveInputParam();
   return(AccountInfoDouble(ACCOUNT_BALANCE));
#undef  BADTEST
}

files are written and in a single pass I see the file name : fname = 04a19580d36f0a749143211b57efbebc

code is a bit repetitive, but in order not to fill in the optimizer structure with input parameters if the test is unsuccessful .... but i'll probably rewrite it, it's not nice code, i won't understand why i did it that way )))
 
Igor Makanu:

is it possible to get the pass number from the tester agent?


HH: or need a unique identifier from each pass during testing for the file name - I want to save the settings of interest EA during testing in the file, but need something unique to form a file name with the settings

The pass number can be 1024-bit.

Why do you need a pass number when you already have a set of parameters on that line?

 
Igor Makanu:

I do not want to read from the tester from the file, I think I already did what I wanted - unique file name - MD5 of the input parameters, about this:

files are written and in a single pass I see the file name : fname = 04a19580d36f0a749143211b57efbebc

code is a bit repetitive, but in order not to fill in the optimizer structure with input parameters if the test is unsuccessful .... but i'll probably rewrite it, it's not nice code, i won't understand why i did it that way )))

The MD5 of the input parameters has already been calculated and is in the pass record in the opt file

 
Slava:

Why do you need a pass number if you already have a set of parameters in this line?

I want to reset successful optimizer passes immediately to EA settings file and automatically load a .bin file instead of .set when starting EA - it is necessary for simultaneous operation of several TCs

Slava:

The MD5 of input parameters has already been calculated and is in the pass record in the opt-file

I struggled for almost 3 months for the speed of optimisation, I think I have achieved it, so a counter question:

which is faster:

1. from optimizer to read opt-file with MD5 ?

2. or calculate with my MD5 code


I suspect that it's faster to calculate, especially since all input parameters are used inside the code as an array of structures (I optimize about 40 parameters)

 
Igor Makanu:

I want to reset successful optimizer passes immediately to EA settings file and automatically load a .bin file instead of .set when starting EA - it is necessary for simultaneous operation of several TCs

I struggled for almost 3 months for the speed of optimisation, I think I have achieved it, so a counter question:

which is faster:

1. from optimizer to read opt-file with MD5 ?

2. or calculate with my MD5 code


I suspect that it's faster to calculate, especially since all input parameters are used inside the code as an array of structures (I optimize about 40 parameters).

MD5 is faster to calculate.

If you are not going to use the opt-file in future, calculate MD5

If you are going to use it, it is better to use an already calculated MD5, as your calculation may not (and probably will not) match ours

 
Slava:

MD5 is quicker to read.

If you don't intend to use the opt-file in the future, read MD5

If you're going to use, it's better to use already calculated MD5 as your calculation may not (and most likely will not) match ours

Thank you!

not going to use an opt-file

SZS: a couple of weeks ago I was looking to initialize MathSrand() from a testerhttps://www.mql5.com/ru/forum/1111/page2657#comment_15165819

it would not be bad to get uchar[] with MD5 (well or string) in tester agent - it's unique value, you can initialize MathSrand() and here i want unique file name, give your MD5 in TesterStatistics()

 
Sergey Dzyublik:
Bug MT5(build 2323), the same template object B<int> can be created after object of class B<void*>, but if done before, a compilation error occurs.
Probably the cause is in the template class generator cache.

Thanks for the post, fixed

 

How do you use macros?

Horror. A compile-time error.

Small script:

void OnStart()
  {
   #define  m 1000;
   ulong n_yes=3*m;  //Тут всё хорошо
   ulong n_no=(3*m); //Тут ошибка: ';' - unexpected token	test2.mq5	27	18
  }
Build 2361, the latest at the moment.
 
Aliaksandr Hryshyn:

How do you use macros?

that's how we use
#define  m 1000;
 
Igor Makanu:
this is how we use

The difference there is the presence of brackets.

Reason: