Please, show your code.
Stanislav Korotky:
Please, show your code.
Please, show your code.
Solved!
If the Array is SetAsSeries, the ArraySort() function effectively sorts it in the opposite direction.
I suppose this is what the following line in the documentation means:
An array is always sorted in the ascending order irrespective of the AS_SERIES flag value.
Torinex:
Solved!
If the Array is SetAsSeries, the ArraySort() function effectively sorts it in the opposite direction.
I suppose this is what the following line in the documentation means:
An array is always sorted in the ascending order irrespective of the AS_SERIES flag value.
The array must be a dynamic array and then you use ArraySetAsSeries(arr,true) before doing ArraySort(arr)
That solved it for me too!

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
I have probably misunderstood the documention for the ArraySort() function in MQL5.
https://www.mql5.com/en/docs/array/arraysort states "Sorts the values in the first dimension of a multidimensional numeric array in the ascending order".
When I use this function, my arrays are sorted with Array[0] being the largest value and Array[ArrayLength-1] the smallest:
ARRAY SORT TEST
0,19.00000000001345
1,18.99999999999125
2,17.00000000000035
3,13.99999999998069
4,13.00000000001855
5,9.000000000014552
6,7.000000000001449
7,6.000000000017102
8,5.999999999994897
9,5.999999999994897
10,0.0
ArrayMaximum = 0
ArrayMinimum = 10
Array Sorted in Descending Order. Array[0] = 19.00000000001345
This result (at least for me) suggests that the sorting of largest to smallest is in Descending order.
Does anyone have a view on this?
Thanks in advance.