COMPILING QUESTION

 

Is it possible to compile EA automatically? That is, is there any command or function that you could use in your expert EA to compile as you require without any input from you?


I need my EA to initialize if it meets certain conditions and it seems the only way for it to happen is through compiling manually.


Thank you for your help.

 

That's very easy. Use CreateProcess () and call metalang.exe with your .mq4.

Try this, right click your .mq4, select open with, and select metalang.exe, click OK.

Have fun.

 
onewithzachy:

That's very easy. Use CreateProcess () and call metalang.exe with your .mq4.

Try this, right click your .mq4, select open with, and select metalang.exe, click OK.

Have fun.


Dear onewithzachy:


I appreciate your prompt reply very much. However, could you please show me an example?

 
zaffrono:

Is it possible to compile EA automatically? That is, is there any command or function that you could use in your expert EA to compile as you require without any input from you?


I need my EA to initialize if it meets certain conditions and it seems the only way for it to happen is through compiling manually.


Thank you for your help.

You do not need or want to recompile your EA. If you want it to do a restart that is very easy. It is probably not a good idea to actually call init() directly but i am sure i have seen somebody demonstrate this by making init() call a replacement function _init(). When you want to re-init your EA just call _init().

int dummy_example_variable=0;

//+------------------------------------------------------------------+
int init(){
   // DO NOT DO ANYTHING IN HERE, JUST CALL _init()
   _init();

   return(0);
}
//+------------------------------------------------------------------+
void _init(){
   // do the real work of initialising here
   dummy_example_variable = 1;
}
//+------------------------------------------------------------------+
int deinit(){

   return(0);
}
//+------------------------------------------------------------------+
int start(){

   if( dummy_example_variable==1 ){
      Print("I got here once");
      dummy_example_variable=2;
   }
   
   if( some_sort_of_test_requiring_a_reset ){
      _init();
   }
   
   return(0);
}
//+------------------------------------------------------------------+
 
dabbler:

You do not need or want to recompile your EA. If you want it to do a restart that is very easy. It is probably not a good idea to actually call init() directly but i am sure i have seen somebody demonstrate this by making init() call a replacement function _init(). When you want to re-init your EA just call _init().



Dear dabbler:


Thank you very much for your help. I will test it and see how it works.

 
dabbler:

You do not need or want to recompile your EA. If you want it to do a restart that is very easy. It is probably not a good idea to actually call init() directly but i am sure i have seen somebody demonstrate this by making init() call a replacement function _init(). When you want to re-init your EA just call _init().


This ? https://www.mql5.com/en/forum/138575
 

I think/thought he wants his EA/CI self destruct so that when decompiled, no one gets it - a blank empty pages :)

All of mine is self destruct.

 
Yes, that's the one :-)
Reason: