Not for MT developers! What to replace INIT_PARAMETERS_INCORRECT with ? - page 5

 
Сергей Таболин:

Now for the substance. I have created a file with legitimate chains. How do I use it now? I suspect it should be through onTester, frames... Looked at the documentation, but something doesn't add up. Can't figure out how to deal with it.

I'm thinking of reading it into an array and taking data from it...

I think this problem is better solved analytically. You need to generate a chain on the fly, knowing its index. Google "Combinatorics. It seems to be solved via Pascal's triangle. At least I solved this problem for searching combinations, I think there will be something similar for placements.

In general, I'm not very clear about the purpose of your problem. Why can't the functions be repeated in the chain?

 
Alexey Navoykov:

In general, I'm not very clear on the purpose of your task. Why can't the functions be repeated in a chain?

Well, if so:

  • 11
  • 22

then why?

And if it's like this:

  • 121
then the total would be like 21. And a chain of 21 would repeat that result. Duplication, extra time for, in principle, useless runs...

 
Сергей Таболин:

If that's the case:

  • 11
  • 22

then what's the point?

And if it's like this:

  • 121
then the total would be like 21. And a chain of 21 would repeat that result. Duplication, extra time for, in principle, useless runs...

I thought the processing of functions is sequential, i.e., the result of calculation of the first function is passed to the input of the second function, etc. And it turns out that everything works independently? Then it's even unclear, what you are optimizing there.

 
Сергей Таболин:

A file has been created with the legitimate chains. How do I use it now? I suspect you have to use onTester, frames...

Frames have nothing to do with it. Use either tester_file or COMMON. Here is a working example.

 
Сергей Таболин:

It's not about architecture. It's about the set of functions and how they are applied.

Give more information about the role of these functions in your program (this is the architecture in question).

 

Functions for defining market entry conditions.

Made read chains from a file by entry number. Started genetics. It seems to be working and does not swear.

The only question is: chains are not systematized in any way and will the genetics will find the best variant? It doesn't look at all of them. Shouldn't we start by sorting the resulting file? How to do it?

 

I sorted a text file. Now I have to read the string with chain, break it into components and fill the array.

But when compiling, it immediately generates a warning, and I don't understand why...

//+------------------------------------------------------------------+
void OnTick()
{
//---
//--- считать цепочки из файла
   int chain[6];
   string   filenameF   = "KR\\func_KrL_sort.txt";
   string   filename    = "KR\\func_KrL_sort.bin";
   string   str, str_chain[];
   if(FileIsExist(filenameF,FILE_COMMON))
   {
      int filehandleF = FileOpen(filenameF,FILE_READ|FILE_TXT|FILE_COMMON);
      if(filehandleF != INVALID_HANDLE)
      {
         for(int f = 0; f <= 1953; f++)
         {
            ArrayInitialize(chain,0);
            FileReadString(filehandleF,str); // implicit conversion from 'string' to 'number'
            Print(str);
            StringSplit(str,",",str_chain);  // implicit conversion from 'string' to 'number'
            for(int i = 0; i <= 5; i++)
            {
               ArrayInitialize(chain,0);
               chain[i] = (int)StringToInteger(str_chain[i]); // array out of range
               Print(string(chain[0])+","+string(chain[1])+","+string(chain[2])+","+string(chain[3])+","+string(chain[4])+","+string(chain[5]));
            }
         }
         
         FileClose(filehandleF);
         ExpertRemove();
      }
   }
}
//+------------------------------------------------------------------+

On startup thearray out of range error

Contents of the text file:

1,0,0,0,0,0
1,2,0,0,0,0
1,2,3,0,0,0
1,2,3,4,0,0
1,2,3,4,5,0
1,2,3,4,5,6
1,2,3,4,6,0
1,2,3,4,6,5
1,2,3,5,0,0
1,2,3,5,4,0
...........
 

Reworked:

//+------------------------------------------------------------------+
void OnTick()
{
//---
//--- считать цепочки из файла
   int chain[6];
   string   filenameF   = "KR\\func_KrL_sort.txt";
   string   filename    = "KR\\func_KrL_sort.bin";
   string   str, str_chain;
   if(FileIsExist(filenameF,FILE_COMMON))
   {
      int filehandleF = FileOpen(filenameF,FILE_READ|FILE_TXT|FILE_COMMON);
      if(filehandleF != INVALID_HANDLE)
      {
         for(int f = 0; f < 1953; f++)
         {
            ArrayInitialize(chain,0);
            str = FileReadString(filehandleF);
            //Print(str); // этот рисует всё как надо
            for(int i = 0, p = 0; i <= 5; i++, p += 2)
            {
               str_chain   = StringSubstr(str,p,1);
               chain[i]    = (int)StringToInteger(str_chain);
            }
         }
         
         FileClose(filehandleF);
         ExpertRemove();
      }
   }
}
//+------------------------------------------------------------------+
 
Сергей Таболин:

But the question is: the chains are not systematised in any way, will genetics find the best option? It doesn't look at all the variants. Shouldn't we start by sorting the file? How do we do that?

Of course it won't. You first have to understand the genetic algorithm, understand what genes are.

Your approach, voiced in the first post ("I, as a user, want to get a result, and I don't care how it works") is absolutely wrong in this case.

 
Alexey Navoykov:

Your approach, as stated in the first post ("I, as a user, want results, and I don't give a damn how it works") is completely wrong in this case.

This is not the case. as long as there is no clear documentation and tutorial from MK on their genetics, it is mockery to demand from the user a deep knowledge of genetics. there may be a huge number of implementations, so even a deep knowledge of genetics does not mean a guaranteed effective optimization

Reason: