//+------------------------------------------------------------------+
//|                                                       pivots.mq4 |
//|                                  Copyright 2012, Kaleshwar Chand |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, Kaleshwar Chand"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//#property indicator_color2 Blue
double Buf_0[];
double Buf_1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
//---- indicators
SetIndexBuffer(0,Buf_0);         // Assigning an array to a buffer
//SetIndexBuffer(1,Buf_1);  
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
  // SetIndexStyle (1,DRAW_LINE,STYLE_SOLID ,2);// Line style
start();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  int i,Counted_bars;  
     Counted_bars=IndicatorCounted(); // Number of counted bars
   i=Bars-Counted_bars-1;           // Index of the first uncounted
   while(i>=0)                      // Loop for uncounted bars
     {
      Buf_0[i-1]=(((High[i] + Low[i] + Close[i]) / 3)+((High[i+1] + Low[i+1] + Close[i+1]) / 3)+((High[i+2] + Low[i+2] + Close[i+2]) / 3))/3;            // Value of 0 buffer on i bar            // Value of 1st buffer on i bar
      i--;                          // Calculating index of the next bar
     }

   return(0);
  }
//+------------------------------------------------------------------+