Tester Optimization - Initialization failed on the pass

Back to topics list To post a new topic, please log in or register
avatar
1
jdaniele 2015.08.29 15:33
 

Hi,

 I'm trying to optimize my EA but the mt4 tester behaves bad in the following situation...

 

In the OnInit() i have some check of passed parameters and if something is wrong, I return the INIT_PARAMETERS_INCORRECT.

 

int OnInit()
{
   int result = INIT_SUCCEEDED;
      
   bool canSignal = ((TakeProfitPips > 0) || (TrailingStepPips > 0)); // at least one must be > 0 to make any profit
   
   if (!canSignal)
      result = INIT_PARAMETERS_INCORRECT;

   return(result);
}

Now, in the expert properties window, if I set:

 TakeProfitPips = 10

 TrailingStepPips = 0

and I run the expert (no optimization enabled), it works. OK

If I set the 2 parameters like so: 

 TakeProfitPips = 0

 TrailingStepPips = 0

and I run the expert (no optimization enabled), it fails the initialization, as expected by code, because both properties are zero. Ok.

 Well, if the I try to enable the optimization with the following settings:

 TakeProfitPips = from 0 to 10 step 10   (2 values, 0 and 10)

 TrailingStepPips = 0 (FIXED)

as soon the optimizer tests the first pass ( TakeProfitPips = 0, TrailingStepPips = 0), it fails to initialize, as expected! Up to now everything is OK!

PROBLEM: when the optimizer tests the second pass ( TakeProfitPips = 10, TrailingStepPips = 0), it FAILS again, and it will fail any other pass after the first it cannot initialize (i tried it with 10 passes).

I would expect the optimizer should be able to initialize the EA on second pass. 

 

Just for a second try, I inverted the condition to return INIT_PARAMETERS_INCORRECT.

int OnInit()
{
   int result = INIT_SUCCEEDED;
      
   bool canSignal = ((TakeProfitPips > 0) || (TrailingStepPips > 0)); // at least one must be > 0 to make any profit
   
   if (canSignal)
      result = INIT_PARAMETERS_INCORRECT;

   return(result);
}

In this case the optimizer, do the first pass without errors, and fails on the second (as expected).

 

So, to sum up, it seems the optimizer will execute test passes as far as it finds the first initialization fail. After that, it will fail any other passes.

In my opinion, that is wrong, may be a bug (or maybe i'm doing something wrong in code).

Can anyone confirm this is a strange behavior?

How can I tell the optimizer to stop executing that particular pass (due to incorrect set of properties), and continue from following ones?

The goal is to check illegal parameters values combinations to instruct the optimizer to not continue testing a "no sense" set of properties, saving a lot time. 

Thing about 10-15 parameters and all the combinations of wrong/no sense values and you'll save hours of testing time. 

Thanks in advance for your help.

jdaniele 

avatar
125
zirkoner 2015.08.29 21:43 #
 
That's a bug you can report it to Metaquotes.
Back to topics list  

To add comments, please log in or register