Features of the mql5 language, subtleties and tricks - page 81
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
Forum on trading, automated trading systems and testing trading strategies
Discussion of article "Creating and testing custom symbols in MetaTrader 5"
fxsaber, 2018.04.12 07:59
Probably not many people do so, so I use the second variant when I need to parse something. Probably works faster too, I haven't checked it.
The second option is not only better, but also more correct. The first variant is unreliable. It contains a fatal error that leads to a fatal error.
The second option is not only better, but also more correct. The first variant is unreliable. It contains fatal error and fatal error.
I did not see any special problems in the first variant. As for the second, it seems that it is used by one or two people.
I did not see any particular problem with the first option. As for the second, it seems that one or two people use it.
How about this? What about this one:
if not a fatal error?
How about this? What about this:
if not a fatal error?
You can use Reserve to speed it up. But the point of Reserve is questionable in this case, because the array of complex objects is a string.
As for fatal error, handling a negative ArrayResize value is up to your taste.
You can use Reserve to speed it up. As for the fatal error, handling a negative ArrayResize value is optional.
No, it's not about acceleration. We should think about reliability first. And that's why processing of ArrayResize value return cannot be called "at will". After all, this thread is not for beginners where the basics are explained and simplified examples are given.
P. S. By the way, ArrayResize can return a positive value, but it will still cause an array overrun error.The processing of the ArrayResize value return can by no means be called "at will". After all, this is not a branch for beginners, where the basics are explained and simplified examples are given.
In this case, I do not see it appropriate to kill the clarity for the sake of reliability. The task was to show the second method. Here it was a demonstration of a method, not a universal ready-made solution.
You must not copy-paste my codes. They are always for training purposes only. That is the person is supposed to understand the code and having grasped the main idea he will write his own variant based on it.
There will be no overrun of the array in this situation.
Please:
In cases where the arrnArray array cannot be expanded, ArrayResize will return the current array size (at least 0). Therefore, executing the body of the loop will cause the array to go outside the array.