EMA on CCI

To add comments, please log in or register
mql5saja
511
mql5saja  

Hi coding experts,

 

Please help to make an indi 'EMA on CCI' like the below picture...

mql5saja
511
mql5saja  

Hi coding experts,

 

Please help to make an indi 'EMA on CCI' like the below picture...

Files:
Mladen Rakic
110362
Mladen Rakic  
anton1:

Hi coding experts,

 

Please help to make an indi 'EMA on CCI' like the below picture...

Use this (attached it as a file too) :

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1  clrDarkGray
#property indicator_color2  clrOrangeRed
#property strict

extern int                CCIPeriod = 24;             // CCI period
extern ENUM_APPLIED_PRICE Price     = PRICE_TYPICAL;  // Price
extern int                EmaPeriod = 8;              // EMA period

double cci[],ema[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

int init()
{
   SetIndexBuffer(0,cci);
   SetIndexBuffer(1,ema);
   return(0);
}
int start()
{
   int counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);

   for(int i = limit; i >= 0; i--) cci[i] = iCCI(NULL,0,CCIPeriod,Price,i);
   for(int i = limit; i >= 0; i--) ema[i] = iMAOnArray(cci,0,EmaPeriod,0,MODE_EMA,i);
   return(0);
}



Files:
mql5saja
511
mql5saja  
mladen:

Use this (attached it as a file too) :

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1  clrDarkGray
#property indicator_color2  clrOrangeRed
#property strict

extern int                CCIPeriod = 24;             // CCI period
extern ENUM_APPLIED_PRICE Price     = PRICE_TYPICAL;  // Price
extern int                EmaPeriod = 8;              // EMA period

double cci[],ema[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//

int init()
{
   SetIndexBuffer(0,cci);
   SetIndexBuffer(1,ema);
   return(0);
}
int start()
{
   int counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);

   for(int i = limit; i >= 0; i--) cci[i] = iCCI(NULL,0,CCIPeriod,Price,i);
   for(int i = limit; i >= 0; i--) ema[i] = iMAOnArray(cci,0,EmaPeriod,0,MODE_EMA,i);
   return(0);
}



Hi mladen,

 

Thanks.

It works great.

 

Regards,

anton 

To add comments, please log in or register