Navigation´╝ÜHome > Content >

Vergil_Day_Trader_V1.1_edu.mq4

Time: 2016-08-10 | Download file:Vergil_Day_Trader_V1.1_edu.mq4

//=============================================================================================
//Decompiled & Modified by lptuyen at www.forexisbiz.com (FIB Forum)
//Profile: http://www.forexisbiz.com/member.php/11057-lptuyen?tab=aboutme#aboutme
//Email: Lptuyen_fx@yahoo.com
//Another forum: lptuyen at WWI
//Profile: http://worldwide-invest.org/members/48543-lptuyen?tab=aboutme#aboutme
//=============================================================================================

#property copyright "Vergil_DayTrader_V1" // Vergil_DayTrader1.1 or VDT_1.1 timeframe M1 
#property link      "TLP"
                               //Currency Pairs: EURUSD, AUDUSD, GBPUSD, USDJPY, USDCAD, USDCHF
                               //Best Currency Pairs: EURUSD, GBPUSD, USDJPY
                               //Drag and drop to EURUSD 1M chart.

extern string INFORMATION_1 = "+++ Risk Management +++";
extern double LotSize = 0.1;
extern double Risk = 10.0;
extern double Max_Spread = 5.0;
extern string INFORMATION_3 = "+++ Stoploss & TakeProfit +++";
extern int TakeProfit = 50;
extern int StopLoss = 30;
extern string INFORMATION_4 = "+++ Magic Number +++";
extern int MagicNumber = 7;
int G_magic_136 = 8;
int G_period_140 = 55;
int Gi_144 = 5;
bool Gi_148 = TRUE;
int Gi_152 = 14;
int Gi_156 = 15;
int Gi_160 = 5;
int G_period_164 = 55;
int G_period_168 = 18;
double G_pips_172 = 5.0;
double Gd_180 = 1.0;
int Gi_188 = 90;
bool Gi_192 = TRUE;
double G_pips_196 = 0.0;
int Gi_204 = 0;
bool Gi_208 = TRUE;
bool Gi_212 = TRUE;
bool Gi_216 = TRUE;
int Gi_220 = 39;
int Gi_224 = 1;
int Gi_228 = 5;
int Gi_232 = 6;
bool Gi_236 = FALSE;
bool Gi_unused_240 = FALSE;
double G_pips_244 = 2.0;
double G_pips_252 = 2.0;
double G_pips_260 = 10.0;
bool Gi_268 = FALSE;
double G_order_lots_272 = 0.1;
double Gd_280 = 1.0;
double Gd_288 = 100.0;
double Gd_296 = 50.0;
int Gi_304 = 50;
double Gd_308 = 25.0;
double Gd_316 = 0.0;
double Gd_324 = 25.0;
double Gd_332 = 2.0;
int G_period_340 = 18;
int G_period_344 = 14;
int G_period_348 = 11;
int Gi_352 = 18;
int Gi_356 = 39;
int Gi_360 = 1;
int G_period_364 = 14;
int G_period_368 = 11;
int Gi_372 = 15;
double Gd_376 = 150.0;
int Gi_384 = 14;
int Gi_388 = 1;
double Gd_392 = 2.0;
int G_timeframe_400 = PERIOD_M5;
double Gd_404 = 10.0;
bool Gi_412 = FALSE;
bool Gi_416 = FALSE;
bool Gi_420 = FALSE;
bool Gi_424 = FALSE;
bool Gi_428 = FALSE;
double Gd_432 = 14.0;
double Gd_440 = 1.0;
double Gd_448 = 5.0;
double Gd_456 = 1.0;
double Gd_464 = 0.0;
double Gd_472 = 6.0;
int Gi_unused_480 = 55295;
int Gi_unused_484 = 65280;
double Gd_488;
int Gi_496;
int Gi_unused_500 = 0;
int Gi_504;
double Gd_508;
string Gs_516;
double Gd_524 = 3.0;
int G_slippage_532;
int G_slippage_536;
int Gi_540 = 1;
double Gd_544;
bool Gi_552;
string G_comment_556 = "VDT_v1";
int Gi_564 = 0;
double G_minlot_568 = 0.01;
double G_maxlot_576 = 0.01;
double G_lotstep_584 = 0.01;
int Gi_592 = 100000;
double G_marginrequired_596 = 1000.0;
double Gd_604 = 1.0;
double Gd_612;
int Gi_620;
int Gi_624;
int Gi_628;
int Gi_632;
int Gi_636;
int Gi_640;
int G_color_644 = Green;
int G_color_648 = Red;
int G_color_652 = DodgerBlue;
int G_color_656 = DeepPink;
string Gs_unused_660 = "+++ Notifications +++";
bool Gi_668 = FALSE;
string Gs_672 = "alert.wav";
string Gs_unused_680 = "alert.wav";
int Gi_688 = 1;
bool Gi_692 = FALSE;

