//+------------------------------------------------------------------+
//|                                                          cci  x3 |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//2009fxtsd
#property copyright "Copyright © 2005, Metaquotes"
#property link      "mailto:metaquotes@metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 3

#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Green

#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1

#property indicator_level1      100
#property indicator_level2     -100
#property indicator_levelcolor SlateGray

//---- input parameters
extern int      CCI1_period=14;
extern int      CCI2_period=34;
extern int      CCI3_period=55;

extern int      CCI1_price=4;
extern int      CCI2_price=4;
extern int      CCI3_price=4;

extern string   note_Price = "0C 1O 2H 3L 4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";

//---- 
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);

   SetIndexBuffer(2, ExtMapBuffer1);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexBuffer(0, ExtMapBuffer3);

   string shortnme;
   shortnme = "("+CCI1_period+","+CCI2_period+","+CCI3_period+") ";
   
   IndicatorShortName("cci "+shortnme);  

   SetIndexLabel(2,"cci1 "+shortnme);
   SetIndexLabel(1,"cci2 "+shortnme);
   SetIndexLabel(0,"cci3 "+shortnme);

   //----
   return(0);
  }
//+------------------------------------------------------------------+

int deinit()
  {
    return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i,limit;
   int counted_bars = IndicatorCounted();
//---- 
   if(counted_bars < 0)        return(-1);
   if(counted_bars > 0)        counted_bars--;

   limit = Bars - counted_bars;


   for(i = limit; i >= 0; i--)
     {
     
      ExtMapBuffer1[i]=iCCI(NULL,0,CCI1_period,CCI1_price,i);
      ExtMapBuffer2[i]=iCCI(NULL,0,CCI2_period,CCI2_price,i);
      ExtMapBuffer3[i]=iCCI(NULL,0,CCI3_period,CCI3_price,i);
     
     }

//----
   return(0);
  }
//+------------------------------------------------------------------+