Optimization parameters

 

Is it possible to set or inquire which optimization method to use?

In order to use a custom method the type of method has to be set to "Custom max" on the input panel and the appropiate module has to be loaded in "OnInit" 

It is easy to forget one or the other

 

Maybe I should rephrase this.

In order to use a Custom Optimization module 2 things must be done

  - Load the optimiztion module during Initialization in "OnInit"

  - Set to "Custom Max" on "settings" when doing the opimization run.

Forgetting one or the other would probably result in unpredicable results. If it is possible to getting information in "Oninit" if Optimization "Custom Max" is set

it would eliminate the risk of forgetting one or the other. I have been looking in help but not found anything.

Anyone else know??

 
ingvar_e:

Maybe I should rephrase this.

In order to use a Custom Optimization module 2 things must be done

  - Load the optimiztion module during Initialization in "OnInit"

  - Set to "Custom Max" on "settings" when doing the opimization run.

Forgetting one or the other would probably result in unpredicable results. If it is possible to getting information in "Oninit" if Optimization "Custom Max" is set

it would eliminate the risk of forgetting one or the other. I have been looking in help but not found anything.

Anyone else know??

OnInit ? How is it related to custom optimization ?

Don't you mean OnTester() ?

 
angevoyageur:

OnInit ? How is it related to custom optimization ?

Don't you mean OnTester() ?

  No it is really like this. (copied from an article here on this site.)

In Oninit the following code:

   if(UseCustomOptimize)
    { 
     criterion_Ptr=new TCustomCriterionArray();
     if(CheckPointer(criterion_Ptr)==POINTER_INVALID)
       {
        Alert("Could not get TCustomCriterionOnArray!!!");
        return(-1);
       } 
     criterion_Ptr.Add(new TBalanceSlopeCriterion(Symbol(),10000.0));
    }


and also an include

#include <CustomOptimisation.mqh>

The variable "UseCustomOptimize" is an  "sinput"  and if set to true the custom optimizaation is loaded

But then you have to specify "Custom max" as the optimization mathod" on the Strategy teste panel. So it is a twostep to get it to work.


So I would like to add the following type of code in On Init

Set Optimization to "Custom Max"

  or

Run the code above if I can test like this in OnInit

if Optimzation is set to "Custom max" do the code shown on top here instead of testing on a sinput variable.

As it is now I have to set the sinput "UseCustomOptimization" to true and remember to set the optimization metrics on the Optimization panel to "Custom max"

Reason: