I've 3 different input parameters : P1 [1..10], P2 [1..10]
and P3 [3..10]
. The constraints are the following : P1 < P2 < P3
.
Some potential solutions should be discarded right away when the constraints are not respected. For instance when P1 = 2
, P2 = 1
and P3 = 4
.
Is there a way to accomplish such thing with MetaTrader optimization ?
( eventually using an OnTesterPass()
function ? )
I'm losing a lot of time during my optimization because of that and I'd like to find a way to discard or skip directly the potential solution when the constraints are not respected.
Thanks for your help
int OnInit(){
if(P1<P2 && P2<P3){} // OK
else{
printf("%i %s - parameters SKIPPED, !(P1<P2<P3)",__LINE__,__FUNCTION__);
return(INIT_FAILED);
}
}
That is all.
The printf()
is not called during optimization.
Either INIT_FAILED
or INIT_PARAMTERS_INCORRECT
stop the optimization of a particular set and the [ MT4 Strategy Tester ] goes right to the next set of parameters.
You do not need OnTesterPass()
because it is called after test is done, OnInit()
is automatically called Event-handler right upon entering a new set of optimisation parameters into such a test run.