//+------------------------------------------------------------------+
//|                                                   iMAOnArray.mq4 |
//|                                                      Coders Guru |
//|                                       http://www.metatrader.info |
//+------------------------------------------------------------------+

#property copyright "Coders Guru"
#property link      "http://www.metatrader.info"


#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 DarkBlue

double ExtMapBuffer1[];
double ExtMapBuffer2[];

int init()  
  {   
  IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,ExtMapBuffer1); 
  SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
  SetIndexBuffer(1,ExtMapBuffer2);
  
  return(0);
  }
 
int deinit() 
  {
  
  return(0);
  }  
  
int start() 
  {   
   int bar, limit;
   
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-IndicatorCounted();
   
   
   for(bar=0; bar<limit; bar++) 
      ExtMapBuffer1[bar] = iCCI(NULL,0,14,PRICE_TYPICAL,bar);
      
   for(bar=0; bar<limit; bar++)     
         ExtMapBuffer2[bar]=iMAOnArray(ExtMapBuffer1,Bars,14,0,MODE_EMA,bar);
        
   return(0);  
  }