//------------------------------------------------------------------
#property link      "www.forex-station.com"
//------------------------------------------------------------------
#property indicator_separate_window
#property indicator_buffers  3
#property indicator_color1   clrSilver
#property indicator_color2   clrSilver
#property indicator_width1   2
#property indicator_width2   2
#property indicator_width3   2
#property strict


extern int    BufferNumber1 = 0;  // Fisrt buffer number (<0 to skip it)
extern int    BufferNumber2 = -1; // Second buffer number (<0 to skip it)
extern int    BufferNumber3 = -1; // Third buffer number (<0 to skip it)
extern string IndicatorName      = "Enter indicator name"; // Indicator name to use

double Buffer1[],Buffer2[],Buffer3[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
int init() 
{
   SetIndexBuffer(0 ,Buffer1);
   SetIndexBuffer(1 ,Buffer2);
   SetIndexBuffer(2 ,Buffer3);
   IndicatorShortName("Exploring buffers ("+(string)BufferNumber1+","+(string)BufferNumber2+","+(string)BufferNumber3+") of "+IndicatorName);
   return(0);
}
int start() 
{
   static bool checked=false; static datetime checkedAt=0;
   int counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);
         if (!checked)
         {
            if (checkedAt!=Time[0])
            {
               checkedAt = Time[0];
               ResetLastError();
                  double dummy = iCustom(NULL,0,IndicatorName,0,0);
               int error = GetLastError();  checked = (error==0);
               if (error == ERR_INDICATOR_CANNOT_LOAD)
               {
                  Alert("enter correct indicator name in parameters");
                  Alert("Buffers explorer : wrong indicator name");
               }                  
            }                  
         }
         if (!checked) return(0);

   //
   //
   //
   //
   //
            
   for(int i=limit; i>=0; i--)
   {
      if (BufferNumber1>=0) Buffer1[i] = iCustom(NULL,0,IndicatorName,BufferNumber1,i);
      if (BufferNumber2>=0) Buffer2[i] = iCustom(NULL,0,IndicatorName,BufferNumber2,i);
      if (BufferNumber3>=0) Buffer3[i] = iCustom(NULL,0,IndicatorName,BufferNumber3,i);
   }
   return(0); 
}
