Algorithm Optimisation Championship. - page 51

 

It's not clear about the second option, we need an example of participant's script, a balkan of some kind.

Imported FF, but it won't be visible in the participant's function and MaxFFruns_P variable won't be visible.

 
Dmitry Fedoseev:

It's not clear about the second option, we need an example of participant's script, a balkan of some kind.

Imported FF, but it won't be visible in participant's function and MaxFFruns_P variable won't be visible.

You mean the example of participant's algorithm?

Well, the algorithm has been told not to call FF more than so many times

InitAO (paramCount, MaxFFruns_P);

According to the second option, the member algorithm also imports FFs. I checked, one and the same copy of FF library is used in the script and in the algorithm. That is, the algorithm accesses the FF by its imported functions, and the script by its own, but the script's call count is correct.

Andrey Dik:

Now I will add examples of the algorithms themselves for both types of calls to the FF, at the very, native and beloved MSF. Please love and love, especially for beginners. They are easy to understand, an example of how you can build an elementary simple and at the same time working optimization algorithm.

 

Andrey Dik:

You mean an example of a participant's algorithm?

Here, the algorithm was told not to call the FF more than so many times.

InitAO (paramCount, MaxFFruns_P);

According to the second option, the member algorithm also imports FFs. I checked, the same copy of FF library is used in the script and in the algorithm.

That's what you need to show the template for the participant. The checker's script is shown.

The number of parameters is clear. But we need to write instructions, at least a couple of words.

 
There will be no need for global variables to stop. Just add an alert to the FF when the run limit is exceeded, so that it can be stopped manually. The algorithm should keep track of how many times it calls the FF.
 
Dmitry Fedoseev:

This is where the template for the participant should be shown. The checker's script is shown.

The number of parameters is clear. But we need to write instructions, at least a couple of words.

You should. There will be an instruction, of course.

But everything is simple enough, we won't need OOP to participate, and we believe that the participants will be able to understand 20 lines of code, they are not green kids since they came to the championship).

 
Andrey Dik:

We have to. There will be instructions, of course.

But everything is simple as it is, you won't need OOP to participate, and the participants will probably be able to understand 20 lines of code, since they are not green, since they came to the championship).

It may be simple, but only if you have to guess, it is somehow not presentable.
 

An example of a participant's algorithm for the first variant of the FF call:

#property library
#property strict

//+------------------------------------------------------------------+
void InitAO (int paramCount, int maxFFruns) export
{ 
}
//+------------------------------------------------------------------+
//
//+------------------------------------------------------------------+
void ServiceFunc1 () export
{ 
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
void ServiceFunc2 () export
{ 
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
void ServiceFunc3 () export
{ 
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
int GetReplaysCount () export
{ 
  return (1);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
void GetOptParam (double &param []) export
{ 
  GenerateParam (param);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
void   SendFFvolue (double volue) export
{ 
  if(volue > maxFFvolue) 
    maxFFvolue = volue;
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
double GetMaxFF () export
{ 
  return (maxFFvolue);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
bool StopAlgo () export
{ 
  return (false);
}
//+------------------------------------------------------------------+

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Все функции выше этой строки - обязательны! Именно они будут импортированы 
// и использованы тестовым скриптом. Они нужны для доступа к алгоритму оптимизации.
// Содержимое - произвольное, на усмотрение участника
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Ниже этой строки пример алгоритма оптимизации участника
//————————————————————————————————————————————————————————————————————
double maxFFvolue = - DBL_MAX;
double minParam   = -10.0;
double maxParam   = 10.0;
double stepParam  = 0.1;
//————————————————————————————————————————————————————————————————————

//————————————————————————————————————————————————————————————————————
// Генерация значений оптимизируемых параметров
void GenerateParam (double &param[])
{
  int size = ArraySize (param);
  double paramVolue = 0.0;
  for(int i = 0; i < size; i++) 
  {
    paramVolue = RNDfromCI (minParam, maxParam);
    param [i] = SeInDiSp (paramVolue, minParam, maxParam, stepParam);
  }
}
//————————————————————————————————————————————————————————————————————

//————————————————————————————————————————————————————————————————————
// Выбор в дискретном пространстве
double SeInDiSp (double in, double inMin, double inMax, double step) 
{ 
  if(in <= inMin) 
    return (inMin); 
  if(in >= inMax) 
    return (inMax); 
  if(step == 0.0) 
    return (in); 
  else 
    return (inMin + step * (double)MathRound ((in - inMin) / step));
}
//————————————————————————————————————————————————————————————————————

//————————————————————————————————————————————————————————————————————
// ГСЧ в заданном интервале
double RNDfromCI (double min, double max) 
{ 
  if(min == max) 
    return (min); 
  double Min, Max; 
  if(min > max) 
  {
    Min = max; 
    Max = min;
  }
  else 
  {
    Min = min; 
    Max = max;
  }
  return (double(Min + ((Max - Min) * (double)MathRand () / 32767.0)));
}
//————————————————————————————————————————————————————————————————————

Algorithm execution results:

2016.06.22 03:25:25.777 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:25:25.777 OAC variant 1 (GBPUSD,H1) Time: 146 µs; 0.00014600 c

2016.06.22 03:25:25.777 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:25:25.777 OAC variant 1 (GBPUSD,H1) Max: 3.14159260

2016.06.22 03:25:21.874 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:25:21.874 OAC variant 1 (GBPUSD,H1) Time: 148 µs; 0.00014800 c

2016.06.22 03:25:21.874 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:25:21.874 OAC variant 1 (GBPUSD,H1) Max: 3.10159260

2016.06.22 03:20:32.249 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:20:32.249 OAC variant 1 (GBPUSD,H1) Time: 149 µs; 0.00014900 c

2016.06.22 03:20:32.249 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:20:32.249 OAC variant 1 (GBPUSD,H1) Max: 3.06159260

2016.06.22 03:20:26.626 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:20:26.626 OAC variant 1 (GBPUSD,H1) Time: 153 µs; 0.00015300 c

2016.06.22 03:20:26.626 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:20:26.626 OAC variant 1 (GBPUSD,H1) Max: 3.09159260

2016.06.22 03:20:19.071 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:20:19.071 OAC variant 1 (GBPUSD,H1) Time: 154 µs; 0.00015400 c

2016.06.22 03:20:19.071 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:20:19.071 OAC variant 1 (GBPUSD,H1) Max: 3.14159260

2016.06.22 03:20:13.407 OAC variant 1 (GBPUSD,H1) ---------------------------------

2016.06.22 03:20:13.407 OAC variant 1 (GBPUSD,H1) Time: 152 µs; 0.00015200 c

2016.06.22 03:20:13.407 OAC variant 1 (GBPUSD,H1) FF runs: 1000

2016.06.22 03:20:13.407 OAC variant 1 (GBPUSD,H1) Max: 2.64159260

Not bad for an algorithm on the GCF! Isn't it?

 

I don't know what else to explain here. Everything seems clear, functions are short, there is no OOP as promised. Comments are present.

And, further, an example on the second variant of FF call, if Morpheus is not overpowered - he will be.

 
Andrey Dik:

I don't know what else to explain here. Everything seems clear, functions are short, there is no OOP as promised. Comments are present.

And then an example on the second version of FF call, if Morpheus is not overpowered - he will be.

I can write it that way too - what's unclear about my question?

 
Why does one question have to be asked 10 times?