Download MetaTrader 5

Optimization : exclude a set of param if another main one is turned to false

To add comments, please log in or register
Add our channel to friends and follow the news!
Icham Aidibe
10043
Icham Aidibe 2015.06.13 14:47 

Hi,

Yet trying to ease the optimization process of an EA, I'm wondering how to exclude sub-param if the main param is turned to on - in a way to win time.

Example :

UseMA= false
MAPeriod = 15 <-- don't want the optimizer to try all the period possible if UseMA is turned to false

Any help appreciated. Thanks.
Dua Yong Rew
5424
Dua Yong Rew 2015.06.13 16:29  
int OnInit()
  {
//---

   if(TS >= TP) return(INIT_PARAMETERS_INCORRECT);

   if(TS == 0)
   {
      if(PP >= SL + TP) return(INIT_PARAMETERS_INCORRECT);
   }
   else
   {
      if(PP >= SL + TS) return(INIT_PARAMETERS_INCORRECT);
   }

//---
   return(INIT_SUCCEEDED);
  }
Alain Verleyen
Moderator
30735
Alain Verleyen 2015.06.13 19:20  
   if(UseMA && MAPeriod!=15)
     {
      return(INIT_PARAMETERS_INCORRECT);
     }
JD4
1101
JD4 2015.06.27 06:49  
if (UseMA)
{
  do this code
}
else
{
  do this code instead, which would include
  MAPeriod=M15; // or however the program recognizes it
}
To add comments, please log in or register