Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
John
79
John 2014.08.02 17:30 

Hi, is it possible to sort an array of structs ?

Say:

struct profit_targets

{

   string   target_type;   //name of target, "Target 1", "Target 2" 

   double   target_price;  //price of the target

}; 

profit_targets   all_TP[2];

all_TP[0].target_type = "Target 1";

all_TP[0].target_price= 1.35666;

all_TP[1].target_type = "Target 2";

all_TP[1].target_price= 1.34711; 

How can I sort the array all_TP by target_price in Descending Mode ? 

ArraySort(all_TP.target_price,MODE_DESCEND);    does not work  :(

Thanks in advance. 

/
To add comments, please log in or register