// E37F0136AA3FFAF149B351F6A4C948E9
void init() {
   if (IsTesting() && (!IsVisualMode())) Gi_424 = FALSE;
   if (!Gi_424) Comment("");
   Gs_516 = Symbol();
   if (Digits < 4) {
      Gd_488 = 0.01;
      Gi_496 = 2;
      Gd_508 = 0.009;
   } else {
      Gd_488 = 0.0001;
      Gi_496 = 4;
      Gd_508 = 0.00009;
   }
   if (Digits == 4) Gi_504 = 1;
   if (Digits == 5) Gi_504 = 10;
   if (Digits == 3) Gi_504 = Gd_404;
   if (Digits == 2) Gi_504 = Gd_404 / 10.0;
   G_slippage_532 = Gd_392 * MathPow(10, Digits - Gi_496);
   G_slippage_536 = Gd_524 * MathPow(10, Digits - Gi_496);
   Gd_544 = NormalizeDouble(Max_Spread * Gd_488, Gi_496 + 1);
   G_minlot_568 = MarketInfo(Symbol(), MODE_MINLOT);
   G_maxlot_576 = MarketInfo(Symbol(), MODE_MAXLOT);
   if (G_maxlot_576 > Gd_288) G_maxlot_576 = Gd_288;
   Gi_592 = MarketInfo(Symbol(), MODE_LOTSIZE);
   G_lotstep_584 = MarketInfo(Symbol(), MODE_LOTSTEP);
   G_marginrequired_596 = MarketInfo(Symbol(), MODE_MARGINREQUIRED);
   double bid_0 = 0;
   if (StringSubstr(AccountCurrency(), 0, 3) == "EUR") {
      bid_0 = MarketInfo("EURUSD" + StringSubstr(Symbol(), 6), MODE_BID);
      if (bid_0 > 0.1) Gd_604 = 1 / bid_0;
      else Gd_604 = 0.7042253521;
   }
   Gi_620 = Gi_360;
   Gi_624 = Gi_160;
   Gi_628 = 100 - Gi_224;
   Gi_632 = 100 - Gi_228;
   Gi_636 = Gi_188;
   Gi_640 = 100 - Gi_188;
}
	 	  			 	  	 	  	        	 		   	 		  	  	  	 	 	  			   		   		 							       		 		 	 		 	 		 				  		  		 		 				  			 		  	  	     					 		  
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   return (0);
}
		 	 		 	 			 			 		   			 			 		 	 	   		 	 	  	 								       	  			  			   	  	 	 		  	  			      	 		   			      	  	    			 		         				
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   bool Li_0 = FALSE;
   if (Hour() >= Gd_464 && Hour() < Gd_472 && Gd_464 > 0.0) Li_0 = TRUE;
   if (DayOfWeek() >= Gd_448 && Hour() >= Gd_432 && Gi_428 == TRUE) Li_0 = TRUE;
   if (DayOfWeek() <= Gd_456 && Hour() <= Gd_440 && Gi_428 == TRUE) Li_0 = TRUE;
   if (Li_0 == TRUE) {
      ObjectCreate("P", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSet("P", OBJPROP_CORNER, 2);
      ObjectSet("P", OBJPROP_YDISTANCE, 75);
      ObjectSet("P", OBJPROP_XDISTANCE, 10);
      ObjectSetText("P", "", 50, "Tahoma", Red);
   }
   if (Li_0 == FALSE) ObjectDelete("P");
   f0_5();
   f0_2();
   if (G_pips_172 > 0.0) f0_12(Li_0);
   if (Ask - Bid > Max_Spread * Point * Gi_504) {
      ObjectCreate("Spread", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSet("Spread", OBJPROP_CORNER, 2);
      ObjectSet("Spread", OBJPROP_YDISTANCE, 45);
      ObjectSet("Spread", OBJPROP_XDISTANCE, 10);
      ObjectSetText("Spread", "Spread ! " + DoubleToStr((Ask - Bid) / Point, 0), 50, "Tahoma", Red);
   }
   if (Ask - Bid < Max_Spread * Point * Gi_504) ObjectDelete("Spread");
   if (Gi_144 > 0 && iVolume(Symbol(), PERIOD_M1, 0) > Gi_144) return (0);
   if (Gd_280 > 0.0 && (!Gi_268)) Gd_612 = MathMax(G_minlot_568, MathMin(G_maxlot_576, MathCeil(MathMin(Gd_296, Gd_280) * Risk / 100.0 * AccountFreeMargin() / G_lotstep_584 / (Gi_592 / 100)) * G_lotstep_584));
   if (Gd_280 > 0.0 && Gi_268) Gd_612 = f0_3();
   if (Gd_280 == 0.0) Gd_612 = G_order_lots_272;
   if (DayOfWeek() == 1 && iVolume(NULL, PERIOD_D1, 0) < 5.0) return (0);
   if (StringLen(Gs_516) < 6) return (0);
   if ((!IsTesting()) && IsStopped()) return (0);
   if ((!IsTesting()) && !IsTradeAllowed()) return (0);
   if ((!IsTesting()) && IsTradeContextBusy()) return (0);
   HideTestIndicators(FALSE);
   if (Li_0 == FALSE) f0_7();
   return (0);
}
	 	 	    	   	 	 	  				  	   		 	 	 		   	 	 	  	     	  					 	 		    	   						 	 	 			 		  							    			  							  	 				 	 	  			 					  	 
// 6ABA3523C7A75AAEA41CC0DEC7953CC5
void f0_7() {
   if (f0_8() != 0) {
      if ((!Gi_552) && Gi_420) Print("", DoubleToStr((Ask - Bid) / Gd_488, 1), ",  Max_Spread = ", DoubleToStr(Max_Spread, 1));
      Gi_552 = TRUE;
      return;
   }
   Gi_552 = FALSE;
   if (f0_13() && f0_11() && Gi_212) f0_0(OP_BUY);
   if (f0_6() && f0_11() && Gi_216) f0_0(OP_SELL);
}
		 	   		 				  	 		 		 		 		 	 	 	 						 	  			 			   		   			 	  	  	 			 		   	 		    	          	 			           	 	 	   	  	 		 			        	
// 09CBB5F5CE12C31A043D5C81BF20AA4A
int f0_0(int A_cmd_0) {
   int Li_4;
   double order_open_price_8;
   color color_16;
   int ticket_20;
   int error_24;
   string Ls_28;
   double order_open_price_36;
   double Ld_44;
   double Ld_52;
   int Li_unused_60 = 0;
   int Li_unused_64 = 0;
   int Li_unused_68 = 0;
   int Li_unused_72 = 0;
   int Li_unused_76 = 0;
   int Li_unused_80 = 0;
   for (int pos_84 = OrdersTotal() - 1; pos_84 >= 0; pos_84--) {
      if (OrderSelect(pos_84, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol()) {
         if (OrderType() == OP_BUYLIMIT && OrderMagicNumber() == MagicNumber) Li_unused_60 = 1;
         if (OrderType() == OP_SELLLIMIT && OrderMagicNumber() == MagicNumber) Li_unused_64 = 1;
         if (OrderType() == OP_SELLSTOP && OrderMagicNumber() == MagicNumber) Li_unused_72 = 1;
         if (OrderType() == OP_BUYSTOP && OrderMagicNumber() == MagicNumber) Li_unused_68 = 1;
      }
   }
   bool Li_88 = FALSE;
   bool Li_92 = FALSE;
   double Ld_96 = NormalizeDouble(TakeProfit * Gd_488, Gi_496);
   double Ld_104 = NormalizeDouble(StopLoss * Gd_488, Gi_496);
   if (Gi_564 > 0) {
      MathSrand(TimeLocal());
      Li_4 = MathRand() % Gi_564;
      if (Gi_416) Print("DelayRandomiser:  ", Li_4, " .");
      Sleep(1000 * Li_4);
   }
   double lots_112 = Gd_612;
   if (LotSize > 0.0) lots_112 = LotSize;
   if (AccountFreeMarginCheck(Gs_516, A_cmd_0, lots_112) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) {
      if (!Gi_420) return (-1);
      return (-1);
   }
   RefreshRates();
   if (A_cmd_0 == OP_BUY) {
      Li_88 = TRUE;
      order_open_price_36 = NormalizeDouble(Ask, Digits);
      color_16 = G_color_644;
      if (!Gi_148) {
         Ld_44 = NormalizeDouble(order_open_price_36 + Ld_96, Digits);
         Ld_52 = NormalizeDouble(order_open_price_36 - Ld_104, Digits);
      } else {
         Ld_44 = 0;
         Ld_52 = 0;
      }
   } else {
      Li_92 = TRUE;
      order_open_price_36 = NormalizeDouble(Bid, Digits);
      color_16 = G_color_648;
      if (!Gi_148) {
         Ld_44 = NormalizeDouble(order_open_price_36 - Ld_96, Digits);
         Ld_52 = NormalizeDouble(order_open_price_36 + Ld_104, Digits);
      } else {
         Ld_44 = 0;
         Ld_52 = 0;
      }
   }
   int Li_120 = Gi_540;
   while (Li_120 > 0 && f0_11()) {
      if (Gi_192 == TRUE && Li_88 == TRUE) OrderSend(Gs_516, OP_BUY, lots_112, NormalizeDouble(Ask, Digits), G_slippage_532, 0, 0, G_comment_556, MagicNumber, 0, color_16);
      if (Gi_192 == TRUE && Li_92 == TRUE) OrderSend(Gs_516, OP_SELL, lots_112, NormalizeDouble(Bid, Digits), G_slippage_532, 0, 0, G_comment_556, MagicNumber, 0, color_16);
      Sleep(MathRand() / 1000);
      if (ticket_20 < 0) {
         error_24 = GetLastError();
         if (Gi_420) {
            if (A_cmd_0 == OP_BUY) Ls_28 = "OP_BUY";
            else Ls_28 = "OP_SELL";
            Print("OrderSend(", Ls_28, ") = ", f0_1(error_24));
         }
         if (error_24 != 136/* OFF_QUOTES */) break;
         if (!(Gi_692)) break;
         Sleep(6000);
         RefreshRates();
         if (A_cmd_0 == OP_BUY) order_open_price_8 = NormalizeDouble(Ask, Digits);
         else order_open_price_8 = NormalizeDouble(Bid, Digits);
         if (NormalizeDouble(MathAbs((order_open_price_8 - order_open_price_36) / Gd_488), 0) > Gi_688) break;
         order_open_price_36 = order_open_price_8;
         Li_120--;
         if (Li_120 > 0)
            if (Gi_416) Print("");
      } else {
         if (OrderSelect(ticket_20, SELECT_BY_TICKET)) order_open_price_36 = OrderOpenPrice();
         if (!(Gi_668)) break;
         PlaySound(Gs_672);
         break;
      }
   }
   return (ticket_20);
}
			 		 	            	 	  		  		    	  		 		 				     	   				 						 	 			  	 	 	  	    	  			  	 			  	 					  	 			  						       	 			 				   
// 28EFB830D150E70A8BB0F12BAC76EF35
void f0_2() {
   bool bool_0;
   int error_4;
   int Li_8;
   string Ls_12;
   int Li_20 = OrdersTotal() - 1;
   for (int pos_24 = Li_20; pos_24 >= 0; pos_24--) {
      if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderType() == OP_BUY) {
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() == 0.0 && OrderTakeProfit() == 0.0) {
               bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() - StopLoss * Point * Gi_504, Digits), NormalizeDouble(OrderOpenPrice() + TakeProfit * Point * Gi_504,
                  Digits), 0, Blue);
            }
         }
         if (OrderType() == OP_SELL) {
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() == 0.0 && OrderTakeProfit() == 0.0) {
               bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() + StopLoss * Point * Gi_504, Digits), NormalizeDouble(OrderOpenPrice() - TakeProfit * Point * Gi_504,
                  Digits), 0, Blue);
            }
         }
         if (OrderType() == OP_BUY)
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() == 0.0 && OrderTakeProfit() != 0.0) bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() - 120.0 * Point * Gi_504, Digits), OrderTakeProfit(), 0, Blue);
         if (OrderType() == OP_SELL)
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() == 0.0 && OrderTakeProfit() != 0.0) bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() + 120.0 * Point * Gi_504, Digits), OrderTakeProfit(), 0, Blue);
         if (OrderType() == OP_BUY)
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() != 0.0 && OrderTakeProfit() == 0.0) bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(OrderOpenPrice() + 33.0 * Point * Gi_504, Digits), 0, Blue);
         if (OrderType() == OP_SELL)
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516 && OrderStopLoss() != 0.0 && OrderTakeProfit() == 0.0) bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(OrderOpenPrice() - 33.0 * Point * Gi_504, Digits), 0, Blue);
         if (OrderType() == OP_BUY) {
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516) {
               if (Bid - OrderOpenPrice() > Gi_156 * Gd_488 && MathAbs(OrderOpenPrice() + Gi_152 * Gd_488 - OrderStopLoss()) >= Point && NormalizeDouble(OrderOpenPrice() + Gi_152 * Gd_488,
                  Digits) - Point >= OrderStopLoss()) {
                  bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() + Gi_152 * Gd_488, Digits), OrderTakeProfit(), 0, Blue);
                  if (!bool_0) {
                     error_4 = GetLastError();
                     if (Gi_420) Print(" (", Ls_12, ",", Li_8, "). ", f0_1(error_4));
                  }
               }
            }
         }
         if (OrderType() == OP_SELL) {
            if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516) {
               if (OrderOpenPrice() - Ask > Gi_156 * Gd_488 && MathAbs(OrderOpenPrice() - Gi_152 * Gd_488 - OrderStopLoss()) >= Point && NormalizeDouble(OrderOpenPrice() - Gi_152 * Gd_488,
                  Digits) + Point <= OrderStopLoss()) {
                  bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() - Gi_152 * Gd_488, Digits), OrderTakeProfit(), 0, Red);
                  if (!bool_0) {
                     error_4 = GetLastError();
                     if (Gi_420) Print("(", Ls_12, ",", Li_8, ").  ", f0_1(error_4));
                  }
               }
            }
         }
         if (G_pips_244 > 1.0 && OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136) {
            if (OrderType() == OP_SELL && OrderOpenPrice() - Ask > G_pips_260 * Point * Gi_504) {
               if (G_pips_244 > 0.0 && G_pips_244 > 1.0) {
                  if (OrderOpenPrice() - Ask > G_pips_244 * Point * Gi_504)
                     if (OrderStopLoss() - Point * G_pips_252 * Gi_504 > Ask + Point * G_pips_244 * Gi_504 && Ask + Point * G_pips_244 * Gi_504 <= OrderStopLoss() - Point) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * G_pips_244 * Gi_504, OrderTakeProfit(), 0, CLR_NONE);
               }
            } else {
               if (OrderType() == OP_BUY && Bid - OrderOpenPrice() > G_pips_260 * Point * Gi_504) {
                  if (G_pips_244 > 0.0 && G_pips_244 > 1.0) {
                     if (Bid - OrderOpenPrice() > G_pips_244 * Point * Gi_504)
                        if (OrderStopLoss() + Point * G_pips_252 * Gi_504 < Bid - Point * G_pips_244 * Gi_504 && Bid - Point * G_pips_244 * Gi_504 >= OrderStopLoss() + Point) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * G_pips_244 * Gi_504, OrderTakeProfit(), 0, CLR_NONE);
                  }
               }
            }
         }
         if (G_pips_244 < 1.0 && OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136) {
            if (OrderType() == OP_SELL && G_pips_244 < 1.0) {
               if (G_pips_244 <= 0.0) continue;
               if (OrderOpenPrice() - Ask <= G_pips_260 * Point * Gi_504) continue;
               if (!((OrderStopLoss() - Point * G_pips_252 * Gi_504 > Ask + (OrderOpenPrice() - Ask) * G_pips_244 && Ask + (OrderOpenPrice() - Ask) * G_pips_244 <= OrderStopLoss() - Point))) continue;
               OrderModify(OrderTicket(), OrderOpenPrice(), Ask + (OrderOpenPrice() - Ask) * G_pips_244, OrderTakeProfit(), 0, CLR_NONE);
               continue;
            }
            if (OrderType() == OP_BUY) {
               if (G_pips_244 > 0.0 && G_pips_244 < 1.0) {
                  if (Bid - OrderOpenPrice() > G_pips_260 * Point * Gi_504) {
                     if (OrderStopLoss() + Point * G_pips_252 * Gi_504 < Bid - (Bid - OrderOpenPrice()) * G_pips_244 && Bid - (Bid - OrderOpenPrice()) * G_pips_244 >= OrderStopLoss() +
                        Point) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - (Bid - OrderOpenPrice()) * G_pips_244, OrderTakeProfit(), 0, CLR_NONE);
                  }
               }
            }
         }
      }
   }
}
			         		 	     			 		 	 		   				  		   	     	  	 			 		 					   		   				  			 		  	   		 		 	   			   		 		 	  				 	 	     		 	 		   	 
