Features of the mql5 language, subtleties and tricks - page 130
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
Thank you. Using the ArraySwap function would not have occurred to me.
I understand that your function will work for both increasing and decreasing the size, i.e. as a full analogue of ArrayResize.
Isn't it better to simply call the standard ArrayResize function when an array is enlarged, rather than calling the three functionsArraySwap,ArrayResize,ArrayCopy?
p.s Tested your version and mine with two copies when reducing the MqlTick array from 1,000,000 to 500,0000. Your version does it in 22 milseconds. Mine does it in 37-38.Isn't it better to simply call the standard ArrayResize when an array is enlarged than to call three functionsArraySwap,ArrayResize,ArrayCopy
I thought about it, but didn't do it, because there are actually more subtleties. That's why I decided to stick with the laconic version.
One of the subtleties is this. If you take an array of structures with constructors/destructors, ArrayResize will call them in either direction in an amount equal to the difference in values.
But applying ArrayCopy is calling all constructors. Removing ArrayTmp is a call to all destructors. So ArrayResize2 is not really ArrayResize.
After optimisation, you will see the following
If you switch off the Expert Advisor in frame mode and run it in standard mode, it will show the same data that it got during optimization.
This approach allows you to go back to the Optimization results many times.
SZY On the chart which is opened in the Terminal for frame mode, you can't run any Expert Advisor. So if you want to run it in standard mode, you should run it on a chart which has not been opened for frames.
fxsaber:
extern теперь является жестко заданным макросом
Accordingly, it will not always be possible to make the MT5 mq4 code work without changes.
There are no changes in the documentation. Can you explain this in more detail?
There is no change in the documentation. Can you explain this in more detail?
Such a code
will always generate a warning. I'm being a bit harsh about "impossible". It is possible to override, so just a warning will always hang in such situations.
One of the nuances is this. If you take an array of structures with constructors/destructors, then ArrayResize in either direction calls them in a number equal to the difference in values.
But applying ArrayCopy is calling all constructors. Removing ArrayTmp is a call to all destructors. So ArrayResize2 is not really ArrayResize.
Then it would probably be more correct to call it ArrayReallocate, although I don't see any sense in such forced recopying. Unnecessary braking.
Freeing up memory is the only reason.