Conditional Parameter Optimization solution needed!

 

Hello Everyone

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


The problem is that i have some bool 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 it's decision making process,
so optimizing the "step" and "max"  (two other input parameters) of the indicator 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 less effective.

Lets assume that "Step" Parameter has 5 steps and "Max" Parameter has 4 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).

I would be great-full if we can figure this out. thank in advance for your help.

 

I see. There will be redundant passes. I think this is something which can be addressed to service support. 

This looks more like a feature request, rather than something which can be solved on the forum. 

Maybe a moderator can answer to this.

 
Zee Zhou Ma:

I see. There will be redundant passes. I think this is something which can be addressed to service support. 

This looks more like a feature request, rather than something which can be solved on the forum. 

Maybe a moderator can answer to this.

Hi

Thanks for your reply. I really didn't catch what you said.

a moderator?

how can i get in touch? 

I've already posted an order, on the freelance section but so far was not successful.   https://www.mql5.com/en/job/91806

Freelance service at MQL5.com: Conditional Parameter Optimization solution needed
Freelance service at MQL5.com: Conditional Parameter Optimization solution needed
  • www.mql5.com
I have a problem in optimization passes. I've searched a lot but non of questions nor the answers in the forum was the one solving this problem. The problem is that i have some parameters in my inputs which when they are set as  there is no need to optimize some other parameters. for example if the "" parameter is set to my EA won't use...
 

Just wait for a moderator to reply to your thread or you can send the problem to service desk yourself.

I think this is a feature request to enhance the MT5 optimization tool to have "Conditional Parameter Optimization", rather than simply doing code changes.

I doubt code changes will produce the effect that you want, and I also doubt in the short to medium term, you will have the solution ready to your issue.

There will always be a forum moderator around. He is more experienced in issues than any of the forum members.

 
Mohammad Hossein Najarzadeh: if the "Psar_Active" parameter is set to false ... the "step" and "max"  (two other input parameters) of the indicator is useless
input bool Psar_Active=...

#define STEP_DEFAULT=0.02;
input double step=STEP_DEFAULT;

#define MAX_DEFAULT=0.20;
input double max=MAX_DEFAULT;

:
if(!Psar_Active && (
   step != STEP_DEFAULT ||
   max  !=  MAX_DEFAULT )) return INIT_PARAMETERS_INCORRECT;
 

I have a problem like this in MT4.
I have some boolen parameter in a expert. One of them If I do not set any option for optimization and the default value of this parameter is false, a result will be displayed, while if it is True, the result will not show any result and optimization work correctly.


when "Send Pending order?" parameter is false I have this result...


 

I have the exact same need as the OP:

If certain boolean input values are false, it negates the need for certain other inputs to be tested at all.

Currently wasting time, computing resources, and yes even cloud network budget ($) testing useless/irrelevant input parameters.

... Being that it has been some 3 years since this was posted, perhaps there have been some updates regarding this much needed feature (or a suitable workaround)?

Thanks much! =)

 
ddchbm #: (or a suitable workaround)?

The workaround was given.

 
William Roeder #:

I used Williams code to "develop" below. I thought I could share with everyone who is visiting this topic to find solution.


Just modify as required obviously, it's just an example of how this could be implemented.

input group "Trailing Stop";
const input int    iprofitToTrigger = 30;
const input double iprofitIncreaseToTriggerAgain = 0.05;
const input double iprofitToTake = 0.2;
const input bool   iincreaseProfitToTake = true;
const input double iincreaseUntil = 0.7;
const input double iincreaseBy = 0.05;

// Check input parameters
bool CheckOptimisationParameters()
{
// in the OnInit check for true/false and return ( INIT_PARAMETERS_INCORRECT ); if false
// this ends EA early and stops optimiser from running this set of parameters. Copy below to OnInit():
// if( CheckOptimisationParameters() == false ) return ( INIT_PARAMETERS_INCORRECT );

// input group "Trailing Stop";
   if ( iprofitToTake + iincreaseBy >= 1 ) return (false);
   if ( iprofitToTake + iincreaseBy >= iincreaseUntil ) return (false);
   if ( iincreaseUntil >= 1 ) return (false);


   return ( true );
}

int OnInit()
{
   if( CheckOptimisationParameters() == false ) return ( INIT_PARAMETERS_INCORRECT );

   return(INIT_SUCCEEDED);
}
 
William Roeder #:
The workaround was given.

Hi William! your workaround example was concise and enlightening but I have another question that can add to this problem in another way.

I get that returning 

INIT_PARAMETERS_INCORRECT;

in OnInit() will skip that pass in the optimization but it will also cut short the number of passes in that generation in the case of genetic optimization. As we know that genetic algo crosses the genes (inputs) from the last generations and pass on to the next one so I guess the combinations are defined at the time of genes crossover so if we have skipped a lot of passes in the previous generation then optimization may not have enough passes to properly crossover genes and pass onto the next generation. If true then it can mess up the algo efficiency. What do you think ?

 
Muhammad Fahad #:

Hi William! your workaround example was concise and enlightening but I have another question that can add to this problem in another way.

I get that returning 

in OnInit() will skip that pass in the optimization but it will also cut short the number of passes in that generation in the case of genetic optimization. As we know that genetic algo crosses the genes (inputs) from the last generations and pass on to the next one so I guess the combinations are defined at the time of genes crossover so if we have skipped a lot of passes in the previous generation then optimization may not have enough passes to properly crossover genes and pass onto the next generation. If true then it can mess up the algo efficiency. What do you think ?

Yes it can mess up the genetic algo. You need to use it sparsely (INIT_PARAMETERS_INCORRECT) or to redesign your inputs to avoid using it.
Reason: