**Mohammad Hossein Najarzadeh:**I've wrote this problem later on forum but there were not much of help.

### Don't double post! You already had that thread open.

General rules and best pratices of the Forum. - General - MQL5 programming forum

I already answered your question there, six months ago Conditional Parameter
Optimization solution needed! - Parabolic SAR - Expert Advisors and Automated Trading - MQL5 programming forum #4

Hello Everyone

I have a problem in optimization passes. I've searched a lot but none of questions nor the answers in the forum was the one solving this problem.

The problem is that I have some Boolean parameters in my inputs which when they are set as false there is no need to optimize some other parameters.

for example, if the "Psar_Active" parameter is set to false my EA won't use Parabolic SAR indicator in its decision-making process,

so optimizing the related input parameters of the indicator "step" and "max" is useless (only when the Activation parameter is false).

Unfortunately, I couldn't find a way for this. so many of the optimization results are useless

and this make the whole optimization much much less effective. (when using the genetic based algorithm)

Let’s assume that "Step" Parameter has 5 different steps and "Max" Parameter has 4 different steps the total steps considering the

"Psar_Active" parameter (which has two steps) is currently resulting to 40 passes (5*4*2), which 19 of them are useless

(the ones with "Psar_Active" ==false). if this problem could be solved the total passes should be reduced to 21 (5*4*1+1).

The solution should be able to solve the problem for multiple parameters.

for example, if the Psar_Active==false Parameters Step & Max should not be optimized

but at the same time ADX_Active==true Parameters Period & Min should be optimized.

so if number of passes are as follow

Psar_Active 2

Step_Psar 5

max_Psar 4

ADX_Active 2

Period_ADX 3

Min_ADX 4

the total passes should be [(1*5*4+1)*(1*3*4+1)]=273 which at the current time the program uses (2*5*4*2*3*4)=960 which 687 passes (%72 of the total calculations made by the agents!!)

are totally useless and misguiding in the genetic base decision making progress.it should be noted that the ones with the false entry should not be totally eliminated.

It's not really important that the total number of passes shown correctly in the input tab of the program, but if the figure is calculated correctly it will be comforting.

but when the optimization is run, there should not be any unnecessary passes in the results (slow complete method or fast genetic base)

I've wrote this problem later on forum but there were not much of help.

https://www.mql5.com/en/forum/298982

I'm not sure which way will do but i assume that writing a function in the tester sections with some parameters that

one of the is them input parameter of EA and the other one a Boolean parameter which determines the necessity of optimization

(or any solution that changes the total number of passes in optimization) can solve this problem. perhaps a remove duplicate kind of function

at the begging of the testing session should be implemented (if all the other -non relative-parameters are the same there should be only one pass

with the false input for that parameter).

usually relative parameter won't exceed more than 10 parameters.so the function should be something like:

void Remove_Unnecessary_Optimize(bool Main_input, Raltive_Paramer1, altive_Paramer2, . . . .,altive_Paramer10)

so far, I couldn't find anyway with this and I don't intend to get anything for free.

please advise me if you can help on this.

thank in advance for your help.