ArraySort - Export strings in descending or ascending order

 
- I'm having a problem exporting output in descending or ascending order. Any help, thank you very much.
- I have the idea of ​​calculating the score of the currency pairs. EX:

double My_array [7];
             My_array [1] = RSI_EUR_GBP;
             My_array [2] = RSI_EUR_AUD;
             My_array [3] = RSI_EUR_NZD;
             My_array [4] = RSI_EUR_USD;
             My_array [5] = RSI_EUR_CAD;
             My_array [6] = RSI_EUR_CHF;
             My_array [7] = RSI_EUR_JPY;
double SELL_1 = ArrayMaximum (My_array);
double BUY_1 = ArrayMinimum (My_array);
        ---> DONE. EX:
SELL_1 = 6
BUY_1 = 3
            
string SORT_1 = ArraySort (My_array, WHOLE_ARRAY, 0, MODE_DESCEND);

However, with the above command, I only get 1 unique value: 7
How can I output the string in descending order?
---> EX SORT_1 = 6,7,5,4,2,1,3

FINAL GOAL IS:
Comment =
                     "\ nBUY =" + DoubleToStr (BUY_1,0) +
                     "\ nSELL =" + DoubleToStr (SELL_1,0) +
                     "\ nSORT_BUY =" + string (SORT_1);
 
vusonme:
- I'm having a problem exporting output in descending or ascending order. Any help, thank you very much.
- I have the idea of ​​calculating the score of the currency pairs. EX:

double My_array [7];
             My_array [1] = RSI_EUR_GBP;
             My_array [2] = RSI_EUR_AUD;
             My_array [3] = RSI_EUR_NZD;
             My_array [4] = RSI_EUR_USD;
             My_array [5] = RSI_EUR_CAD;
             My_array [6] = RSI_EUR_CHF;
             My_array [7] = RSI_EUR_JPY;
double SELL_1 = ArrayMaximum (My_array);
double BUY_1 = ArrayMinimum (My_array);
        ---> DONE. EX:
SELL_1 = 6
BUY_1 = 3
            
string SORT_1 = ArraySort (My_array, WHOLE_ARRAY, 0, MODE_DESCEND);

However, with the above command, I only get 1 unique value: 7
How can I output the string in descending order?
---> EX SORT_1 = 6,7,5,4,2,1,3

FINAL GOAL IS:
Comment =
                     "\ nBUY =" + DoubleToStr (BUY_1,0) +
                     "\ nSELL =" + DoubleToStr (SELL_1,0) +
                     "\ nSORT_BUY =" + string (SORT_1);

MQL4?  ArraySort() returns a bool, not string. So if it returns true, you'll have to iterate through and create a string out of it's content.

 
Seng Joo Thio:

MQL4?  ArraySort() returns a bool, not string. So if it returns true, you'll have to iterate through and create a string out of it's content.

Thank you so much for the reply.
I really have no knowledge of programming languages. Should face many difficulties. If the string output difficult. You can send me a document to help you find the second largest value of this table.

double My_array [7];
              My_array [1] = RSI_EUR_GBP;
              My_array [2] = RSI_EUR_AUD;
              My_array [3] = RSI_EUR_NZD;
              My_array [4] = RSI_EUR_USD;
              My_array [5] = RSI_EUR_CAD;
              My_array [6] = RSI_EUR_CHF;
              My_array [7] = RSI_EUR_JPY;
double SELL_1 = ArrayMaximum (My_array);

double BUY_1 = ArrayMinimum (My_array);


Thanks again for your help!
 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2.  double My_array [7];
                  My_array [1] = RSI_EUR_GBP;
                  My_array [2] = RSI_EUR_AUD;
                  My_array [3] = RSI_EUR_NZD;
                  My_array [4] = RSI_EUR_USD;
                  My_array [5] = RSI_EUR_CAD;
                  My_array [6] = RSI_EUR_CHF;
                  My_array [7] = RSI_EUR_JPY; 
    Your array has seven (7) elements. Their indexes are [0 … 6]. You would know that if you had used strict.

    Always use strict. Fixing the warnings will save you hours of debugging.

  3. Why did you post your MT4 question in the Root / MT5 Indicators section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

 
William Roeder:
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Your array has seven (7) elements. Their indexes are [0 … 6]. You would know that if you had used strict.

    Always use strict. Fixing the warnings will save you hours of debugging.

  3. Why did you post your MT4 question in the Root / MT5 Indicators section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

Sorry about this carelessness.
I will remember the note carefully. Thank you so much!