Errors, bugs, questions - page 2442

 
fxsaber:

What will this change?

As far as I understand the problem, the hash of the executable cannot be changed because it is used for optimisation

That's why I suggest

int Array[] = {123};

put it in a linkable library and recompile it after a successful optimization run - didn't check, but mql libraries are linked at runtime (not resources)

 
Igor Makanu:

As far as I understand the problem, you cannot change the hash of the executable

You do not understand the problem.

The EA should generate a different file name if its EX5 has changed.

 
fxsaber:

You do not understand the task.

The EA should form a different file name, if its EX5 has changed.

I propose to change the library, if you want 2 libraries, connect them and use a different name

this kind of manipulation:

link_library.mq5 :

#import "lib.ex5"
int value_array();
#import
//+------------------------------------------------------------------+
int OnInit()
  {
   Print("Array = ",value_array());
   return(INIT_SUCCEEDED);
  }

library lib.mq5 :

int Array[] = {123};
 int value_array() export
   {
    return(Array[0]);
   }
in MQL the library is essentially little different from an executable file - there are no restrictions, it can also write itself into a file and ... everything can as an MQL - program
 
Igor Makanu:

I suggest changing the library, if you want two libraries, plug them in and use a different name

This is how to manipulate:

expert link_library.mq5 :

lib.mq5 library :

In MQL, the library is essentially not much different from an executable file - there are no restrictions, it can also write itself into the file and ... everything can as an MQL - program

I don't understand why the task is not clear: If the EA has changed - change the name of the file.

 
fxsaber:

I don't understand why the task is not clear: If the EA has changed - change the file name.

I don't understand the problem at all.
Include as a resource the source file of the Expert Advisor itself .mq5 file and take hash from it.

 
Comments not related to this topic have been moved to "Any questions from newbies on MQL4, help and discussion on algorithms and codes".
 
Sergey Dzyublik:

I don't understand the problem at all.
Include as a resource the source of the Expert Advisor itself .mq5 file and take the hash from it.

So there will be no access (bytes to calculate hash) to the enabled EX5.

 
fxsaber:

So there will be no access (bytes to calculate the hash) to the enabled EX5.

Everything works:

#resource "\\Experts\\Advisors\\ExpertMACD.ex5" as uchar ex5_data[];


What's ex5 got to do with it if you're talking about code changes that are better tracked by .mq5?
It's as if you don't understand what you ultimately need yourself.
 
Sergey Dzyublik:

What does ex5 have to do with it if you're talking about code changes that are better tracked by .mq5?

It seems as if you don't understand what you want in the end.

Well I wrote it, how can I go into more detail?

Forum on trading, automated trading systems and strategy testing

Bugs, bugs, questions

fxsaber, 2019.04.23 06:15

I have this EA.

void OnDeinit( const int )
{
  int Array[] = {123};
  
  FileSave((string)MQLInfoInteger(MQL_PROGRAM_HASH), Array);
}


When I make a pass, it writes a file with the same name. This is correct.


Then I recompile by writing the number 456 instead of 123.

After that, each pass will write the corresponding one and the same file, but with a different name.


That's the kind of functionality we need to implement somehow. I.e. if EX5 is changed, the file names it creates will also change.


SZY Using __DATETIME__ macro would not work.


I have an mq5 that creates a file with Name1. I change some number in mq5. Name2 should be generated. I change something else in code - Name3. And so on.

 
fxsaber:

Well, I've written it, how can I be more specific?


I have mq5, which creates a file with Name1. I change some number in mq5. Should be generated Name2. I change something else in code - Name3. And so on.

Connect the source code in .mq5 format as a resource and read the hash from the source code content.
If you change the source code, the compilation will automatically pull the new source code as a resource and compute a new hash.
What is so difficult?