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
Sometimes you need to sort the data in MQL4 without touching the data itself. There are no pointers in MQL4, there are no structures either.
Alternative variant is to create array Positions[][2], copy the parameter to be sorted by the zero index and give the first index to the positions. Then sort the array with standard function AgraSort.
The advantage is that AgraSort uses an efficient sorting algorithm, moreover, it works in native code.
Alternatively, you can create an array Positions[][2], copy the parameter to be sorted by the zero index and give the first index to the positions. Then sort the array with standard function AgraSort.
Could you convert my script, on the previous page, using your method? I don't understand the description.
I liked the way suggested by https://www.mql5.com/ru/users/candid. Used to make it a bit more complicated. I will use a simpler one. You can sort by any attribute. Very convenient.
Could you convert my script, on the previous page, using your method? I don't understand the description.
I won't give you the whole script, but I will give you a sketch of the function, it should be enough to understand the idea
Now, Positions[0][1] contains the index of the smallest Array element, Positions[1][1] contains the index of the next largest Array element and Positions[i][1] contains the index of the i-th element.
I won't write the whole script, but I will give you a sketch of the function, it should be enough to understand the idea.
I did not know about the peculiarities of working with multidimensional arrays in MQL4. Thank you, the method works: