//+------------------------------------------------------------------+
//|                                            cci_x2_smzCrossSig_sw |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//2009fxtsd   ki

#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers 4


#property indicator_color1 Blue
#property indicator_color2 DarkSlateBlue
#property indicator_color3 DodgerBlue
#property indicator_color4 DarkViolet


#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1

#property indicator_level1  100
#property indicator_level2 -100
#property indicator_levelcolor DarkSlateGray

//---- input parameters

extern int      CCI1_period =14;
extern int      CCI1_price  =5;

extern int      CCI2_period =34;
extern int      CCI2_price  =5;

extern int      cciLevel_PosNeg = 100;


extern int  MA1_period   =5;
extern int  MA1_mode     =0;

extern int  MA2_period   =5;
extern int  MA2_mode     =0;

extern double arrowDist  =1.1;

extern string   note_Price = "0C 1O 2H 3L 4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";
extern string   MA_Method_ = "SMA0 EMA1 SMMA2 LWMA3";

//---- 
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];

//+------------------------------------------------------------------+

int init()
  {
   //----

   SetIndexBuffer(0, Buffer1);   SetIndexBuffer(1, Buffer2);   
   SetIndexBuffer(2, Buffer3);   SetIndexBuffer(3, Buffer4);


   for(int b=0; b<indicator_buffers; b++)  
      {  SetIndexStyle(b,DRAW_LINE); SetIndexDrawBegin (b,CCI2_period);
         }


   
   string name1 = " ("+CCI1_period+","+MA1_period+") ";
   string name2 = " ("+CCI2_period+","+MA2_period+") ";
   
   IndicatorShortName("cci smz  "+name1+name2);  

   SetIndexLabel(0,"cci1  "+name1);
   SetIndexLabel(1,"cci1 smz "+name1);

   SetIndexLabel(2,"cci2  "+name2);
   SetIndexLabel(3,"cci2 smz "+name2);

   //----
   return(0);
  }
//+------------------------------------------------------------------+

int deinit()
  {
    return(0);
  }
//+------------------------------------------------------------------+


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-1;


   for(i = limit; i >= 0; i--)
     {
     
      Buffer1[i]=iCCI(NULL,0,CCI1_period,CCI1_price,i);
      Buffer2[i]=iCCI(NULL,0,CCI2_period,CCI2_price,i);
     
     }


  for(i = limit; i >= 0; i--)
     {
     
      Buffer3[i]=iMAOnArray(Buffer1,0,MA1_period,0,MA1_mode, i);
      Buffer4[i]=iMAOnArray(Buffer2,0,MA2_period,0,MA2_mode, i);
     }




      
      
//----
   return(0);
  }
//+------------------------------------------------------------------+