// 58B0897F29A3AD862616D6CBF39536ED
void f0_5() {
   int error_0;
   int ticket_4;
   string cmd_8;
   int Li_unused_16 = 0;
   int Li_unused_20 = 0;
   int Li_24 = OrdersTotal() - 1;
   int count_28 = 0;
   int count_32 = 0;
   int Li_36 = 3;
   for (int pos_40 = Li_24; pos_40 >= 0; pos_40--) {
      if (OrderSelect(pos_40, SELECT_BY_POS, MODE_TRADES)) {
         ticket_4 = OrderTicket();
         cmd_8 = OrderType();
         if (OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136) {
            if (OrderType() == OP_BUY && OrderSymbol() == Gs_516) {
               count_28++;
               if (Gi_208 == FALSE) {
                  if (Bid >= OrderOpenPrice() + TakeProfit * Gd_488 || Bid <= OrderOpenPrice() - StopLoss * Gd_488 || f0_10(OrderOpenPrice(), f0_4())) {
                     for (int Li_44 = 1; Li_44 <= MathMax(1, Li_36); Li_44++) {
                        RefreshRates();
                        if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), G_slippage_536, G_color_652)) {
                           count_28--;
                           break;
                        }
                        error_0 = GetLastError();
                        if (Gi_420) Print(" (", cmd_8, ",", ticket_4, ").  ", f0_1(error_0));
                     }
                  }
               }
               if (Gi_208 == TRUE) {
                  if (Bid >= OrderOpenPrice() + Gi_504 * Point && Bid >= OrderOpenPrice() + TakeProfit * Gd_488 || Bid <= OrderOpenPrice() - StopLoss * Gd_488 || f0_10(OrderOpenPrice(),
                     f0_4())) {
                     for (Li_44 = 1; Li_44 <= MathMax(1, Li_36); Li_44++) {
                        RefreshRates();
                        if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), G_slippage_536, G_color_652)) {
                           count_28--;
                           break;
                        }
                        error_0 = GetLastError();
                        if (Gi_420) Print(" (", cmd_8, ",", ticket_4, "). ", f0_1(error_0));
                     }
                  }
               }
            }
            if (OrderType() == OP_SELL && OrderSymbol() == Gs_516) {
               count_32++;
               if (Gi_208 == FALSE) {
                  if (Ask <= OrderOpenPrice() - TakeProfit * Gd_488 || Ask >= OrderOpenPrice() + StopLoss * Gd_488 || f0_9(OrderOpenPrice(), f0_4())) {
                     for (Li_44 = 1; Li_44 <= MathMax(1, Li_36); Li_44++) {
                        RefreshRates();
                        if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), G_slippage_536, G_color_656)) {
                           count_32--;
                           break;
                        }
                        error_0 = GetLastError();
                        if (Gi_420) Print("(", cmd_8, ",", ticket_4, ").  ", f0_1(error_0));
                     }
                  }
               }
               if (Gi_208 == TRUE) {
                  if (Ask <= OrderOpenPrice() - Gi_504 * Point && Ask <= OrderOpenPrice() - TakeProfit * Gd_488 || Ask >= OrderOpenPrice() + StopLoss * Gd_488 || f0_9(OrderOpenPrice(),
                     f0_4())) {
                     for (Li_44 = 1; Li_44 <= MathMax(1, Li_36); Li_44++) {
                        RefreshRates();
                        if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), G_slippage_536, G_color_656)) {
                           count_32--;
                           break;
                        }
                        error_0 = GetLastError();
                        if (Gi_420) Print(" (", cmd_8, ",", ticket_4, ").  ", f0_1(error_0));
                     }
                  }
               }
            }
         }
      }
   }
}
	 				 	 	 	     	 		 	   		 		  	    		  						 	 	 	    	 	 			 	  	 		  		 	 		      		  		  			 	  	  	 		  			 	  		 	 	    	 		 					 		   
// D1DDCE31F1A86B3140880F6B1877CBF8
int f0_13() {
   int Li_unused_0 = 0;
   bool Li_ret_4 = FALSE;
   bool Li_8 = FALSE;
   bool Li_12 = FALSE;
   bool Li_16 = FALSE;
   double iclose_20 = iClose(NULL, PERIOD_M15, 1);
   double ima_28 = iMA(NULL, PERIOD_M15, G_period_140, 0, MODE_SMMA, PRICE_HIGH, 1);
   double istochastic_36 = iStochastic(NULL, PERIOD_M15, G_period_348, 1, 1, MODE_SMA, 0, MODE_MAIN, 1);
   double iatr_44 = iATR(NULL, PERIOD_M15, G_period_344, 1);
   double icci_52 = iCCI(NULL, PERIOD_M15, G_period_340, PRICE_TYPICAL, 1);
   double Ld_60 = NormalizeDouble(Gi_352 * Gd_488, Gi_496);
   double Ld_68 = NormalizeDouble(Gi_356 * Gd_488, Gi_496);
   double bid_76 = Bid;
   if (iatr_44 <= Gi_232 * Gd_488) return (0);
   if (iclose_20 - ima_28 > Ld_60 && iclose_20 - bid_76 >= (-Gd_508) && Gi_620 > istochastic_36) Li_8 = TRUE;
   else Li_8 = FALSE;
   if (iclose_20 - ima_28 > Ld_68 && iclose_20 - bid_76 >= (-Gd_508) && (-Gd_376) > icci_52) Li_12 = TRUE;
   else Li_12 = FALSE;
   if (iclose_20 - ima_28 > Ld_68 && iclose_20 - bid_76 >= (-Gd_508) && Gi_624 > istochastic_36) Li_16 = TRUE;
   else Li_16 = FALSE;
   if (Li_8 == TRUE || Li_12 == TRUE || Li_16 == TRUE) Li_ret_4 = TRUE;
   else Li_ret_4 = FALSE;
   return (Li_ret_4);
}
	    	 				 	   			   	 	   			 					 			    						 		  	  	  		   			 	  	   	  				    			 	   	 	   		  	 	   	 	   	   	    			   		 	 	 	  	
