Not for MT developers! What to replace INIT_PARAMETERS_INCORRECT with ? - page 10

 
Aleksey Vyazmikin:

Incorrect parameters are generally disabled for 3 reasons:

1. the study area is not of interest (e.g. excluding a number of timeframes, as the most understandable option);

//--- пропустить бесполезные проходы оптимизации
   if(my_timeframe != PERIOD_M15   &&
      my_timeframe != PERIOD_M30   &&
      my_timeframe != PERIOD_H1    &&
      my_timeframe != PERIOD_H3    &&
      my_timeframe != PERIOD_H6      )
   {
      Print("ОШИБКА - Период не запланирован");
      return(INIT_PARAMETERS_INCORRECT);
   }
 
Сергей Таболин:

Absolutely right.

 
Сергей Таболин:

Well, how do you organise the MA optimisation from the example without including the "invalid" parameters?

OK, I agree, I didn't look at it carefully. to optimise another parameter with an invalid gap cut out

 
TheXpert:

OK, I agree, I didn't look at it carefully. to optimise, bring out another parameter with the invalid gap cut out

Can you give me an example?

 
Сергей Таболин:

Can I give you an example?

input int period_MA_warp = 15;

//...

period_MA = (period_MA_warp <= 31) ? period_MA_warp : period_MA_warp + 50;
 
TheXpert:

I agree. What about the case of timeframes?

 
Сергей Таболин:

I agree. And what to do in case of timeframes?

The same way - conversion of int inside continuous interval to timeframe. for example, create an array with all TF values and optimize by array index

 
TheXpert:

For example, to create an array with all TF values and optimize by array index

Well, this looks like a crutch to me... Maybe I'm wrong, but it's almost the same thing I had to do with my starting example. Except that in this case you don't need to dump the whole array into a file beforehand...

 

An idea came up to sift out "invalid" parameters during genetic optimization in OnTester():

double OnTester()
{
   if(MQLInfoInteger(MQL_OPTIMIZATION) && paramIncorrect())  return(-99999999.99);
}

It turns out that without interfering with genetics the results of INIT_PARAMETERS_INCORRECT may not be seen.

Another question arises here: may we get "deep minus" on profit in this case?

 

The way I did it: a separate parameter is created and other values are substituted depending on its value.

A simple example (2 weeks ago):

There are timeframe parameters: TF_UP (Senior) and TF_DOWN (Junior), and the Senior must always be greater than the Junior, in reverse case input_incorrect comes out. In the tester there are a lot of null results and genetics "works for nothing" (though it's fast). As a result, I removed these 2 parameters and created a new parameter which has the type described below, and optimize only it, and already in the OnInit function the substitution in 2 other parameters, depending on this parameter.

enum TF_only_opt
{
   _H4_H1 = 0,
   _H4_M30 = 1,
   _H4_M15 = 2,
   _H1_M30 = 3,
   _H1_M15 = 4,
   _H1_M5 = 5,
   _M30_M15 = 6,
   _M30_M5 = 7,
   _M30_M1 = 8,
   _M15_M5 = 9,
   _M15_M1 = 10,
   _M5_M1 = 11
};
Reason: