//+------------------------------------------------------------------+
//|                                                      RSICCI.mq4  |
//|                                                                  |
//+------------------------------------------------------------------+
//------------------------------------------------------------------
#property  copyright "blonde"
#property  link      "www.forex-station.com"
//------------------------------------------------------------------

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  clrDeepSkyBlue
#property indicator_width1  2

//
//
//
//
//

extern int    RSIPeriod  = 14; 
extern int    CCIPeriod  = 14;

//
//
//
//
//

double CCI[];

double rsi[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   IndicatorBuffers(6);
	SetIndexBuffer(0, CCI); SetIndexLabel(0,"CCI");  
   SetIndexBuffer(1, rsi);
   IndicatorShortName("RSICCI(" + RSIPeriod+ "," + CCIPeriod+")");
   return(0);
}
int deinit() { return(0); }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//

int start()
{
   int counted_bars=IndicatorCounted();
   int i,limit;

   if (counted_bars<0) return(-1);
   if (counted_bars>0) counted_bars--;
          limit = MathMin(Bars-counted_bars,Bars-1);

   //
   //
   //
   //
   //
   
   for (i=limit; i>=0; i--)
   {		
		rsi[i]=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i);		
	}
   for (i=limit; i>=0; i--) CCI[i] = iCCIOnArray(rsi,0,CCIPeriod,i);
   
   //
   //
   //
   //
   //
   
   return(0);
}