Navigation´╝ÜHome > Content >

OCO_EA.mq4

Time: 2010-04-01 | Download file:OCO_EA.mq4

/*
   G e n e r a t e d  by ex4-to-mq4 decompiler 4.0.500.4
   E-mail : p URE B e a [email protected] g M A i l. COM
*/
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//#include 
#import "stdlib.ex4"
   string ErrorDescription(int a0); // DA69CBAFF4D38B87377667EEC549DE5A
#import

extern string Title = "**OCO_EA -- Order1**";
extern string Symbol1 = "EURUSD";
extern double Amount1 = 0.1;
extern string OrderType1 = "Buy";
extern double StopLoss1 = 10.0;
extern double TakeProfit1 = 21.0;
extern double Rate1 = 1.32824;
extern string separator = "**OCO_EA -- Order2**";
extern string Symbol2 = "EURUSD";
extern double Amount2 = 0.2;
extern string OrderType2 = "Sell";
extern double StopLoss2 = 10.0;
extern double TakeProfit2 = 20.0;
extern double Rate2 = 1.32803;
extern int magic_number = 1;
int G_ticket_192 = -1;
int G_ticket_196 = -1;
int Gi_unused_200 = 0;
int Gi_unused_204 = 0;
int Gi_unused_208 = 0;
double G_price_212;
double G_price_220;
int G_cmd_228;
int Gi_232 = 1;
int G_cmd_236;
int G_cmd_240;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   int error_0;
   Symbol1 = f0_1(Symbol1);
   Symbol2 = f0_1(Symbol2);
   OrderType1 = f0_1(OrderType1);
   OrderType2 = f0_1(OrderType2);
   if (OrderType1 == "BUY") {
      if (StopLoss1 != 0.0) G_price_212 = Rate1 - 10.0 * (StopLoss1 * Point);
      else G_price_212 = 0;
      RefreshRates();
      if (TakeProfit1 != 0.0) G_price_220 = Rate1 + 10.0 * (TakeProfit1 * Point);
      else G_price_220 = 0;
      Gi_232 = 1;
      if (Digits == 5 || Digits == 3) Gi_232 = 10;
      G_price_212 = NormalizeDouble(G_price_212, Gi_232);
      G_price_220 = NormalizeDouble(G_price_220, Gi_232);
      G_ticket_192 = OrderSend(Symbol1, f0_0(Symbol1, 0, Rate1), Amount1, Rate1, 0, G_price_212, G_price_220, "PSS_Order1", magic_number, 0);
   } else {
      if (OrderType1 == "SELL") {
         RefreshRates();
         if (StopLoss1 != 0.0) G_price_212 = Rate1 + 10.0 * (StopLoss1 * Point);
         else G_price_212 = 0;
         if (TakeProfit1 != 0.0) G_price_220 = Rate1 - 10.0 * (TakeProfit1 * Point);
         else G_price_220 = 0;
         G_ticket_192 = OrderSend(Symbol1, f0_0(Symbol1, 1, Rate1), Amount1, Rate1, 0, G_price_212, G_price_220, "PSS_Order1", magic_number, 0, Red);
      } else {
         Print("Error, enter either buy or sell.");
         return;
      }
   }
   if (G_ticket_192 < 1) {
      error_0 = GetLastError();
      Print("Error ", error_0, " in ticket 1 = ", ErrorDescription(error_0));
      return;
   }
   if (OrderType2 == "SELL") {
      RefreshRates();
      if (StopLoss2 != 0.0) G_price_212 = Rate2 + 10.0 * (StopLoss2 * Point);
      else G_price_212 = 0;
      if (TakeProfit2 != 0.0) G_price_220 = Rate2 - 10.0 * (TakeProfit2 * Point);
      else G_price_220 = 0;
      RefreshRates();
      Gi_232 = 1;
      if (Digits == 5 || Digits == 3) Gi_232 = 10;
      G_price_212 = NormalizeDouble(G_price_212, Gi_232);
      G_price_220 = NormalizeDouble(G_price_220, Gi_232);
      G_ticket_196 = OrderSend(Symbol2, f0_0(Symbol2, 1, Rate2), Amount2, Rate2, 0, G_price_212, G_price_220, "PSS_Order2", magic_number, 0);
   } else {
      if (OrderType2 == "BUY") {
         RefreshRates();
         if (StopLoss2 != 0.0) G_price_212 = Rate2 - 10.0 * (StopLoss2 * Point);
         else G_price_212 = 0;
         if (TakeProfit2 != 0.0) G_price_220 = Rate2 + 10.0 * (TakeProfit2 * Point);
         else G_price_220 = 0;
         G_price_212 = NormalizeDouble(G_price_212, Gi_232);
         G_price_220 = NormalizeDouble(G_price_220, Gi_232);
         G_ticket_196 = OrderSend(Symbol2, f0_0(Symbol2, 0, Rate2), Amount2, Rate2, 0, G_price_212, G_price_220, "PSS_Order2", magic_number, 0);
      } else {
         Print("Error, enter either buy or sell.");
         return;
      }
   }
   if (G_ticket_196 < 1) {
      error_0 = GetLastError();
      Print("Error ", error_0, "in ticket2= ", ErrorDescription(error_0));
      return;
   }
   OrderSelect(G_ticket_192, SELECT_BY_TICKET);
   G_cmd_236 = OrderType();
   OrderSelect(G_ticket_196, SELECT_BY_TICKET);
   G_cmd_240 = OrderType();
   return (0);
}
	     		 		 			   					  				  		 		  		 		 		 	   		 	  	 	 	  				     			   	 	 		     						 									    			  	 	       	 	     		   				 		
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int error_0;
   if (G_cmd_240 >= OP_BUY && OrderSelect(G_ticket_192, SELECT_BY_TICKET) == TRUE) {
      G_cmd_228 = OrderType();
      if (G_cmd_228 == OP_SELL || G_cmd_228 == OP_BUY) {
         if (OrderDelete(G_ticket_196)) {
            G_cmd_240 = -1;
            OrderPrint();
         } else {
            error_0 = GetLastError();
            Print("Error ", error_0, ": ", ErrorDescription(error_0));
            return (0);
         }
      }
   }
   if (G_cmd_236 >= OP_BUY && OrderSelect(G_ticket_196, SELECT_BY_TICKET) == TRUE) {
      G_cmd_228 = OrderType();
      if (G_cmd_228 == OP_SELL || G_cmd_228 == OP_BUY) {
         if (OrderDelete(G_ticket_192)) {
            G_cmd_236 = -1;
            OrderPrint();
         } else {
            error_0 = GetLastError();
            Print("Error ", error_0, ": ", ErrorDescription(error_0));
            return (0);
         }
      }
   }
   return (0);
}
	 		 	   	 		  	    	  	 	  			 	    	   	 		 	   	 		 	 		   				   			 	   		  		 				    	    	  	   				 	  	 	   		  		  	   		   	    	 	 	
// 096D9CA2ABE17BC13465AAD5532E7C84
int f0_0(string A_symbol_0, int Ai_8, double Ad_12) {
   int Li_ret_20;
   double ask_24;
   double bid_32;
   RefreshRates();
   if (Ai_8 == 0) {
      ask_24 = MarketInfo(A_symbol_0, MODE_ASK);
      if (Ad_12 <= ask_24) return (2);
      Li_ret_20 = 4;
      return (Li_ret_20);
      return (2);
   }
   if (Ai_8 == 1) {
      bid_32 = MarketInfo(A_symbol_0, MODE_BID);
      if (Ad_12 < bid_32) return (5);
      return (3);
   }
   Alert("ERROR. Enter correct order direction.");
   return (0);
}
	    						 	 	 	 			 	 						 	  		 						 	  		  				 		 	     			 	  				 	 			 			  	 			 							 		 	   			   	    	      		     	 	 			  	 
// 53B6F4E741F7564BAA1E1EB3737A6B84
string f0_1(string As_0) {
   int Li_16;
   int str_len_8 = StringLen(As_0);
   for (int Li_12 = 0; Li_12 < str_len_8; Li_12++) {
      Li_16 = StringGetChar(As_0, Li_12);
      if (Li_16 >= 'a' && Li_16 <= 'z') As_0 = StringSetChar(As_0, Li_12, Li_16 - 32);
   }
   return (As_0);
}
				    	  			 			  		 		   	 	  	      	  				 			 	  		 	  			      			     	 	 	 	 				  		  	   		    		     		  							 		 				 	 			  			  
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}

Recommend