What on earth is going on? - page 6

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

If you make several optimisations, with the same parameters of the EA, do the results of different optimisations coincide? if they do, then the problem is in the difference between the optimiser and the single pass. if they do not - then the problem is definitely in the EA's code.

 

Let me explain - the trendy writing here in the :

if (condition) {

} else if (!condition) {

}

supposedly increasing readability and understanding of the code, is actually an evil

and plus you have to work very, very carefully with double

 
Andrey Dik:

Do you think that a global EA variable retains its value from past optimiser runs and is carried over to the next ones?

Yes, that's about right. I was trying to do that.

Only it was not just a global variable but a static class member or a terminal variable or something else.


Moreover, a single test immediately after launching the terminal and a repeated one on the same agent can be different. For the same reason.

All in all, you need to initialize everything and keep a scrupulous eye on it.


ps: no, that reminds me. I was fine with initialization, it was one of the builds that initialized statics glitchily. Got it fixed promptly.

 
Andrey Dik:

any transfer of EA variable contents from one run to another should be considered as a bug of the tester, even if it concerns global variables of the terminal.

If there are several copies of one EA running on charts in real time, the user uses a mage or other ways of identification, and the optimization process implies multiple and independent of each other runs of one EA with the same mage, if it is not so, then not only it is wrong from the ideological point of view of optimization, but it opens the possibility to influence the optimization and abuse the market products by misleading the buyer.

Waiting for TC's report on unpruned deals, intrigue though.

Not set up for a holy thief.

The point, as always, is simple - the EA is not unloaded to optimize faster. EX files can be large.

 

Only today I had time to get to grips with the problem. I decided to start small. One thing at a time. Including checking opened files. The code is as follows:

      int      h     = FileOpen(filename, FILE_BIN|FILE_READ|FILE_COMMON);
      if(h == INVALID_HANDLE)
      {
         Print("Ошибка открытия файла обученной сети по индикатору >>> ",name);
         writeErrorFile(program_name,program_version,"======= "+IntegerToString(bars_count-1)+" === Ошибка открытия файла обученной сети по индикатору >>> "+name);
         writeOptTestFile(file_Opt_Tst,"======= "+IntegerToString(bars_count-1)+" === Ошибка открытия файла обученной сети по индикатору >>> "+name+"\n");
         FileClose(h);
         return(TRADESIGNAL_NO);
      }

I've run optimization and then a single test. As a result, I got two files:

1_100_100_300_300_.opt
1_100_100_300_300_.tst

I opened these two files in the WinMerge program. And this is what I saw there

There is a problem with opening files in the optimizer. Note that there is no such error in the tester!

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

There is a problem with the optimiser opening files. Note that there is no such error in the tester!

Several cores open the file at the same time. One opens, the rest get screwed up.
Need code with waiting, or at least FILE_SHARE_READ flag

 

If you:

  • are accessing the same file from an EA in the commons area
  • get access errors
  • do not protect against shared access by multiple parallel processes, do not try to repeat with a timeout
Then of course you will get the difference in optimizer and single pass. This is a logical error.
 
Andrey Khatimlianskii:

Several cores open the file at the same time. One opens, the others get screwed.
I need code with waiting, or at least FILE_SHARE_READ flag

Well, I didn't write the code specifically for the optimizer. It was expected that the optimizer would already be aware of such nuances. I'll try to add a flag, it won't make it worse. )))

Renat Fatkhullin:

If you:

  • are accessing the same file in the comon zone from an Expert Advisor
  • get access errors
  • do not protect from shared access by multiple parallel processes, do not try to repeat with a timeout.
Then of course you will get the difference in optimizer and single pass. This is a logical error.

  1. I'm including the commit zone solely for the convenience of finding files.
  2. ....
  3. I don't have any shared access. These files are only accessed by one EA.
 

Since there is still no code, the testing conditions are not described in any way, and you are making clearly erroneous statements, then deal with it yourself.

If you cannot even open files, it means that there are many problems in the Expert Advisor.

You have even hidden the names of these files.

 
Renat Fatkhullin:

Since there is still no code, the testing conditions are not described in any way, and you are making clearly erroneous statements, then deal with it yourself.

If you cannot even open files, it means that there are many problems in the Expert Advisor.

You have even hidden these file names.

There is no code because adding the balloon really solved the problem. Now the optimisation results and single runs are fully consistent.

It's just that I hardly used files in EAs before (at least all writing/reading during optimization/testing was disabled), but thought the optimizer solved the issue of access from a single EA.

Reason: