use of MQLInfoInteger(MQL_OPTIMIZATION)

EdFuk
54
EdFuk  

I'm trying to run some code if in a tester optimization. My code below doesn't seem to work and MQLInfoInteger(MQL_OPTIMIZATION) seems to be false. The function is called from OnTesterPass. Should that make a difference?

Cheers

E


void WriteTestResultsToFile(string& parameters_list[], int pass, ushort& data[])
  {
   string     optimised_params[];
   int        optimised_param_count    = 0;

//--- STORE PARAMETERS THAT ARE ENABLED FOR OPTIMIZATION
   if(MQLInfoInteger(MQL_OPTIMIZATION))
     {
      printf(MQLInfoInteger(MQL_OPTIMIZATION));
      for(int i=0; i<ArraySize(parameters_list); i++)
        {
         if(ParameterEnabledForOptimization(parameters_list[i]))
           {
            optimised_param_count +=1;
            ArrayResize(optimised_params, optimised_param_count);
            optimised_params[i] = parameters_list[i];
           }
        }
     }