Sort a list of parameters from a read File and displaying in Indicator window in ascending order

 

I have an Indicator that reads a list form a CSV file. Each line of the list has a 4 strings or numbers including date and time.

At any particular candlestick a certain number of lines from the CSV file is applicable. Say usually 5 or 6 lines for candlestick withing the date time in the list.

i would like to take the information from the CSV file and sort the lines applicable to the particular candlestick in the first date and time in the list and then by an integer from the information within the list.

eg, say

when condition is met for particular candlestick the following list is chosen.

Col. A Col.B Col C. Col B.

Date/time 1 USD 2 String 1

Date/time 2 USD 3 String 2

Date/time 3 USD 1 String 3

Date.time 4 USD 3 String 4

Date/time 5 USD 2 String 5

Date/time 6 USD 3 String 6

the list read from the file to be read and sorted according to ascending date/time and then by index number in Column C.

the data then to be displayed in the indicator window in the sequence 1, 2 and finally 3 of column C number.

Date/time 3 USD 1 String 3

Date/time 1 USD 2 String 1

Date/time 5 USD 2 String 5

Date.time 2 USD 3 String 2

Date/time 4 USD 3 String 4

Date/time 6 USD 3 String 6

There is no code at the moment.

Any advice would be welcomed.

Thanks in advance.

 

you have to create your own function for that, example:


//+-----------------------------------------------------------------+
//                    The following Fontion =:                      +
//                   StringArraySort(string& A[])                   +    
//                    is based on sxTed's code                      +
//                 https://www.mql4.com/users/sxted                  +
//                         taken from here:                         +
//              https://www.mql5.com/en/code/7791                +
//+-----------------------------------------------------------------+

void StringArraySort(string& Ary[])
   {
   bool   ok    = false;
   int    iRows = ArrayRange(Ary, 0), iRow;
   if(iRows == 0) return;
   int    iCols = ArraySize(Ary) / iRows, iCol;
   string sTemp = "";
  
   while(!ok)
      {
      ok = true ;
      for(iRow = 0; iRow < iRows -1; iRow++)
         {
         if(Ary[iRow] > Ary[iRow +1])
            {
            ok = false;
            for(iCol = 0; iCol < iCols; iCol++) 
               {
               sTemp        = Ary[iRow +1];
               Ary[iRow +1] = Ary[iRow];
               Ary[iRow]    = sTemp;
               }
            }
         }
      }
   }
 
qjol:


you have to create your own function for that, example:



Thanks qjol

Is there an example where I can see how the data is in-putted into this code?