// 689C35E4872BA754D7230B8ADAA28E48
int f0_6() {
   int Li_unused_0 = 0;
   bool Li_ret_4 = FALSE;
   bool Li_8 = FALSE;
   bool Li_12 = FALSE;
   bool Li_16 = FALSE;
   double iclose_20 = iClose(NULL, PERIOD_M15, 1);
   double ima_28 = iMA(NULL, PERIOD_M15, G_period_164, 0, MODE_SMMA, PRICE_LOW, 1);
   double istochastic_36 = iStochastic(NULL, PERIOD_M15, G_period_368, 1, 1, MODE_SMA, 0, MODE_MAIN, 1);
   double iatr_44 = iATR(NULL, PERIOD_M15, G_period_364, 1);
   double icci_52 = iCCI(NULL, PERIOD_M15, G_period_168, PRICE_TYPICAL, 1);
   double Ld_60 = NormalizeDouble(Gi_372 * Gd_488, Gi_496);
   double Ld_68 = NormalizeDouble(Gi_220 * Gd_488, Gi_496);
   double bid_76 = Bid;
   if (iatr_44 <= Gi_232 * Gd_488) return (0);
   if (ima_28 - iclose_20 > Ld_60 && iclose_20 - bid_76 <= Gd_508 && istochastic_36 > Gi_628) Li_8 = TRUE;
   else Li_8 = FALSE;
   if (ima_28 - iclose_20 > Ld_68 && iclose_20 - bid_76 <= Gd_508 && icci_52 > Gd_376) Li_12 = TRUE;
   else Li_12 = FALSE;
   if (ima_28 - iclose_20 > Ld_68 && iclose_20 - bid_76 <= Gd_508 && istochastic_36 > Gi_632) Li_16 = TRUE;
   else Li_16 = FALSE;
   if (Li_8 == TRUE || Li_12 == TRUE || Li_16 == TRUE) Li_ret_4 = TRUE;
   else Li_ret_4 = FALSE;
   return (Li_ret_4);
}
	  	   	 					   			 		    		 	  		 				   	  		 				        				   	  		 		 		 			 		  			     		   	 	        		   	 		    	   			 					       
// 9B1AEE847CFB597942D106A4135D4FE6
int f0_10(double Ad_0, int Ai_8) {
   bool Li_ret_12 = FALSE;
   bool Li_16 = FALSE;
   bool Li_20 = FALSE;
   double istochastic_24 = iStochastic(NULL, PERIOD_M15, G_period_348, 1, 1, MODE_SMA, 0, MODE_SIGNAL, 1);
   double iclose_32 = iClose(NULL, PERIOD_M15, 1);
   double iopen_40 = iOpen(NULL, PERIOD_M1, 1);
   double iclose_48 = iClose(NULL, PERIOD_M1, 1);
   double Ld_56 = NormalizeDouble((-Gi_204) * Gd_488, Gi_496);
   double Ld_64 = NormalizeDouble(Gi_384 * Gd_488, Gi_496);
   double bid_72 = Bid;
   if (Ad_0 - bid_72 <= Ld_56 && iclose_32 - bid_72 <= Gd_508 && istochastic_24 > Gi_636 && Ai_8 == 1) Li_16 = TRUE;
   else Li_16 = FALSE;
   if (iopen_40 > iclose_48 && bid_72 - Ad_0 >= Ld_64 && Ai_8 == 1) Li_20 = TRUE;
   else Li_20 = FALSE;
   if (Li_16 == TRUE || Li_20 == TRUE) Li_ret_12 = TRUE;
   else Li_ret_12 = FALSE;
   return (Li_ret_12);
}
	  		   				 	 										  	  					  		 	  		 	 				   		   			           						 		  	 	 		 	  	 	  		  	   	  	 	  		      		 								  	  	  		
// 945D754CB0DC06D04243FCBA25FC0802
int f0_9(double Ad_0, int Ai_8) {
   bool Li_ret_12 = FALSE;
   bool Li_16 = FALSE;
   bool Li_20 = FALSE;
   double istochastic_24 = iStochastic(NULL, PERIOD_M15, G_period_368, 1, 1, MODE_SMA, 0, MODE_SIGNAL, 1);
   double iclose_32 = iClose(NULL, PERIOD_M15, 1);
   double iopen_40 = iOpen(NULL, PERIOD_M1, 1);
   double iclose_48 = iClose(NULL, PERIOD_M1, 1);
   double Ld_56 = NormalizeDouble((-Gi_204) * Gd_488, Gi_496);
   double Ld_64 = NormalizeDouble(Gi_384 * Gd_488, Gi_496);
   double bid_72 = Bid;
   double ask_80 = Ask;
   if (ask_80 - Ad_0 <= Ld_56 && iclose_32 - bid_72 >= (-Gd_508) && istochastic_24 < Gi_640 && Ai_8 == 1) Li_16 = TRUE;
   else Li_16 = FALSE;
   if (iopen_40 < iclose_48 && Ad_0 - ask_80 >= Ld_64 && Ai_8 == 1) Li_20 = TRUE;
   else Li_20 = FALSE;
   if (Li_16 == TRUE || Li_20 == TRUE) Li_ret_12 = TRUE;
   else Li_ret_12 = FALSE;
   return (Li_ret_12);
}
		 		   	 		 	 		 								 	  			 	  		 		 		 	 	 		   			  			  	       							  	  	 	  	 	  	    		  		  	  	    		   	  		 		 					     	  		
