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.
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.
There is no change in the documentation. Can you explain this in more detail?
Such a code
#property script_show_inputs#define externinput// macro redefinitionexternint i = 0;
voidOnStart() {}
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.
Perhaps it should be called ArrayReallocate, although I don't see any sense in such forced re-copying. It would cause unnecessary slowdown. The only thing is probably only if it's required to reset pointers for an array of class objects (invalidate their previous values), if it's accounted for somewhere (but it's rather a crutch)
Alexey Navoykov: Then it would probably be more correct to call it ArrayReallocate, although I don't see any sense in such forced recopying. Unnecessary braking.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.