//+------------------------------------------------------------------+
//|                                              Key to the mint.mq4 |
//|                                                   free84@aol.com |
//+------------------------------------------------------------------+

#property link "free84@aol.com"

#property indicator_chart_window

extern int EMA=5;
extern int EMA2=8;
extern int RSIv=13;
extern int CCIv=50;
double dTemp[3,2];

int init()
	{
		ObjectCreate("Dot1",OBJ_LABEL,0,0,0);
		ObjectSet("Dot1",OBJPROP_XDISTANCE,2);
		ObjectSet("Dot1",OBJPROP_YDISTANCE,20);
		ObjectSetText("Dot1","D1",8,"Arial Black",EMPTY_VALUE);
		
		ObjectCreate("Dot2",OBJ_LABEL,0,0,0);
		ObjectSet("Dot2",OBJPROP_XDISTANCE,22);
		ObjectSet("Dot2",OBJPROP_YDISTANCE,20);
		ObjectSetText("Dot2","H4",8,"Arial Black",EMPTY_VALUE);
		
		ObjectCreate("Dot3",OBJ_LABEL,0,0,0);
		ObjectSet("Dot3",OBJPROP_XDISTANCE,42);
		ObjectSet("Dot3",OBJPROP_YDISTANCE,20);
		ObjectSetText("Dot3","H1",8,"Arial Black",EMPTY_VALUE);
		
		ObjectCreate("Dot4",OBJ_LABEL,0,0,0);
		ObjectSet("Dot4",OBJPROP_XDISTANCE,62);
		ObjectSet("Dot4",OBJPROP_YDISTANCE,20);
		ObjectSetText("Dot4","M30",8,"Arial Black",EMPTY_VALUE);
		
		ObjectCreate("Dot5",OBJ_LABEL,0,0,0);
		ObjectSet("Dot5",OBJPROP_XDISTANCE,92);
		ObjectSet("Dot5",OBJPROP_YDISTANCE,20);
		ObjectSetText("Dot5","M15",8,"Arial Black",EMPTY_VALUE);
		
	}

int deinit()
	{
		ObjectDelete("Dot1");
		ObjectDelete("Dot2");
		ObjectDelete("Dot3");
		ObjectDelete("Dot4");
		ObjectDelete("Dot5");
		
	}

int start()

	{
	 bool D1=true;
    bool H4=true;
    bool H1=true;
    bool M30=true;
    bool M15=true;
		double RSIa, RSIb, CCIa,CCIb;
		int iIndicatorCounted=IndicatorCounted();
		if(iIndicatorCounted<0)
			{
				return(-1);
			}
		int iLimit=Bars-iIndicatorCounted;
		for(int i=iLimit;i>=0;i--)
			{
			if(M15)
					{
						dTemp[2,1]=iMA(NULL,PERIOD_M15,EMA2,0,MODE_EMA,PRICE_OPEN,i);
						dTemp[2,0]=iMA(NULL,PERIOD_M15,EMA,0,MODE_EMA,PRICE_CLOSE,i );
						RSIa = iRSI(NULL, 15, RSIv, PRICE_CLOSE, i );
						CCIa = iCCI(NULL, 15, CCIv, PRICE_CLOSE, i );
						if(dTemp[2,0]>dTemp[2,1] && RSIa > 50 && CCIa>50)
							{
								ObjectSet("Dot5",OBJPROP_COLOR,Lime);
							}
						else if(dTemp[2,0]<dTemp[2,1] && RSIa < 50&& CCIa<50)
							{
								ObjectSet("Dot5",OBJPROP_COLOR,Red);
							}
						else
							{
								ObjectSet("Dot5",OBJPROP_COLOR,DimGray);
							}
					}
			if(M30)
					{
						dTemp[3,1]=iMA(NULL,PERIOD_M30,EMA2,0,MODE_EMA,PRICE_OPEN,i);
						dTemp[3,0]=iMA(NULL,PERIOD_M30,EMA,0,MODE_EMA,PRICE_CLOSE,i );
						RSIa = iRSI(NULL, 30, RSIv, PRICE_CLOSE, i );
						CCIa = iCCI(NULL, 30, CCIv, PRICE_CLOSE, i );
						if(dTemp[3,0]>dTemp[3,1] && RSIa > 50 && CCIa>50)
							{
								ObjectSet("Dot4",OBJPROP_COLOR,Lime);
							}
						else if(dTemp[0,0]<dTemp[0,1] && RSIa < 50&& CCIa<50)
							{
								ObjectSet("Dot4",OBJPROP_COLOR,Red);
							}
						else
							{
								ObjectSet("Dot4",OBJPROP_COLOR,DimGray);
							}
					}
			if(H1)
					{
						dTemp[4,1]=iMA(NULL,PERIOD_H1,EMA2,0,MODE_EMA,PRICE_OPEN,i);
						dTemp[4,0]=iMA(NULL,PERIOD_H1,EMA,0,MODE_EMA,PRICE_CLOSE,i );
						RSIa = iRSI(NULL, 60, RSIv, PRICE_CLOSE, i );
						CCIa = iCCI(NULL, 60, CCIv, PRICE_CLOSE, i );
						if(dTemp[4,0]>dTemp[4,1] && RSIa > 50 && CCIa>50)
							{
								ObjectSet("Dot3",OBJPROP_COLOR,Lime);
							}
						else if(dTemp[4,0]<dTemp[4,1] && RSIa < 50&& CCIa<50)
							{
								ObjectSet("Dot3",OBJPROP_COLOR,Red);
							}
						else
							{
								ObjectSet("Dot3",OBJPROP_COLOR,DimGray);
							}
					}
				if(H4)
					{
						dTemp[0,1]=iMA(NULL,PERIOD_H4,EMA2,0,MODE_EMA,PRICE_OPEN,i);
						dTemp[0,0]=iMA(NULL,PERIOD_H4,EMA,0,MODE_EMA,PRICE_CLOSE,i );
						RSIa = iRSI(NULL, 240, RSIv, PRICE_CLOSE, i );
						CCIa = iCCI(NULL, 240, CCIv, PRICE_CLOSE, i );
						if(dTemp[0,0]>dTemp[0,1] && RSIa > 50 && CCIa>50)
							{
								ObjectSet("Dot2",OBJPROP_COLOR,Lime);
							}
						else if(dTemp[0,0]<dTemp[0,1] && RSIa < 50&& CCIa<50)
							{
								ObjectSet("Dot2",OBJPROP_COLOR,Red);
							}
						else
							{
								ObjectSet("Dot2",OBJPROP_COLOR,DimGray);
							}
					}
				if(D1)
					{
						dTemp[1,1]=iMA(NULL,PERIOD_D1,EMA2,0,MODE_EMA,PRICE_OPEN,i );
						dTemp[1,0]=iMA(NULL,PERIOD_D1,EMA,0,MODE_EMA,PRICE_CLOSE,i );
						RSIb = iRSI(NULL, 1440, RSIv, PRICE_CLOSE, i);
						CCIb = iCCI(NULL, 1440, CCIv, PRICE_CLOSE, i );
						
						if(dTemp[1,0]>dTemp[1,1] && RSIb > 50&& CCIb>50)
							{
								ObjectSet("Dot1",OBJPROP_COLOR,Lime);
							}
						else if(dTemp[1,0]<dTemp[1,1] && RSIb < 50&& CCIb<50)
							{
								ObjectSet("Dot1",OBJPROP_COLOR,Red);
							}
						else
							{
								ObjectSet("Dot1",OBJPROP_COLOR,DimGray);
							}
					}
				
			}
	}