Hi!
Let's suppose I want to sort "valPair" and keep track of its corresponding "labelPair" index.
"ArraySort(valPair)" doesn't work because it replaces the "valPair" index and loses its corresponding "labelPair" index.
Can someone help?
Thanks very much!
To keep the binding between the label and value, you could store them in an array of structs or objects.
This dictionary object should work. There doesn't seem to be a sort() routine, though; so you would have to roll your own.
https://www.mql5.com/en/articles/1334#c3
Or using a struct:

- 2015.06.02
- Vasiliy Sokolov
- www.mql5.com
Thank you Anthony but your response is too difficult to understand, I'm a beginner programmer, moreover I'm using MQL4, not MQL5.
I would appreciate some practical help with a simple and clear example that works, thank you.
Hi!
Let's suppose I want to sort "valPair" and keep track of its corresponding "labelPair" index.
"ArraySort(valPair)" doesn't work because it replaces the "valPair" index and looses its corresponding "labelPair" index.
Can someone help?
Thanks very much!
double valPair[5][2];
valPair[1][0]....[1][4] point to LabelPair[0]...[4]
Can someone give a CLEAR AND SIMPLE MQL4 example that works?
Is it so difficult ??
Thanks
Hi!
Let's suppose I want to sort "valPair" and keep track of its corresponding "labelPair" index.
"ArraySort(valPair)" doesn't work because it replaces the "valPair" index and loses its corresponding "labelPair" index.
Can someone help?
Thanks very much!
You could try making valPair a 2 dimensional array, store the value in the first dimension and the index for labelPair in the second.
Then you could sort the array and use the second dimension value to find which pair is being referenced.
You could try making valPair a 2 dimensional array, store the value in the first dimension and the index for labelPair in the second.
Then you could sort the array and use the second dimension value to find which pair is being referenced.
Excellent! Thank you

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
Let's suppose I want to sort "valPair" and keep track of its corresponding "labelPair" index.
"ArraySort(valPair)" doesn't work because it replaces the "valPair" index and loses its corresponding "labelPair" index.
Can someone help?
Thanks very much!