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

 

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.
 
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);
  }
 
   if(UseMA && MAPeriod!=15)
     {
      return(INIT_PARAMETERS_INCORRECT);
     }
 
if (UseMA)
{
  do this code
}
else
{
  do this code instead, which would include
  MAPeriod=M15; // or however the program recognizes it
}