Errors, bugs, questions - page 288

 

so as not to repeat the post. Please take a look at https://www.mql5.com/ru/forum/2547/page1#comment_45265

What am I doing there wrong? Everything seems to be as described in the article. I want to learn how to work with standard classes. But I seem to be doing it wrong (.

Обсуждение статьи "Как использовать торговые классы Стандартной библиотеки при написании советника"
Обсуждение статьи "Как использовать торговые классы Стандартной библиотеки при написании советника"
  • www.mql5.com
Обсуждение статьи "Как использовать торговые классы Стандартной библиотеки при написании советника".
 
Trolls:

so as not to repeat the post. Please take a look at https://www.mql5.com/ru/forum/2547/page1#comment_45265

What am I doing there wrong? Everything seems to be as described in the article. I want to learn how to work with standard classes. But I seem to be doing it wrong (.

Answered there.
 

An error in the function

string  DoubleToString(
   double  value,      // число
   int     digits=8    // кол-во знаков после запятой
   );

When digits >= 12

void testDoubleToString()
  {
   int i,j,cn=11,digits=DBL_DIG+1;
   double dblVal,dblValFromStr,pres=0.1;
   string dblStr;
   Print("Start testDoubleToString cn=",cn," digits=",digits);
   for(i=1; i<=digits; i++)
     {
      for(j=2; j<cn; j++)
        {
         dblVal = 1.0/j;
         dblStr = DoubleToString(1.0/j, i);
         dblValFromStr=StringToDouble(dblStr);
         if(MathAbs(dblValFromStr-dblVal)>pres)
           {
            Print("ERROR from function DoubleToString digits: ",i," value: 1/",j," dblVal: ",
               dblVal," strVal: ",dblStr," dblValFromStr: ",dblValFromStr);
           }
        }
      pres*=0.1;
     }
  }
//---
void OnStart(){testDoubleToString();}
//---

It gives out

ERROR from function DoubleToString digits: 14 value: 1/10 dblVal: 0.1 strVal: 1.00000000000000 dblValFromStr: 1
ERROR from function DoubleToString digits: 14 value: 1/9 dblVal: 0.1111111111111111 strVal: 1.11111111111111 dblValFromStr: 1.111111111111
ERROR from function DoubleToString digits: 14 value: 1/8 dblVal: 0.125 strVal: 1.25000000000000 dblValFromStr: 1.25
ERROR from function DoubleToString digits: 14 value: 1/7 dblVal: 0.1428571428571429 strVal: 1.42857142857143 dblValFromStr: 1.42857142857143
ERROR from function DoubleToString digits: 14 value: 1/6 dblVal: 0.1666666666666667 strVal: 1.666666666666667 dblValFromStr: 1.6666666666667
ERROR from function DoubleToString digits: 14 value: 1/5 dblVal: 0.2 strVal: 2.00000000000000 dblValFromStr: 2
ERROR from function DoubleToString digits: 14 value: 1/4 dblVal: 0.25 strVal: 2.50000000000000 dblValFromStr: 2.5
ERROR from function DoubleToString digits: 14 value: 1/3 dblVal: 0.333333333333333333 strVal: 3.333333333333333333 dblValFromStr: 3.33333333333333
ERROR from function DoubleToString digits: 14 value: 1/2 dblVal: 0.5 strVal: 5.00000000000000 dblValFromStr: 5
ERROR from function DoubleToString digits: 13 value: 1/10 dblVal: 0.1 strVal: 1.0000000000000 dblValFromStr: 1
ERROR from function DoubleToString digits: 13 value: 1/9 dblVal: 0.111111111111111111 strVal: 1.1111111111111 dblValFromStr: 1.11111111111
ERROR from function DoubleToString digits: 13 value: 1/8 dblVal: 0.125 strVal: 1.2500000000000 dblValFromStr: 1.25
ERROR from function DoubleToString digits: 13 value: 1/7 dblVal: 0.1428571428571429 strVal: 1.4285714285714 dblValFromStr: 1.4285714285714
ERROR from function DoubleToString digits: 13 value: 1/6 dblVal: 0.1666666666666667 strVal: 1.666666666667 dblValFromStr: 1.666666666667
ERROR from function DoubleToString digits: 13 value: 1/5 dblVal: 0.2 strVal: 2.0000000000000 dblValFromStr: 2
ERROR from function DoubleToString digits: 13 value: 1/4 dblVal: 0.25 strVal: 2.5000000000000 dblValFromStr: 2.5
ERROR from function DoubleToString digits: 13 value: 1/3 dblVal: 0.33333333333333333333 strVal: 3.33333333333333333 dblValFromStr: 3.333333333333333
ERROR from function DoubleToString digits: 13 value: 1/2 dblVal: 0.5 strVal: 5.0000000000000 dblValFromStr: 5
ERROR from function DoubleToString digits: 12 value: 1/10 dblVal: 0.1 strVal: 1.000000000000 dblValFromStr: 1
ERROR from function DoubleToString digits: 12 value: 1/9 dblVal: 0.1111111111111111 strVal: 1.111111111111 dblValFromStr: 1.111111111111
ERROR from function DoubleToString digits: 12 value: 1/8 dblVal: 0.125 strVal: 1.250000000000 dblValFromStr: 1.25
ERROR from function DoubleToString digits: 12 value: 1/7 dblVal: 0.1428571428571429 strVal: 1.428571428571 dblValFromStr: 1.428571428571
ERROR from function DoubleToString digits: 12 value: 1/6 dblVal: 0.16666666666667 strVal: 1.6666666666667 dblValFromStr: 1.66666666667
ERROR from function DoubleToString digits: 12 value: 1/5 dblVal: 0.2 strVal: 2.000000000000 dblValFromStr: 2
ERROR from function DoubleToString digits: 12 value: 1/4 dblVal: 0.25 strVal: 2.500000000000 dblValFromStr: 2.5
ERROR from function DoubleToString digits: 12 value: 1/3 dblVal: 0.333333333333333333 strVal: 3.3333333333333333 dblValFromStr: 3.333333333333
ERROR from function DoubleToString digits: 12 value: 1/2 dblVal: 0.5 strVal: 5.000000000000 dblValFromStr: 5


OS: WIN7

Build: 387

 
BZSP:

An error in the function

string  DoubleToString(
   double  value,      // число
   int     digits=8    // кол-во знаков после запятой
   );

When digits >= 12

Thank you, we will take a look.
 

How do I set the height of the chart subwindow? if a function? or only through a template?

 
dentraf:

How do I set the height of the chart subwindow? if a function? or only through a template?

All functions are described in the help.

Do it through the template.

 
В классе CArray #include <Arrays\Array.mqh> 
забыли прописать виртуальные методы Reserve()и Resize() 
 

Here's a funny thing - when you run the STRATEGY TESTER by default

is set to low priority, now I have to manually change it to medium every time.


Maybe that's the way it's supposed to be?

 

alexluek:

Maybe this is the way it's supposed to be?

Yes, it's specifically designed to run multiple local agents in optimization mode.

The point is that the tester uses CPU very intensively and easily takes 100% of all cores in the system. If you leave the priority "medium", the CPU will be loaded to 100% and even the terminal will lack resources. The situation is especially bad with single-core processors.

That is why the default setting for agents in optimization mode is low priority, which allows other programs to work as well. If a computer is not busy with other work, then even at a low priority, agents will get all the CPU resources (lowering CPU priority does not mean direct reduction of resources).

Most likely, we would change the priority from "low" to "below average" - this would be enough to keep the operating system responsive under full load with local agents in optimization mode.

It is important to note that when running a single agent and having more than 1 core, this agent runs at "medium" priority. A single agent with additional cores may not affect the whole system as much.


ps: look at your screenshot - even at low priority the CPU load is 95%.

 
Renat:

Yes, this is done specifically to run multiple local agents in optimisation mode.

....

ps: look at your screenshot - even at low priority the CPU load is 95%.


Please keep it in mind. Thanks