// 50257C26C4E5E915F022247BABD914FE
double f0_3() {
   double Ld_0;
   int count_8;
   double Ld_12;
   int Li_20;
   double Ld_24;
   int Li_32;
   double Ld_36;
   int Li_44;
   double Ld_48 = 1;
   if (Gd_332 > 0.0 && Gd_280 > 0.0) {
      Ld_0 = 0;
      count_8 = 0;
      Ld_12 = 0;
      Li_20 = 0;
      Ld_24 = 0;
      Li_32 = 0;
      for (int pos_56 = OrdersHistoryTotal() - 1; pos_56 >= 0; pos_56--) {
         if (OrderSelect(pos_56, SELECT_BY_POS, MODE_HISTORY)) {
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
               count_8++;
               Ld_0 += OrderProfit();
               if (Ld_0 > Ld_24) {
                  Ld_24 = Ld_0;
                  Li_32 = count_8;
               }
               if (Ld_0 < Ld_12) {
                  Ld_12 = Ld_0;
                  Li_20 = count_8;
               }
               if (count_8 >= Gi_304) break;
            }
         }
      }
      if (Li_32 <= Li_20) Ld_48 = MathPow(Gd_332, Li_20);
      else {
         Ld_0 = Ld_24;
         count_8 = Li_32;
         Ld_36 = Ld_24;
         Li_44 = Li_32;
         for (pos_56 = OrdersHistoryTotal() - Li_32 - 1; pos_56 >= 0; pos_56--) {
            if (OrderSelect(pos_56, SELECT_BY_POS, MODE_HISTORY)) {
               if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
                  if (count_8 >= Gi_304) break;
                  count_8++;
                  Ld_0 += OrderProfit();
                  if (Ld_0 < Ld_36) {
                     Ld_36 = Ld_0;
                     Li_44 = count_8;
                  }
               }
            }
         }
         if (Li_44 == Li_32 || Ld_36 == Ld_24) Ld_48 = MathPow(Gd_332, Li_20);
         else {
            if (MathAbs(Ld_12 - Ld_24) / MathAbs(Ld_36 - Ld_24) >= (Gd_308 + 100.0) / 100.0) Ld_48 = MathPow(Gd_332, Li_20);
            else Ld_48 = MathPow(Gd_332, Li_44);
         }
      }
   }
   for (double Ld_ret_60 = MathMax(G_minlot_568, MathMin(G_maxlot_576, MathCeil(MathMin(Gd_296, Ld_48 * Gd_280) / 100.0 * AccountFreeMargin() / G_lotstep_584 / (Gi_592 / 100)) * G_lotstep_584)); Ld_ret_60 >= 2.0 * G_minlot_568 &&
      1.05 * (Ld_ret_60 * G_marginrequired_596) >= AccountFreeMargin(); Ld_ret_60 -= G_minlot_568) {
   }
   return (Ld_ret_60);
}
							 	  	  			  		  					 	 		       						  	  	 						 	    		  		  	 		  	      		    				  	 	 	 			 				  	 	 	  		 	 			  		     	 					
// 78BAA8FAE18F93570467778F2E829047
int f0_8() {
   RefreshRates();
   if (NormalizeDouble(Ask - Bid, Digits) > Gd_544) return (1);
   return (0);
}
	 		 	 			 		   		 	  	 	 					 		  	 			 		 					 			  	 	   		  	 		 	   	  	  	  	    	   	   		    		 	  	   		    	  	     		 	  		 		  	  	
// 5710F6E623305B2C1458238C9757193B
int f0_4() {
   int Li_0 = OrdersTotal() - 1;
   for (int pos_4 = Li_0; pos_4 >= 0; pos_4--) {
      if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderType() == OP_BUY || OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136) {
            if (OrderSymbol() == Gs_516)
               if (OrderType() <= OP_SELL) return (1);
         }
      }
   }
   return (0);
}
			 		 	            	 	  		  		    	  		 		 				     	   				 						 	 			  	 	 	  	    	  			  	 			  	 					  	 			  						       	 			 				   
// A9B24A824F70CC1232D1C2BA27039E8D
int f0_11() {
   int count_0 = 0;
   int Li_4 = OrdersTotal() - 1;
   for (int pos_8 = Li_4; pos_8 >= 0; pos_8--) {
      if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
         if (OrderComment() != "R" && (OrderType() == OP_BUY || OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber || OrderMagicNumber() == G_magic_136 && OrderSymbol() == Gs_516)) count_0++;
   }
   if (count_0 >= Gi_540) return (0);
   return (1);
}
	  		  					 	  							 	  	  	 			  				  		 						    	   				       	  					  		  	   		 	    	  		 		   	    	  		 	    		  								 	  	   	
