Errors, bugs, questions - page 2621

 

Stumbled across a confusion in a seemingly obvious place. Here's the script:

double Sigma = 1.0;
double Smax = 5.0;
double Step = 2;


void OnStart()
{
  int scount = 1;

  double s = Sigma;

  for( ; s < Smax; scount++)
  {
    s *= Step;
    Print(scount, " ", s);
  }
  
  Print(scount);
}

for some reason ends up with scount equal to 4, although it's supposed to be 3. Increment loop after successful check should be executed only when s equals 1.0, 2.0, 4.0. Then there is 8 in s, which is more than 5.

 
Stanislav Korotky:

Stumbled across a confusion in a seemingly obvious place. Here's the script:

for some reason ends up with scount equal to 4, although it's supposed to be 3. Increment loop after successful check should be executed only when s equals 1.0, 2.0, 4.0. Then s contains 8, which is greater than 5.

in the for statement increment is performed after the end of the loop bodyhttps://www.mql5.com/ru/docs/basis/operators/for

for(expression1; expression2; expression3)operator;

выражение1;
while(выражение2)
  {
   оператор;
   выражение3;
  };

googled the first article, in case I don't remember - it works the same way in C++ https://en.cppreference.com/w/cpp/language/for

init_statement
while ( condition ) {
statement
iteration_expression ;
}
 
Igor Makanu:

In the for statement, the increment is made after the end of the loop bodyhttps://www.mql5.com/ru/docs/basis/operators/for

for(expression1; expression2; expression3)

Exactly. The loop variable must pass the values 1, 2, 3. Because after the third multiplication the condition is not fulfilled: 8 > 5 - this can be seen from the last print from the loop.

 
Stanislav Korotky:

Exactly. The loop variable must pass the values 1, 2, 3. Because after the third multiplication the condition is not met: 8 > 5 - this can be seen from the last print of the loop.

yes, but the body of the loop is executed, right? so there is an increment after the end of the body "expression3", then there is a check - "expression2"

 
Igor Makanu:

yes, but the body of the loop is done, right? so there is an increment after the end of the "expression3" body, then there is a check - "expression2"

Friday is the last Friday of the year :-/

 

1- The test result runs have stopped running. There is space on the drive. Everything is there. What was running a few minutes before suddenly stopped.

I press start button, or click on optimization result and nothing happens. This is the kind of thing that just appears:

2019.12.29 11:44:51.402 Tester single pass started

And one time, this message appears:

2019.12.29 11:41:56.053 Tester debug version of "Name.ex5" detected

Although no debug is enabled and this EA is not opened in editor at all and editor is disabled, nothing was compiled or changed.

Parameters from the optimization to the settings, it successfully transfers and that's where it visually stops.


2- And the "stop" button in the forwarder fails. It alternatively does not change its colour from pink to green, or the terminal just gets to the intermediate state, when it does nothing, but I cannot select anything in the "settings" tab, because everything is disabled there.

Pressing the stop button again starts the run. And you can stop it before forward and then it's fine.


3- And another "trick" is that the optimisation starts to run a few times slower. Just over time. Cures by restarting the terminal.... Something is piling up somewhere... Clearing log and cache doesn't seem to affect this slowdown. But restarting has a big effect!
Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Тестер стратегий позволяет тестировать и оптимизировать торговые стратегии (советники) перед началом использования их в реальной торговле. При тестировании советника происходит его однократная прогонка с начальными параметрами на исторических данных. При оптимизации торговая стратегия прогоняется несколько раз с различным набором параметров...
 
Михаил:

The test result runs have stopped running. Disk space is there. Everything is there. What was running a few minutes before suddenly stopped.

I press the start button, or click on the optimization result and nothing happens. This is the kind of thing that just appears:

2019.12.29 11:44:51.402 Tester single pass started

And one time, this message appears:

2019.12.29 11:41:56.053 Tester debug version of "Name.ex5" detected

Although no debug is enabled and this EA is not opened in the editor at all and the editor is disabled, nothing was compiled or changed.

It successfully saves parameters from optimization to settings and visually stops at that.


And the "stop" button in the forwarder does not work properly. Sometimes it does not change its colour from pink to green, or the terminal just gets to the intermediate state when it does nothing but cannot select anything in the settings tab because everything is disabled there.

Pressing the stop button again starts the run. And you can stop it before forward and then it's fine.


And another 'trick' is that the optimisation starts to run several times slower. Just over time. Remedies by restarting the terminal.... Something is building up somewhere... Clearing log and cache doesn't seem to affect this slowdown. But restarting has a big effect!

You have to compile release-version by F7. You pressed F5 and compiled debug-version

 
Artyom Trishkin:

You have to compile the release version by F7. You pressed F5 and compiled debug-version

Nah, I compile with mouse and "Compile" button. But it doesn't apply to the described case, because this EA was compiled the day before yesterday. Then it was successfully optimized and ran several times. And then it crashed. Rebooting the terminal helped...

So it just feels like there are bugs piling up somewhere. Which leads to malfunctions and brakes. Resetting (restarting) cures...
 
And another thing - the further away (by date) the forward run is, from the start date of the forward run, the slower it goes. At first it is fast, and then slower and slower. And then catastrophically slower. It's a good idea to fix that)
 
Михаил:
And another thing - the further away (by date) the forward run is, from the start date of the forward run, the slower it goes. At first it is fast, and then slower and slower. And then catastrophically slower. It would be nice to fix it)

No code to play - no response

Reason: