Navigation:Home > Content >

boc2.mq4

Time: 2013-11-09 | Download file:boc2.mq4

#property copyright "Yury Orlov"
#property link      "http://www.binary-options-club.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Silver
#property indicator_color2 LightSkyBlue
#property indicator_color3 DodgerBlue
#property indicator_color4 Red

extern string t00 = "--- DEMA parameters ---";
extern bool Use_DEMA = TRUE;
extern bool Draw_DEMA = TRUE;
extern int DEMA_period = 100;
extern string t01 = "--- Parabolic R2 parameters ---";
extern bool Draw_R2 = TRUE;
extern double R2_step = 0.02;
extern double R2_AFmax = 0.2;
extern string t02 = "--- Signal Stochastic Parameters ---";
extern bool Use_Stoch = TRUE;
extern int Stoch_K = 12;
extern int Stoch_D = 2;
extern int Stoch_S = 3;
extern int Stoch_N = 12;
extern int LevelSell = 75;
extern int LevelBuy = -1;
extern string t03 = "--- Trading Session Parameters ---";
extern string Start = "08:00";
extern string End = "20:00";
extern string t04 = "--- Alerts Parameters ---";
extern bool alerts = TRUE;
double Gda_196[];
double Gda_200[];
double Gda_204[];
double Gda_208[];
double Gda_212[];
double Gda_216[];
double Gda_220[];
double Gda_224[];
double Gda_228[];
int Gia_232[];
int Gia_236[];
string Gs_240;
bool Gi_248;
int Gi_260 = 1;
double Gd_264;
double Gd_272;
double Gd_280;
int Gi_288;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   if (LevelBuy == -1) LevelBuy = 100 - LevelSell;
   int Li_0 = 12;
   if (Draw_DEMA) Li_0 = 0;
   SetIndexStyle(0, Li_0);
   SetIndexBuffer(0, Gda_196);
   SetIndexLabel(0, "DEMA");
   int Li_4 = 12;
   if (Draw_R2) Li_4 = 0;
   SetIndexStyle(1, Li_4);
   SetIndexBuffer(1, Gda_200);
   SetIndexLabel(1, "R2");
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, SYMBOL_ARROWUP);
   SetIndexBuffer(2, Gda_216);
   SetIndexEmptyValue(2, 0.0);
   SetIndexLabel(2, "Buy");
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, SYMBOL_ARROWDOWN);
   SetIndexBuffer(3, Gda_220);
   SetIndexEmptyValue(3, 0.0);
   SetIndexLabel(3, "Sell");
   int Li_8 = Period();
   switch (Li_8) {
   case 0:
      Gs_240 = "0_0";
      break;
   case PERIOD_M1:
      Gs_240 = "M 1";
      break;
   case PERIOD_M5:
      Gs_240 = "M 5";
      break;
   case PERIOD_M15:
      Gs_240 = "M 15";
      break;
   case PERIOD_M30:
      Gs_240 = "M 30";
      break;
   case PERIOD_H1:
      Gs_240 = "H 1";
      break;
   case PERIOD_H4:
      Gs_240 = "H 4";
      break;
   case PERIOD_D1:
      Gs_240 = "D 1";
      break;
   case PERIOD_W1:
      Gs_240 = "W 1";
      break;
   case PERIOD_MN1:
      Gs_240 = "MN";
      break;
   default:
      Gs_240 = "N_N";
   }
   return (0);
}
	  		    			 	 	 		 	 											  		  	    	  		 	   	  	 		 	 	    		  		 		 	 		  		 				 	  		   			  			 		    		 		   			    		 	 	        
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   Comment("");
   return (0);
}
					 	 	  	 				   	  	   			 	 				 					 	 		 	      	 			    		  	  	   					    	     	 		   	  	 			 		  				 				 		 		  					    		   	 	
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_4;
   bool Li_12;
   bool Li_16;
   bool Li_20;
   bool Li_24;
   if (AccountNumber() == AccountNumber()) {
      Comment("");
      f0_0();
      Li_4 = Bars - 1 - IndicatorCounted();
      for (int Li_8 = Bars - 2; Li_8 >= 0; Li_8--) {
         if (Li_8 == Bars - 2) {
            Gda_200[Li_8] = Low[Li_8] - 10.0 * Point;
            Gi_260 = 1;
            Gd_264 = R2_step;
            Gd_272 = High[Li_8];
            Gd_280 = Low[Li_8];
         } else {
            if (Close[Li_8] > Gd_272) {
               Gd_272 = Close[Li_8];
               if (Gi_260 == 1 && Gd_264 <= R2_AFmax - R2_step) Gd_264 += R2_step;
            }
            if (Close[Li_8] < Gd_280) {
               Gd_280 = Close[Li_8];
               if (Gi_260 == -1 && Gd_264 <= R2_AFmax - R2_step) Gd_264 += R2_step;
            }
            if (Gi_260 == 1) Gda_200[Li_8] = Gda_200[Li_8 + 1] + Gd_264 * (Gd_272 - (Gda_200[Li_8 + 1]));
            else Gda_200[Li_8] = Gda_200[Li_8 + 1] + Gd_264 * (Gd_280 - (Gda_200[Li_8 + 1]));
            if ((Gda_200[Li_8 + 1] < Close[Li_8 + 1] && Gda_200[Li_8] > Close[Li_8]) || (Gda_200[Li_8 + 1] > Close[Li_8 + 1] && Gda_200[Li_8] < Close[Li_8])) {
               Gd_264 = R2_step;
               if (Gi_260 == 1) Gda_200[Li_8] = Gd_272;
               else Gda_200[Li_8] = Gd_280;
               Gd_280 = Close[Li_8];
               Gd_272 = Close[Li_8];
               Gi_260 = -1 * Gi_260;
            }
         }
      }
      for (int Li_0 = Li_4; Li_0 >= 0; Li_0--) Gda_224[Li_0] = iMA(NULL, 0, DEMA_period, 0, MODE_EMA, PRICE_CLOSE, Li_0);
      for (Li_0 = Li_4; Li_0 >= 0; Li_0--) Gda_228[Li_0] = iMAOnArray(Gda_224, Bars, DEMA_period, 0, MODE_EMA, Li_0);
      for (Li_0 = Li_4; Li_0 >= 0; Li_0--) Gda_196[Li_0] = 2.0 * Gda_224[Li_0] - Gda_228[Li_0];
      for (Li_0 = Li_4; Li_0 >= 0; Li_0--) {
         Gda_208[Li_0] = EMPTY_VALUE;
         Gda_212[Li_0] = EMPTY_VALUE;
         Gda_204[Li_0] = iStochastic(NULL, 0, Stoch_K, Stoch_D, Stoch_S, MODE_SMA, 0, MODE_SIGNAL, Li_0);
         Gia_232[Li_0] = Gia_232[Li_0 + 1] + 1;
         Gia_236[Li_0] = Gia_236[Li_0 + 1] + 1;
         if (Gda_204[Li_0] < LevelBuy) Gia_232[Li_0] = 0;
         if (Gda_204[Li_0] > LevelSell) Gia_236[Li_0] = 0;
         if (Gia_232[Li_0] < Stoch_N) Gda_208[Li_0] = LevelBuy;
         if (Gia_236[Li_0] < Stoch_N) Gda_212[Li_0] = LevelSell;
      }
      for (Li_0 = Li_4; Li_0 >= 0; Li_0--) {
         if ((Period() <= PERIOD_M15 && Time[Li_0] >= StrToTime(StringConcatenate(TimeToStr(Time[Li_0], TIME_DATE), " ", Start)) && Time[Li_0] < StrToTime(StringConcatenate(TimeToStr(Time[Li_0],
            TIME_DATE), " ", End))) || Period() > PERIOD_M15) {
            if (Use_DEMA) {
               if (Close[Li_0] > Gda_196[Li_0]) Li_12 = TRUE;
               else Li_12 = FALSE;
            } else Li_12 = TRUE;
            if (Use_Stoch) {
               if (Gda_208[Li_0] == LevelBuy) Li_20 = TRUE;
               else Li_20 = FALSE;
            } else Li_20 = TRUE;
            if (Gda_200[Li_0] < Close[Li_0] && Gda_200[Li_0 + 1] > Close[Li_0 + 1] && Li_12 && Li_20) {
               Gda_216[Li_0] = Gda_200[Li_0] - 0.2 * (Gda_200[Li_0 + 1] - Gda_200[Li_0]);
               if (alerts && Gi_248 && Li_0 == 0) {
                  Alert("BUY ", Symbol(), ", ", Gs_240, ", ", TimeToStr(Time[Li_0], TIME_MINUTES), ", ", TimeToStr(Time[Li_0], TIME_DATE));
                  Gi_248 = FALSE;
               }
            }
            if (Gda_200[Li_0] > Close[Li_0]) Gda_216[Li_0] = 0;
            if (Use_DEMA) {
               if (Close[Li_0] < Gda_196[Li_0]) Li_16 = TRUE;
               else Li_16 = FALSE;
            } else Li_16 = TRUE;
            if (Use_Stoch) {
               if (Gda_212[Li_0] == LevelSell) Li_24 = TRUE;
               else Li_24 = FALSE;
            } else Li_24 = TRUE;
            if (Gda_200[Li_0] > Close[Li_0] && Gda_200[Li_0 + 1] < Close[Li_0 + 1] && Li_16 && Li_24) {
               Gda_220[Li_0] = Gda_200[Li_0] + 0.2 * (Gda_200[Li_0] - (Gda_200[Li_0 + 1]));
               if (alerts && Gi_248 && Li_0 == 0) {
                  Alert("SELL ", Symbol(), ", ", Gs_240, ", ", TimeToStr(Time[Li_0], TIME_MINUTES), ", ", TimeToStr(Time[Li_0], TIME_DATE));
                  Gi_248 = FALSE;
               }
            }
            if (Gda_200[Li_0] < Close[Li_0]) Gda_220[Li_0] = 0;
         }
      }
      return (0);
   }
   Comment("System is not licensed for using in this account!");
   return (-1);
}
	  			  				   				 				 				 		   			 		   		 	  	  		 		 				       	 			 	  				   	  			     	    			 							   	  	    	 	 	  				      	  	
// D03DE8A40B9265C2EB15A31066B767E5
void f0_0() {
   if (Gi_288 != Bars) {
      Gi_288 = Bars;
      Gi_248 = TRUE;
      ArraySetAsSeries(Gia_232, FALSE);
      ArrayResize(Gia_232, Gi_288);
      ArraySetAsSeries(Gia_232, TRUE);
      ArraySetAsSeries(Gia_236, FALSE);
      ArrayResize(Gia_236, Gi_288);
      ArraySetAsSeries(Gia_236, TRUE);
      ArraySetAsSeries(Gda_224, FALSE);
      ArrayResize(Gda_224, Gi_288);
      ArraySetAsSeries(Gda_224, TRUE);
      ArraySetAsSeries(Gda_228, FALSE);
      ArrayResize(Gda_228, Gi_288);
      ArraySetAsSeries(Gda_228, TRUE);
      ArraySetAsSeries(Gda_204, FALSE);
      ArrayResize(Gda_204, Gi_288);
      ArraySetAsSeries(Gda_204, TRUE);
      ArraySetAsSeries(Gda_212, FALSE);
      ArrayResize(Gda_212, Gi_288);
      ArraySetAsSeries(Gda_212, TRUE);
      ArraySetAsSeries(Gda_208, FALSE);
      ArrayResize(Gda_208, Gi_288);
      ArraySetAsSeries(Gda_208, TRUE);
      return;
   }
}

Recommend