// AA5EA51BFAC7B64E723BF276E0075513
void f0_12(int Ai_0) {
   double order_open_price_4;
   double order_open_price_12;
   double order_open_price_20;
   double order_open_price_28;
   double Ld_unused_36;
   double Ld_44;
   double lots_52;
   double Ld_unused_60;
   int Li_unused_68 = 0;
   int Li_unused_72 = 0;
   bool Li_76 = FALSE;
   bool Li_80 = FALSE;
   int Li_unused_84 = 0;
   int Li_unused_88 = 0;
   int Li_unused_92 = 0;
   int Li_unused_96 = 0;
   int Li_unused_100 = 0;
   int Li_unused_104 = 0;
   bool Li_108 = FALSE;
   bool Li_112 = FALSE;
   bool Li_116 = FALSE;
   bool Li_120 = FALSE;
   bool Li_124 = FALSE;
   bool Li_128 = FALSE;
   for (int pos_132 = OrdersTotal() - 1; pos_132 >= 0; pos_132--) {
      if (!OrderSelect(pos_132, SELECT_BY_POS, MODE_TRADES) || OrderSymbol() != Symbol()) continue;
      if (OrderType() == OP_BUY || OrderType() == OP_SELL && OrderOpenTime() >= iTime(Symbol(), G_timeframe_400, 0)) Li_108 = TRUE;
      if (OrderType() == OP_BUY && OrderMagicNumber() == G_magic_136 || OrderMagicNumber() == MagicNumber && Ask > OrderOpenPrice() - G_pips_172 * Point * Gi_504) Li_120 = TRUE;
      if (OrderType() == OP_SELL && OrderMagicNumber() == G_magic_136 || OrderMagicNumber() == MagicNumber && Bid < OrderOpenPrice() + G_pips_172 * Point * Gi_504) Li_124 = TRUE;
      if (OrderType() == OP_BUY && OrderMagicNumber() == G_magic_136) {
         Li_112 = TRUE;
         order_open_price_4 = OrderOpenPrice();
      }
      if (OrderType() == OP_SELL && OrderMagicNumber() == G_magic_136) {
         Li_116 = TRUE;
         order_open_price_12 = OrderOpenPrice();
      }
      if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) {
         Li_unused_100 = 1;
         order_open_price_20 = OrderOpenPrice();
      }
      if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber) {
         Li_unused_104 = 1;
         order_open_price_28 = OrderOpenPrice();
      }
      if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber && OrderStopLoss() > OrderOpenPrice()) Li_unused_92 = 1;
      if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber && OrderStopLoss() < OrderOpenPrice()) Li_unused_96 = 1;
      if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber && Ask < OrderOpenPrice() - G_pips_172 * Point * Gi_504) {
         Li_76 = TRUE;
         Ld_44 = OrderLots();
      }
      if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber && Bid > OrderOpenPrice() + G_pips_172 * Point * Gi_504) {
         Li_80 = TRUE;
         Ld_44 = OrderLots();
      }
      if (Gi_412 == FALSE) {
         if (OrderType() == OP_BUY && OrderMagicNumber() == G_magic_136) Li_unused_100 = 1;
         if (OrderType() == OP_SELL && OrderMagicNumber() == G_magic_136) Li_unused_104 = 1;
         if (OrderType() == OP_BUY && OrderMagicNumber() == G_magic_136 && OrderStopLoss() > OrderOpenPrice()) Li_unused_92 = 1;
         if (OrderType() == OP_SELL && OrderMagicNumber() == G_magic_136 && OrderStopLoss() < OrderOpenPrice()) Li_unused_96 = 1;
         if (OrderType() == OP_BUY && OrderMagicNumber() == G_magic_136 && Ask < OrderOpenPrice() - G_pips_172 * Point * Gi_504) {
            Li_76 = TRUE;
            Ld_44 = OrderLots();
         }
         if (OrderType() == OP_SELL && OrderMagicNumber() == G_magic_136 && Bid > OrderOpenPrice() + G_pips_172 * Point * Gi_504) {
            Li_80 = TRUE;
            Ld_44 = OrderLots();
         }
      }
      if (Gi_236 == TRUE && Li_112 == TRUE && OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber && OrderTakeProfit() > OrderOpenPrice() + 1.0 * Point + G_pips_196 * Point * Gi_504 &&
         order_open_price_4 < OrderOpenPrice() && OrderProfit() < 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() + G_pips_196 * Point * Gi_504, 0, CLR_NONE);
      if (Gi_236 == TRUE && Li_116 == TRUE && OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber && OrderTakeProfit() < OrderOpenPrice() - 1.0 * Point - G_pips_196 * Point * Gi_504 &&
         order_open_price_12 > OrderOpenPrice() && OrderProfit() < 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() - G_pips_196 * Point * Gi_504, 0, CLR_NONE);
   }
   if (LotSize > 0.0) {
      Ld_unused_36 = Gd_612;
      Ld_44 = Gd_612;
      Ld_unused_60 = Gd_612;
   }
   for (int pos_136 = OrdersTotal() - 1; pos_136 >= 0; pos_136--) {
      if (OrderSelect(pos_136, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_136 || OrderMagicNumber() == MagicNumber)
         if (Gd_324 > 0.0 && Gd_324 * AccountFreeMargin() < AccountMargin()) Li_128 = TRUE;
   }
   double Ld_140 = AccountFreeMargin() * Gd_316;
   double lotstep_148 = MarketInfo(Symbol(), MODE_LOTSTEP);
   int Li_156 = Ld_140 / MarketInfo(Symbol(), MODE_MARGINREQUIRED) / lotstep_148;
   double Ld_160 = Li_156 * lotstep_148;
   if (Ld_160 > G_maxlot_576) Ld_160 = G_maxlot_576;
   if (Li_108 == FALSE && Li_128 == FALSE) {
      if (Ai_0 == 0 && Li_76 == TRUE && f0_13() == 1 && Li_120 == FALSE) {
         lots_52 = NormalizeDouble(Gd_180 * Ld_44, Gi_388);
         if (lots_52 > G_maxlot_576) lots_52 = G_maxlot_576;
         if (lots_52 > Ld_160) lots_52 = Ld_160;
         OrderSend(Symbol(), OP_BUY, lots_52, Ask, 2, 0, 0, 0, G_magic_136, 0, Blue);
      }
      if (Ai_0 == 0 && Li_80 == TRUE && f0_6() == 1 && Li_124 == FALSE) {
         lots_52 = NormalizeDouble(Gd_180 * Ld_44, Gi_388);
         if (lots_52 > G_maxlot_576) lots_52 = G_maxlot_576;
         if (lots_52 > Ld_160) lots_52 = Ld_160;
         OrderSend(Symbol(), OP_SELL, lots_52, Bid, 2, 0, 0, 0, G_magic_136, 0, Fuchsia);
      }
   }
}
	 	  			 	  	 	  	        	 		   	 		  	  	  	 	 	  			   		   		 							       		 		 	 		 	 		 				  		  		 		 				  			 		  	  	     					 		  
// 2569208C5E61CB15E209FFE323DB48B7
string f0_1(int Ai_unused_0) {
   string Ls_ret_4 = "";
   return (Ls_ret_4);
}

Recommend