//+------------------------------------------------------------------+
//|                                                            CCI   |
//|  cci of ma                                                       |
//+------------------------------------------------------------------+
//2009fxtsd    ki  

#property copyright "Copyright © 2005, Metaquotes"
#property link      "mailto:metaquotes@metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1

#property indicator_color1 Red

#property indicator_level1      100
#property indicator_level2     -100
#property indicator_levelcolor SlateGray

//---- 




extern int      CCI_period   =14;

extern int      CCI_price=5;

extern int MaPeriod     = 3;
extern int MaMetod      = 1;
extern int MaPrice      = 5;



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

//---- 
double Buffer1[];
double  MA_Buffer []; 
double  CCI_Buffer []; 


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

int init()
  {
   IndicatorBuffers(2);

//--

   SetIndexStyle(0, DRAW_LINE);

   SetIndexBuffer(0, Buffer1);
   SetIndexBuffer(1, MA_Buffer);

   SetIndexDrawBegin(0, CCI_period);

   string shortnme;
   shortnme = "("+MaPeriod+","+CCI_period+") ";
   
   IndicatorShortName(" cci of ma "+shortnme);  

   SetIndexLabel(0,"cci "+shortnme);

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



   for(i=limit; i>=0; i--)
     
      MA_Buffer [i] = iMA(NULL,0,MaPeriod,0,MaMetod,MaPrice,i);
      
      
     
   for(i=limit; i>=0; i--)
   
    Buffer1[i]= iCCIOnArray( MA_Buffer,0,CCI_period,i);
     




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



