//+------------------------------------------------------------------+
//|                                            string array test.mq4 |
//+------------------------------------------------------------------+
#property strict
#property indicator_chart_window

input string WhichDay="1;2;3;4;5;6;7;";
int k=0;
int i=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
 void OnDeinit( const int _reason )
  {
//--- indicator buffers mapping
    for( i=0; i < k; i++) {
     ObjectDelete(0,"whichday"+IntegerToString(i));
     }
//---
  
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
     // A string to split into substrings
   string separator=";";          // A separator as a character
   ushort separator_character;    // The code of the separator character
   string resultarray[];          // An array to get strings
   //--- Get the separator code
   separator_character=StringGetCharacter(separator,0);
   //--- Split the string to substrings
   k=StringSplit(WhichDay,separator_character,resultarray);
   //--- Now output all obtained strings
 
      for( i=0;i<k;i++)
        {
         draw_label("whichday"+IntegerToString(i),resultarray[i],0,25, 15+25*i, 10, "Arial Bold", clrRed); 
   
        }
    
 
//--- return value of prev_calculated for next call
   return(rates_total);
  }
  
  
void draw_label(string name, string text, int corner_of_chart, int x, int y, int font_size, string font_name, color font_color)
  {
   ObjectCreate(name, OBJ_LABEL, 0, 0, 0);
   ObjectSet(name, OBJPROP_CORNER, 1);
   ObjectSet(name, OBJPROP_XDISTANCE, x);
   ObjectSet(name, OBJPROP_YDISTANCE, y);
   ObjectSet(name, OBJPROP_BACK, false);
   ObjectSetText(name, text, font_size, font_name, font_color);

  }
  
//+------------------------------------------------------------------+
