Sorting my Comments based on values high to low - Please help.

 

Hi Guys, I'm at a loss.

I have searched everywhere, far and wide, but alas, I struggle to even remotely find relevent information on sorting my comments based on their values.

Probably because it's too simple. Please excuse my coding noobness.

My dilemma below: (Sorry for not sharing my entire code, but this should be sufficient)


Comment(" The Euro is: ",EUROStrength,"\n"
        , " The USD is: ",USDStrength,"\n"
        , " The AUD is: ",AUDStrength,"\n"
        , " The CHF is: ",CHFStrength,"\n"
        , " The CAD is: ",CADStrength,"\n"
        , " The GBP is: ",GBPStrength,"\n"
        , " The JPY is: ",JPYStrength,"\n"
        , " The NZD is: ",NZDStrength,"\n"
        , "The Time is: ",CurrentTime  

 So these variables throw out a number between 1 and 8, 1 being weak while 8 is strong.

I want to be able to make these comments sort themselves from strongest to weakest (ie. 8 is  commented 1st, while 1 is last or 8th)

The variables with values are EUROStrength/USDStrength and so forth

Could you please assist or point me into the right direction.


Kind Regards

 
  1. Sort a 2D array[nStrength][nCurrency] Then create your strings.
  2. You have n strings. Sort them.

    My insertion sort (non-pointer) method.
              Sort multiple arrays - MQL4 programming forum
              Array or not to array - Trading Positions - MQL4 programming forum - Page 2

    Or (object pointer) CList method:
              pass generic class data field - Swing Trades - MQL4 programming forum

 
William Roeder:
  1. Sort a 2D array[nStrength][nCurrency] Then create your strings.
  2. You have n strings. Sort them.

    My insertion sort (non-pointer) method.
              Sort multiple arrays - MQL4 programming forum
              Array or not to array - Trading Positions - MQL4 programming forum - Page 2

    Or (object pointer) CList method:
              pass generic class data field - Swing Trades - MQL4 programming forum

Thank you for the help! This is MQL5 actually, will it still apply?
 

Ok, So It seems I got to create an Array and sort it, but have no idea how to call the strings from them, here is what I have.

Could you advise how to go about linking the array names? I don't really understand the 2D concept so well yet.


Kind Regards

int RSArray[8];
RSArray[0] = EUROStrength // These are int value from -7:7
RSArray[1] = USDStrength;
RSArray[2] = AUDStrength;
RSArray[3] = CHFStrength;
RSArray[4] = CADStrength;
RSArray[5] = GBPStrength;
RSArray[6] = JPYStrength;
RSArray[7] = NZDStrength;

ArraySort(RSArray);