Errors, bugs, questions - page 1623

 
Dmitri Custurov:
Thank you very much for the solution provided. Everything works.
Great. So the library and example use case I'm posting in KodoBase.
 
-Aleks-:
It would be much faster to read the entire array file into memory, and then work with it.
I don't think the optimizer will have to open-read-close the file tens of thousands of times.
 
Aliaksandr Yemialyanau:

How do I connect an array file to my EA?

First, the script writes an array:

I connect the file in the EA:

When compiling, errors:

'??????????????????????????t????...' - identifier is too long mas.dat 1 1

'' - unknown symbol mas.dat 1 3015

So what's the mas file? What kind of file? Judging by these errors, it's just a stream of bytes, right?
 

Serious bugs with static variables. Consider this code:

class A  { public:
            int m;
            A() { Alert("A");  m=1; }
         };

class B  { public:
            B() { Alert("B");  static A a;  Alert("a.m==",a.m);  Alert("&a==",&a);}
         };
B b;

void OnStart()
{
};

When executing it, we get the following order of alerts:

B
a.m==0
&a==0
A

That is, the static variable hasn't been initialized yet by the moment of accessing it. Even the pointer is null. It was just skipped and we safely move on.

Either initialize the variable and go further or abort the compilation with an error.

But when recursion of mutually referenced classes occurs, the compilation should be aborted.

 
Aliaksandr Yemialyanau:

How do I connect an array file to my EA?

First, the script writes an array:

I connect the file in the EA:

When compiling, errors:

'??????????????????????????t????...' - identifier is too long mas.dat 1 1

'' - unknown symbol mas.dat 1 3015

Your script should generate a file mas.mqh, which will contain an array of uchar-types containing bytes of your data. For example, if the file is three bytes in size, the contents of the mas.mqh file should be as follows:

uchar mass[3] = {25, 127, 89};

The generated array mass is what you should use in your program.

 
Aliaksandr Yemialyanau:
I don't think the optimizer will have to open-read-close the file tens of thousands of times.
Oh, so you want to compile with an array?
 
You don't have to read a file from the disk tens of thousands of times. That's what the disk cache is for, although I don't know if it's used in this particular case, but you should check and measure it before inventing crutches.
 
If I interrupt a single run in MT5, only the balance change graph is visible. But trades and orders are not available.
Using visualization mode is not always suitable due to possible additional slow calculations by MQLInfoInteger(MQL_VISUAL_MODE).
Is it possible to add the availability of all information during the backtest (without visualization), as it is in MT4?
 
In debugging mode on historical data, MQLInfoInteger(MQL_VISUAL_MODE) always returns true.
 
fxsaber:
In debug mode on historical data, MQLInfoInteger(MQL_VISUAL_MODE) always returns true.
What should it return?
Reason: