Features of the mql5 language, subtleties and tricks - page 122

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Result
The third option (switch) is steadily slower than the second (function pointers). What's the reason for this?
ZS Slowly. The third switch is faster than the second switch. Everything is fine.
So, if you have an immutable array of pointers to functions, it will be faster if you replace it with switch.
So, if we have an immutable array of pointers to functions, it's faster if we replace it with switch.
Well, in this case it's logical, because the array was filled in dynamically, which means constant pointer validity checks. Although it could be optimized, of course...
But if MQL supported array initialization by constant pointers, it would probably be the same.
p.s. Your code is not readable at all. Of course, I understand that you will find all these intricacies with macros convenient, since you wrote them yourself, so you know what they do. But for an external reader, it's just a puzzle. I think you yourself are unlikely to understand what you have done here in six months ) At least make a comment or something ...
p.s. Your code is completely unreadable. Of course, I understand that you are comfortable with all these contrivances with macros, because you yourself wrote them, so you know what they do. But for an external reader - it's just a puzzle. I think you yourself are unlikely to understand what you did there in six months ) At least make a comment or something ...
Otherwise you'd be a mess. Moreover, I was experimenting with the number of transitions. Without macros it would have been difficult. About the additional comments - I'll take it into account in the future.
Otherwise it would have been a mess. What's more, I experimented with the number of transitions. Without macros it would have been difficult. About the additional comments - I'll take it into account in the future.
Sometimes it's much easier to take apart a comprehensible sprawl than to start to take apart a compact puzzle and immediately abandon this useless activity.
Sometimes it's much easier to unscramble a comprehensible piece of writing than to start parsing a compact puzzle and immediately abandon the useless task at hand.
In addition to the above, one of the most common causes of mismatched runs in the tester is faulty initialisation or lack thereof.
While missing variable initialization is simple, arrays are a bit more complicated. Most often it is the finding of situations where the number of array elements increases that may indicate a problem place.
In order to catch such potential problems, you can insert these strings at the beginning of the Expert Advisor
If the situation is caught, then the detailed information will be written into the log and the run will be stopped.
SZZ Example application.
I understand, I often use this method myself, but what about initialization? How can it be invalid?
For example, ArrayResize and ArrayInitialize are mixed up. Or, for example, the indicator performs ArrayInitialize of the buffer at OnInit, mistakenly thinking that the buffer is initialized.
For example, ArrayResize and ArrayInitialize are mixed up.
Well, this is a very childish error. is it worth such an effort to find it?
Well, it's a childish mistake. Is it worth the effort to find it?
Finding any error takes effort. Especially when the code is large and not your own.