In search of the sacred 'grail'... - page 9

 
Hoper23 >> :
The problem is, the goal of the task is clear, but the possibility of its implementation in MQL seems unclear, as I'm not yet familiar with the built-in array function of the tester-optimizer. I am trying to re-read the MQL manual but I have not found this block yet. And the self-made optimizer by thecore is not so much unreliable as not quite understandable. The variables are quite freakishly written there, there's no annotation and they are fundamentally different from the working version mentioned in the above link. If it is not difficult, dear thecore, explain your point of view of the optimizer, so that you can fit all 19 parameters and auto-replace the result.

I feel strange hearing this from a programmer, but I'll try to break it down (not spell it out):

1. Suppose you have a function with N number of input parameters

Function(n1,n2,...,n19);

2.Parameters

n1 varies from n1Min to n1Max with step n1Step

....

n19 changes from n19Min to n19Max with n19Step


You need to:

- Go through all (for the linear method) incoming parameters or not all (for the fast convergence method) incoming parameters.

There are a great many methods of fast convergence, one of which is the genetic algorithm.

- Each time you input a new batch of parameters, you get the result of the function at the output.

- You need to write a block to analyse these results and decide whether the result is

good.

I understand you're having trouble with the analysis unit. Because if you don't know how to write a function or how to

or how to look through the input parameters, it's not for me, it's for programming classes or people who like to spell out

the basics of programming.

What the analysis unit does:

1.It takes the oldest BAR_Y bar that you want to analyse, and slips the current at time Y data into your

function. That is, your function thinks BAR_Y is TimeCurrent.

2.Now take as many bars in the depth of history as your Function(n1,n2,...,n19) would take if it was at bar 0.

and obtain some result.

For example, your strategy is looking for an extremum along iMA3,iMA2,iMA1. Then we have iMA_Y+2,iMA_Y+1,iMA_Y

If it is an extremum point, we stop, if not we do Y++;

OK. We find the point of extremum at position t, i.e. iMAt+2,iMAt+1,iMAt

Now we need to calculate whether TP or SL will be triggered

I.e. from point t we step down bars t-1 and analyze the distance from Open[t] to High[t] and to Low[t],

and then from Open[t] to High[t-1] and to Low[t-1], if we don't reach TP or SL we go further - take t-2 and so on until it works out

TP or SL or both.

We have found the FIRST condition for Function(n1,n2,...,n19).

Let's save the result,

Next we make t-- and proceed with analysis up to bar 0.

4. We shift Y-- and repeat the process.

Thus we find all occurences of our function Function(n1,n2,...,n19) up to the current moment.

5.Analyze the current moment and see if there were similar situations in the past and how they ended.

6.Save the result.

7.Take the next set of parameters n1,,n19 for Function(n1,n2,...,n19) and check it

8.Repeat until we run out of parameters.

9. we choose the best set of parameters or several sets, and according to their recommendations, set BUY, SELL or

do nothing.

That's all.

I hope that it is difficult, because it really is difficult.


 
Hoper23 >> :
The problem is that the purpose of the task is clear, but the possibility of its implementation in MQL language seems unclear, as I'm not yet familiar with the function of the built-in array of the tester-optimizer. I am trying to re-read the MQL manual but I have not found this block yet. And the self-made optimizer by thecore is not so much unreliable as not quite understandable. The variables are quite freakishly written there, there's no annotation and they are fundamentally different from the working version mentioned in the above link. If not difficult, dear thecore, explain your point of view of the optimizer, so that I could cram all 19 parameters and autocomplete result.

By the way, don't start with brute force block - it's much easier to write than parser.

And if you find all that I have said too complicated, look for the auto-optimizer by xeon.

It uses MetaTrader optimizer. Do not look for the built-in auto-optimization function. There is none.

 
Figar0 >> :

Here is klot's indicator with GA optimizer embedded in the indicator.

I think Hoper23 will not genetically analyse it no matter if this link is broken or not.

All the more so, it is not broken.

 

thecore==>by your reasoning, as well as mine, you get for(S = Sstart; S <= Send; S += Sstep), well, in general terms. Here's what I got

void Optimization()
{
 int StartBar = iBarShift(Symbol(), 0, TimeCurrent()-60*( EndDate+ OptimDuration));
 int EndBar = iBarShift(Symbol(), 0, TimeCurrent()-60* EndDate);
 int Count = 0;
 double CurRF = -999999;
 ArrayInitialize( EqualProfit, 0);
 ArrayInitialize( TransCount, 0);
 ArrayInitialize( MaxDrowDown, 0);
 for( S = Sstart; S <= Send; S += Sstep)
 for( O = Ostart; O <= Oend; O += Ostep)
 for( I = Istart; I <= Iend; I += Istep)
 for( G = Gstart; G <= Gend; G += Gstep)
 for( M = Mstart; M <= Mend; M += Mstep)
 for( CC = CCstart; CC <= CCend; CC += CCstep)
 for( CCI = CCIstart; CCI <= CCIend; CCI += CCIstep)
 for( F_EMA = F_EMAstart; F_EMA <= F_EMAend; F_EMA += F_EMAstep)
 for( S_EMA = S_EMAstart; S_EMA <= S_EMAend; S_EMA += S_EMAstep)
 for( SMA = SMAstart; SMA <= SMAend; SMA += SMAstep)
 for( stK = stKstart; stK <= stKend; stK += stKstep)
 for( stP = stPstart; stP <= stPend; stP += stPstep)
 for( stD = stDstart; stD <= stDend; stD += stDstep)
 for( W = Wstart; W <= Wend; W += Wstep)
 for( H = Hstart; H <= Hend; H += Hstep)
 for( C = Cstart; C <= Cend; C += Cstep)
 for( Skill = Skillstart; Skill <= Skillend; Skill += Skillstep)
 for( SkillMAX = SkillMAXstart; SkillMAX <= SkillMAXend; SkillMAX += SkillMAXstep)
 for( shirina = shirinastart; shirina <= shirinaend; shirina += shirinastep)
   {
    int CurTrans =0;
    double CurOpenPrice = 0;
    int EqualMax = 0;
    int EqualMin = 0;
     for(int i = StartBar; i >= EndBar; i--)
      {
       EqualMin = MathMin( EqualProfit[ Count], EqualMin);
       if( EqualProfit[ Count] > EqualMax)
        {
         MaxDrowDown[ Count] = MathMax( MaxDrowDown[ Count], EqualMax- EqualMin);
         EqualMax = EqualProfit[ Count];
         EqualMin = EqualMax;
        }
        MaxDrowDown[ Count] = MathMax( MaxDrowDown[ Count], EqualMax- EqualMin);
    if( EqualProfit[ Count] != 0)
     if( CurRF < MaxDrowDown[ Count]/ EqualProfit[ Count])
      {
       CurRF = MaxDrowDown[ Count]/ EqualProfit[ Count];
       int Num = Count;
       int BestS = S;
       int BestO = O;
       int BestI = I;
       int BestG = G;
       int BestM = M;
       int BestCC = CC;
       int BestCCI = CCI;
       int BestF_EMA = F_EMA;
       int BestS_EMA = S_EMA;
       int BestSMA = SMA;
       int BeststK = stK;
       int BeststP = stP;
       int BeststD = stD;
       int BestW = W;
       int BestH = H;
       int BestC = C;
       int BestSkill = Skill;
       int BestSkillMAX = SkillMAX;
       int Bestshirina = shirina;

        }
     
    Count++;
   } // Цикл переменных 
 
   
 Alert("Оптимизация завершена. Прибыль max ", EqualProfit[ Num]," пунктов. Сделок ", TransCount[ Num], ". Просадка ", MaxDrowDown[ Num]);
 Alert("Параметры: S = ", BestS, ", O = ", BestO, ", I = ", BestI, ", G = ", BestG, ", M = ", BestM, ", CC = ", BestCC, ", CCI = ", BestCCI,
  ", F_EMA = ", BestF_EMA, ", S_EMA = ", BestS_EMA, ", SMA = ", BestSMA, ", stK = ", BeststK, ", stP = ", BeststP, ", stD = ", BeststD,
   ", W = ", BestW, ", H = ", BestH, ", C = ", BestC, ", Skill = ", BestSkill, ", SkillMAX = ", BestSkillMAX, ", shirina = ", Bestshirina);
 LastOptim = TimeCurrent();
 GlobalVariableSet("LastOptimization", LastOptim);
 if( CurRF < 0)
  if(MessageBox("Фактор восстановления меньше нуля./nПринимать данные оптимизированные параметры?", "Вопрос", MB_YESNO) == IDNO) 
    return;    
        BestS = S;
        BestO = O;
        BestI = I;
        BestG = G;
        BestM = M;
        BestCC = CC;
        BestCCI = CCI;
        BestF_EMA = F_EMA;
        BestS_EMA = S_EMA;
        BestSMA = SMA;
        BeststK = stK;
        BeststP = stP;
        BeststD = stD;
        BestW = W;
        BestH = H;
        BestC = C;
        BestSkill = Skill;
        BestSkillMAX = SkillMAX;
        Bestshirina = shirina;

 GlobalVariableSet("AutoS", S);
 GlobalVariableSet("AutoO", O);
 GlobalVariableSet("AutoI", I);
 GlobalVariableSet("AutoG", G);
 GlobalVariableSet("AutoM", M);
 GlobalVariableSet("AutoCC", CC);
 GlobalVariableSet("AutoCCI", CCI);
 GlobalVariableSet("AutoF_EMA", F_EMA);
 GlobalVariableSet("AutoS_EMA", S_EMA);
 GlobalVariableSet("AutoSMA", SMA);
 GlobalVariableSet("AutostK", stK);
 GlobalVariableSet("AutostP", stP);
 GlobalVariableSet("AutostD", stD);
 GlobalVariableSet("AutoW", W);
 GlobalVariableSet("AutoH", H);
 GlobalVariableSet("AutoC", C);
 GlobalVariableSet("AutoSkill", Skill);
 GlobalVariableSet("AutoSkillMAX", SkillMAX);
 GlobalVariableSet("Autoshirina", shirina);
Further stall - I don't know how to fix positive result and substitute in the variable automatically.
 
Hoper23 писал(а) >>

yyyyy ..... "The link that took you to this page is "dead" or deleted." Nice referral!!! Somewhat similar to the direction to go fuck yourself. (no offense, just for fun).

Here's a thank you), to me for the link, klot'y for actually ready solution on a plate), there you have both tester and optimizer, just tweak it a bit to suit your needs... And everything opens.

 

Answer not open!!!


 
Hoper23 >> :

thecore==>by your reasoning, as well as mine, you get for(S = Sstart; S <= Send; S += Sstep), well, in general terms. Here's what I got

1.Don't try to solve the problem head-on.

Why do you need to save ALL variants of all possible solutions.

You're not solving a math problem. You're looking at history for a situation similar to the one you have

today and now to decide what to do.

So, first describe the current situation and look specifically for it.

This will reduce the number of passes, variables and results by a LOT.

Next, stop - I don't know how to fix a positive result and put it into a variable automatically.

At the first stage, I saved it to a file. Received on the history of about 10,000-50,000 winning options.

Then analyzed in Excel.

2.Don't look for an exact match. It's not like we're describing a sine wave.

3.Write first a data collection block for ONE variable, debug it, and then add another 18 or how many variables you have.

 

Good. The idea is logical. Well then, how do you solve the formula for optimizing over combinations with a single parameter??? The whole point is that in this example they are interrelated. I don't know another example yet due to my limited knowledge of MQL language.

Combination = MathFloor((L1End-L1Start)/L1Step)*MathFloor((L2End-L2Start)/L2Step);
 

This nonsense is designed to optimise off-line

extern int setWeek   = 0;          //День недели старта оптимизации
extern int setHour   = 02;         //Час старта оптимизации
extern int setMinute = 25;         //Минута старта оптимизации
extern int ProgNumber= 2;          //номер программы оптимизации
extern bool OptimStart=false;
extern bool report=false;
#include <MacroAutoOptimization.mqh> 


int init() {


 if(IsOptimization()){
    string Str;
    int Cmd, Step, HandleStep;    
    HandleStep=FileOpen("ExpertMessage.csv", FILE_CSV| FILE_READ| FILE_WRITE,0x7F);
    if( HandleStep>0){
       Str  = FileReadString( HandleStep);
       Cmd  = StrToInteger(StringSubstr( Str,0,StringFind( Str,";",0)));
       Step = StrToInteger(StringSubstr( Str,StringFind( Str,";",0)+1,StringLen( Str)-StringFind( Str,";",0)-1))+1;
       FileSeek( HandleStep,0, SEEK_SET);
       FileWrite( HandleStep, Cmd+";"+ Step);
       FileClose( HandleStep);
  }} 

  
   return(0);
  }


int deinit()
  {
   Comment("Привет!");
   return(0);
  }

int start()
{

 if(IsOptimization()==false && IsTesting()==false){
        double Itog[][17];
        int TecWeek=TimeDayOfWeek(TimeLocal());
        int TecHour=TimeHour(TimeLocal());
        int TecMinute=TimeMinute(TimeLocal());
        if(! OptimStart){  
           if( TecWeek== setWeek){  
              if( TecHour== setHour){ 
                 if( TecMinute>= setMinute && TecMinute< setMinute+4){ 
                    if( AutoStart( ProgNumber, Itog)<0){Print("Оптимизация завершилась неудачей!");}
                    deinitialization();
                    OptimStart=true;
                    report=true;
        }}}}
        if( TecHour!= setHour){ OptimStart=false;}              //Обнуление флага старта оптимизации
        if(ArrayRange( Itog,0)>0){
//         Переменные для оптимизации
           stK     = Itog[0][7];
           stP   = Itog[0][8];
           stD  = Itog[0][9];
           W = Itog[0][10];
           H  = Itog[0][11];
           C  = Itog[0][12];
           CCI  = Itog[0][13];
           F_EMA  = Itog[0][14];
           S_EMA  = Itog[0][15];
           SMA  = Itog[0][16];
           shirina  = Itog[0][17];
           S  = Itog[0][18];
           O  = Itog[0][19];
           I  = Itog[0][20];
           M  = Itog[0][21];
           G  = Itog[0][22];
           CC  = Itog[0][23];
           if( report){
              Print("Новые параметры ", stK," | ", stP," | ", stD," | ", W," | ", H," | ", C," | ", CCI," | ", F_EMA," | ", S_EMA," | ", SMA," | ", shirina," | ", S," | ", O," | ", I," | ", M," | ", G," | ", CC);
              report=false;
     }}}   

It comes with a bible.

бла-бла-бла

And there's a biblah to go with it.

бла-бла-бла

And NOTHING WORKS...or rather it messes with itself, it stresses the CPU, but no changes in the variables and does everything fast - a couple of seconds and that's it. I don't understand.
 
Hoper23 >> :

This nonsense is designed to optimise off-line

It comes with a bible.

And then there's the biblah.

And it doesn't work... or rather it makes some jumbled mess of itself, stresses the CPU, but no changes in variables and makes everything fast - a couple of seconds and that's it. I don't understand.



You have started to work with xeon's auto-optimizer

TestCommander (autooptimization) Trader's tool

So ask him.

By the way, this product is already paid, if I remember correctly.

There is a help in it, everything is clearly explained there.