
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
Copying the array "into itself", starting at the position next to the one to be deleted and writing from the one to be deleted. And then resize as Grigori.S.B suggested
Interestingly, if I understood you correctly, do you need to use this function?
Good morning, thank you for your reply.
I guess you haven't noticed, you can look above, all the questions were about MQL5.
I understand that the difference is not crucial sometimes, but nevertheless. The function you cited resizes the array, perhaps cutting off extra elements if the size is reduced.
This is not what is needed. You need to remove an element by finding it by value. I tried this function too, I wrote about it in #23. Thanks anyway.
I have not paid attention to it too. mql5 has ArrayRemove function and no problems.
In this caseArrayRemove is more suitable, there is an example in the manual, it works exactly the same way
The only problem is, these examples and functions are designed for one-dimensional arrays, and they don't want to work with two-dimensional arrays.
I think I'm missing something very important and fundamental. But what is it?
I'm telling you, I've already lost the reference book.
In this caseArrayRemove is more suitable, there is an example in the manual, it works exactly the same way
The only problem is, these examples and functions are designed for one-dimensional arrays, and they don't want to work with two-dimensional arrays.
I think I'm missing something very important and fundamental. But what is it?
I'm telling you, I've already lost track of it.
For a two-dimensional array, you need to multiply the line number for deletion by 2. For a 3-dimensional array multiply by 3...
I don't quite understand this, could you please elaborate on it, or better yet, show me the edit on a piece of my code, I posted it above. If it's inconvenient, then whatever, I'll figure it out somehow.
No, the order is not important, you just need to delete a known (found by knowledge, index is known) entry. It can be anywhere in the array (at the beginning, in the middle, at the end).ArrayRemove is great, everything would be fine, but how to apply this function to a two-dimensional array? the manual is silent about it.
No, the order is not important, we just need to delete a known (found by cognition, index is known) record. It can be anywhere in the array (at the beginning, in the middle, at the end).ArrayRemove is great, everything would be fine, but how to apply this function to a two-dimensional array? There's nothing in the manual about it.
In this caseArrayRemove is more suitable, there is an example in the manual, it works exactly like this
The only problem is, these examples and functions are designed for one-dimensional arrays, and they don't want to work with two-dimensional arrays.
I think I'm missing something very important and fundamental. But what is it?
I'm telling you, I've lost the reference book.
That's nonsense. I used this function without reading the manual. In the debugger I saw how the element was deleted and the array size was instantly reduced. I checked it, it works even with an array of structures without any problems. Now I cannot work with the code, but only words: For example, I want to delete the 3rd index from a 2-dimensional array. It turns out that the fifth and sixth values have to be removed. When copying, the function, HOWEVER, arranges all values into a one-dimensional array and it turns out that the third pair begins with index 5. In general this comes to a realization after a few experiments.
As for ArrayRemove when I can, I'll test it on 2-4 dimensional arrays. For want of need I've never tested it and didn't suspect it didn't work.
Added:
Checked. Don't forget that you can't resize a static array. That's why in the example from the documentation the size of the array remains the same and the last two strings are repeated. When you delete rows from a dynamic array, the size changes without any problems.
The handbook should be scrubbed to the holes:)))) in the monitor.
Here is the 3-dimensional array and the result:
That's rubbish. I used this function without reading the manual. In debugger I saw how element is deleted and array size is instantly reduced. Checked, even on an array of structures works without problems. Now I cannot work with the code, but only words: For example, I want to delete the 3rd index from a 2-dimensional array. It turns out that the fifth and sixth values have to be removed. When copying, the function, HOWEVER, arranges all values into a one-dimensional array and it turns out that the third pair begins with index 5. In general this comes to a realization after a few experiments.
As for ArrayRemove when I can, I'll test it on 2-4 dimensional arrays. For want of need I've never tested it and didn't suspect it didn't work.
Added:
Checked. Don't forget that you can't resize a static array. That's why in the example from the documentation the size of the array remains the same and the last two strings are repeated. When you delete rows from a dynamic array, the size changes without any problems.
The directory has to be scrubbed to the holes:)))) in the monitor.
Here I have made a 3 dimensional array and the result:
Your example is very slow, with a large number of values this will be noticeable.
With a lot of what? Array elements that are not even filled on every tick? How will it be noticeable?