-
The logical way, as suggested by Fabio, means you can't use thee built in sort. Instead you have to use my insertion sort (non-pointer) method.
Sort multiple arrays - MQL4 programming forum #9
Array or not to array - Trading Positions - MQL4 programming forum - Page 2 #20.4Or (object pointer) CList method:
pass generic class data field - Swing Trades - MQL4 programming forum -
Alternatively, make an index, and then sort.
string names[] = {"USD", "EUR", "NZD", "CAD"}; // 0 1 2 3 Array[][2] = {1,0}, {4,1}, {3,2}, {2,3} }; // and after sort : Array[][2] = {1,0}, {2,3}, {3,2}, {4,1} }; // names[ array[1][1] ] == "CAD"
Remember the built in sort, sorts by the first index, not the last.
-
The logical way, as suggested by Fabio, means you can't use thee built in sort. Instead you have to use my insertion sort (non-pointer) method.
Sort multiple arrays - MQL4 programming forum #9
Array or not to array - Trading Positions - MQL4 programming forum - Page 2 #20.4Or (object pointer) CList method:
pass generic class data field - Swing Trades - MQL4 programming forum -
Alternatively, make an index, and then sort.
Remember the built in sort, sorts by the first index, not the last.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In MQL4 is it possible to create a two-dimensional array whose first dimension is a number and the second is a string? If the answer is yes, is there a way to sort it?
Like this :
and after sort :
Improperly formatted code edited by moderator. Please use the CODE button (Alt-S) when inserting code.