Sorted array in a vertical format

 

Hello,

I am wondering if anyone can help with an indicator that I am trying to build. The general idea is to have a vertical list made up of 14 rows and 3 columns. The first column would contain currency pair symbol names, the second column would contain the amount of pips from that pair's daily open price, and the third column would contain the pip spread for that pair. I know how to get the currency pair symbol on the chart and how to get the spread on the chart as well. My problem is that I need to be able to create a sorted list, that is in descending order, that auto sorts as pip spreads change.

For example, when big news comes out, the pip spreads go crazy and I would like the list to stay in order of spread size so that i can tell, by a simple glance, what pair has the smallest spread or the largest spread at any one time.

Here is the beginning code that I am working with. If anyone can help, I would greatly appreciate it.

extern color font_color = White;
extern color pos_color = LimeGreen;
extern color neg_color = Red;
extern int font_size = 11;
extern string font_face = "Arial";
extern int corner = 0; //0 - for top-left corner, 1 - top-right, 2 - bottom-left, 3 - bottom-right

//------

extern int currencypair_x = 10;
extern int currencypair_y = 60;
extern int pipcount_x = 150;
extern int pipcount_y = 60;
extern int titles_x = 10;
extern int titles_y = 35;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
      ObjectMakeLabel( "currencypair", currencypair_x, currencypair_y );
      ObjectMakeLabel( "pipcount", pipcount_x, pipcount_y );
      ObjectMakeLabel( "titles", titles_x, titles_y );

   return(0);
} // end of init()


//+------------------------------------------------------------------+
//| Custom indicator iteration function -- Runs with each new tick   |
//+------------------------------------------------------------------+
int start()
  {
 
  ObjectSetText( "titles", "Pair                     " + "PIPS          " + "Spread", font_size, font_face, font_color );

 //------------------------------------------------
  
  double EUopen = iClose("EURUSD",PERIOD_D1,0)-iOpen("EURUSD",PERIOD_D1,0);
  
   string EUpips2opens;
   {
      double EUpips2open =MathFloor(EUopen/Point/10);
      EUpips2opens = StringConcatenate(DoubleToStr(EUpips2open,0),"");
   }
   
   string EUnegpips;
   {
   if (EUpips2open < 0)
   double EUnegpip = MathAbs(EUopen/Point/10);
   EUnegpips = StringConcatenate(DoubleToStr(EUnegpip,0),"");
   }
   
           ObjectSetText( "currencypair", Symbol(), font_size, font_face, font_color );
      if (EUpips2open >= 0) ObjectSetText( "pipcount", EUpips2opens, font_size, font_face,pos_color );
      else ObjectSetText( "pipcount", EUnegpips, font_size, font_face,neg_color );
   
   return(0);
} // end of start()

//+------------------------------------------------------------------+
//| Custom functions                                                 |
//+------------------------------------------------------------------+

int ObjectMakeLabel( string n, int xoff, int yoff ) {
   ObjectCreate( n, OBJ_LABEL, 0, 0, 0 );
   ObjectSet( n, OBJPROP_CORNER, corner );
   ObjectSet( n, OBJPROP_XDISTANCE, xoff );
   ObjectSet( n, OBJPROP_YDISTANCE, yoff );
   ObjectSet( n, OBJPROP_BACK, false );
} // end of ObjectMakeLabel

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   //----
   ObjectDelete( "currencypair" );
   ObjectDelete( "pipcount" ); 

   return(0);
} // end of deinit()