///////////////////////////////////////////////////////////////////
//Generated by ex4 to mq4 decompile Service                      // 
//Website:                                                       //
//E-mail : jlk2k3@gmail.com ; decompiler.ex4tomq4@gmail.com      //
///////////////////////////////////////////////////////////////////
#property copyright "Copyright © 2013, Andrey Belov."
#property link      "abb1963@yandex.ru"

#include <WinUser32.mqh>

extern bool OnlyCommentNotTrade = FALSE;
extern bool WorkByBars = FALSE;
extern int MagicNumber = 200;
extern bool UseMAGIC = FALSE;
extern bool MoneyManagement = TRUE;
extern double MinLot = 0.3;
extern double MaxLot = 10.0;
extern double MinRisk = 2.0;
extern double MaxRisk = 50.0;
extern int MaxOrders = 20;
extern int MaxOrdersStopNextStep = 20;
extern double MultiLotsFactor = 1.2;
extern double MultiLotsFactorExp = 1.0;
extern double StepOrders = 10.0;
extern double TakeProfit = 40.0;
extern double StopLoss = 0.0;
extern double Slippage = 3.0;
extern bool Grid_Ariphmetic = TRUE;
extern bool Grid_Multiplier = FALSE;
extern double Grid_Ratio = 1.0;
extern string t2 = "============ Трейлинг ==============";
extern bool UseTrailing = FALSE;
extern double TrailStart = 15.0;
extern double TrailStop = 3.0;
extern bool TrailTP = FALSE;
extern string t3 = "============== Сигналы =============";
extern bool UseForсeStart = TRUE;
extern bool UseSignal_MA = TRUE;
extern int TimeFrame_MA = 60;
extern bool UseSignal_RSI = FALSE;
extern int TimeFrame_RSI = 15;
extern bool UseSignal_Bars = FALSE;
extern int TimeFrame_Bars = 15;
extern bool UseSignal_AC_AO = FALSE;
extern int TimeFrame_AC_AO = 15;
extern string t4 = "======= Параметры индикаторов ======";
extern bool UseSignal_PauseMA = TRUE;
extern bool PauseMA_AllSignal = FALSE;
extern bool PauseMA_Comment = FALSE;
extern int TimePauseMA = 15;
extern int Period_MA1 = 21;
extern int Period_MA2 = 55;
extern int Period_MA3 = 200;
extern int Period_RSI = 14;
extern bool Logic_RSI = TRUE;
extern int Filter_RSI_Min = 30;
extern int Filter_RSI_Max = 70;
extern string t5 = "====== Защита от стопаута ==========";
extern bool SafeEquityStopOut = FALSE;
extern double SafeEquityRisk = 80.0;
extern double SafeEquityRiskMax = 99.0;
extern bool OpenLockPosition = FALSE;
extern double dKoeffLockPosition = 0.95;
extern double StopLossLock = 0.0;
extern string t6 = "====== Отображение информации ======";
extern bool IndicationAll = TRUE;
extern bool IndicationTopLeft = TRUE;
extern bool IndicationTopRight = FALSE;
extern bool IndicationBottomLeft = TRUE;
extern bool IndicationBottomRight = TRUE;
extern bool UseChangeColors = TRUE;
extern bool UseColorBlackFon = TRUE;
extern color ColorZeroLevel = LimeGreen;
extern bool lCalcCurrentSymbol = TRUE;
extern string t8 = "========== Планировщик ==========";
extern int StartingTradeDay = 0;
extern int StartHour = 0;
extern int StartMinute = 0;
extern int EndingTradeDay = 7;
extern int StopHour = 0;
extern int StopMinute = 0;
extern string t9 = "===== Дополнительные функции =====";
extern bool FreezeAfterTP = FALSE;
extern bool CloseAllOrders = FALSE;
extern bool AutoModifyTP = TRUE;
extern string t10 = "======= Алгоритм Вагонетки =======";
extern bool UseVagonetka = FALSE;
extern int LogicVagonetka = 3;
extern int OrdersVagonetka = 7;
extern int SaveProfit = 10;
extern double TrailStart2 = 5.0;
extern double TrailStop2 = 3.0;
int Gi_512 = 0;
double Gd_516;
double Gd_524;
double Gd_532 = 0.0;
double Gd_540 = 0.0;
double Gd_548 = 0.0;
double Gd_556 = 0.0;
double Gd_564 = 0.0;
double Gd_572 = 0.0;
int G_datetime_580;
int G_datetime_584;
bool Gi_588 = FALSE;
bool Gi_592 = FALSE;
int G_ticket_596 = 0;
int G_ticket_600 = 0;
double G_order_open_price_604 = 0.0;
double G_order_open_price_612 = 0.0;
double G_pips_620 = 2000.0;
string Gs_628 = "";
bool G_bool_636;
double Gd_640 = 0.0;
double Gd_648 = 0.0;
int Gi_656 = 10;
int Gi_660 = 12632256;
int Gi_664 = 13749760;
int Gi_668 = 10156544;
int Gi_672 = 3329330;
int Gi_676 = 4678655;
int Gi_680 = 16760576;
int Gi_684 = 9639167;
int Gi_688 = 3329330;
double Gd_692 = 1.0;
double Gd_700 = 1.0;
int Gi_708 = 12632256;
int Gi_712 = 6;
int Gi_716 = 55;
int Gi_720 = 12;
int Gi_724 = 5;
int Gi_728 = 105;
int Gi_732 = 180;
int Gi_unused_736 = 0;
int G_color_740;
double Gd_748;
double Gd_756;
int Gi_unused_764;
double Gd_768;
string G_time2str_776;
double Gd_784;
double Gd_792;
int Gi_800 = 200;
int Gi_804 = 201;
string Gs_808 = "";
bool G_bool_816 = FALSE;
int Gi_820 = -1;
int Gi_824 = -1;
int Gi_828 = -1;
double G_iclose_832;
double G_iclose_840;
int Gi_848 = -1;
bool Gi_852 = FALSE;
double G_iao_856;
double G_iao_864;
double G_iac_872;
double G_iac_880;
int Gi_888 = -1;
double G_irsi_892;
string Gs_900;
double Gda_908[10];
string Gs_912;
int Gi_920 = -1;
bool Gi_924 = FALSE;
bool Gi_928 = FALSE;
int Gi_932 = 0;
int Gi_936 = 0;
double Gd_940 = 0.0;
double Gd_948 = 0.0;
double Gd_956 = 0.0;
double Gd_964 = 0.0;
double Gd_972 = 1.0;
double Gd_980 = 1.0;
double Gd_988 = 1.0;
double Gd_996 = 1.0;
double Gd_unused_1004;
double Gd_1012;
double Gd_1020 = 0.0;
double Gd_1028 = 0.0;
int Gi_1036;
datetime G_time_1040 = 0;
int G_pos_1044 = 0;
double Gd_1048 = 0.0;
double Gd_unused_1064 = 0.0;
double Gd_1072 = 0.01;
double Gd_1080 = 0.01;
double Gd_1088 = 0.01;
double Gd_1096 = 0.01;
double Gd_1104 = 0.01;
double Gd_1112 = 0.01;
double Gd_1120;
double Gd_1128;
double G_price_1136;
double G_price_1144;
double G_price_1152;
double G_price_1160;
double Gd_1168;
double Gd_1176;
double Gd_1184;
double Gd_1192;
int Gi_1200;
int Gi_1204;
int Gi_1208 = 0;
int Gi_1212 = 0;
int Gi_1216;
int Gi_1220;
bool Gi_1224 = FALSE;
bool Gi_1228 = FALSE;
bool Gi_1232 = FALSE;
bool Gi_1236 = FALSE;
bool Gi_1240 = FALSE;
bool Gi_1244 = FALSE;
bool Gi_1248;
bool Gi_1252;
bool Gi_1256 = FALSE;
bool Gi_1260 = FALSE;
int Gi_1264;
int Gi_1268;

// A88FE8FAEB651132C0CA6446B53FDF9B
int f0_30() {
   if (FreezeAfterTP) return (0);
   bool Li_ret_0 = TRUE;
   Gi_1264 = 60 * StartHour + StartMinute;
   Gi_1268 = 60 * StopHour + StopMinute;
   int day_of_week_4 = DayOfWeek();
   if (day_of_week_4 < StartingTradeDay || day_of_week_4 > EndingTradeDay) Li_ret_0 = FALSE;
   int Li_8 = 60 * TimeHour(TimeCurrent()) + TimeMinute(TimeCurrent());
   if (day_of_week_4 <= StartingTradeDay && Gi_1264 >= Li_8) Li_ret_0 = FALSE;
   if (day_of_week_4 >= EndingTradeDay && Gi_1268 < Li_8) Li_ret_0 = FALSE;
   return (Li_ret_0);
}
			     	   		 			 			 		  		 	  	 	    	   			 					  		 		 			   	  			  	  	 	 			 				 			  	  			    	      			 						  		 			  	 			 				  
// 3201478B89854506BC440821FDEEDE26
int f0_8(int Ai_0, int Ai_4, double Ad_8, double Ad_16, double Ad_24, double Ad_32, double Ad_40, double Ad_48, double Ad_56) {
   if (Ai_0 && Ad_40 * Ad_48 * Ad_56 <= Ad_24 - Ad_16) return (1);
   if (Ai_4 && Ad_8 - Ad_32 >= Ad_56 * Ad_48 * Ad_40) return (1);
   return (0);
}
				  			  				 		  			 	   	  	 	    			  			 				 	 	 	 	  	          	      		 	 	   		  					   				  		  		 		  	  				 	 					 		 		  		 	 
// 72733514C760C7D548E4B5484B9B479E
void f0_18() {
   G_iclose_832 = iClose(Symbol(), TimeFrame_Bars, 2);
   G_iclose_840 = iClose(Symbol(), TimeFrame_Bars, 1);
   if (G_iclose_832 > G_iclose_840) {
      Gi_828 = 1;
      return;
   }
   if (G_iclose_832 < G_iclose_840) Gi_828 = 0;
}
	      	 		 		    				   				 			 		   	 		 				   		    	 	 		 				  	  			  		 	 		 	   				 	 					 			     		  	 		      			     	    							
// 5B401F5F77C900C4ACA3D2D742D5D92D
int f0_14(string A_symbol_0, int A_timeframe_8, int Ai_12) {
   int Li_ret_16;
   G_iac_872 = iAC(A_symbol_0, A_timeframe_8, Ai_12);
   G_iac_880 = iAC(A_symbol_0, A_timeframe_8, Ai_12 - 1);
   if (G_iac_872 > G_iac_880) Li_ret_16 = 1;
   if (G_iac_872 < G_iac_880) Li_ret_16 = 2;
   return (Li_ret_16);
}
			     	   		 			 			 		  		 	  	 	    	   			 					  		 		 			   	  			  	  	 	 			 				 			  	  			    	      			 						  		 			  	 			 				  
// B29DDD92C3B0BEBDD2BDA9D19CBE8600
int f0_31(string A_symbol_0, int A_timeframe_8, int Ai_12) {
   int Li_ret_16;
   G_iao_856 = iAO(A_symbol_0, A_timeframe_8, Ai_12);
   G_iao_864 = iAO(A_symbol_0, A_timeframe_8, Ai_12 - 1);
   if (G_iao_856 > G_iao_864) Li_ret_16 = 1;
   if (G_iao_856 < G_iao_864) Li_ret_16 = 2;
   return (Li_ret_16);
}
			  	  	   	  			 		  		  				  	 	 	  	   	 	 						 		 		  		   	 				  	 		 	 								 		   	  		     	  	   			  					   	 			    			 		 	  
// A47B5C77E40F8AA50D32659C7C5BA8A6
void f0_29() {
   Gi_852 = FALSE;
   if (f0_14(Symbol(), TimeFrame_AC_AO, Gi_852) == 1 && f0_31(Symbol(), TimeFrame_AC_AO, Gi_852) == 1) Gi_848 = 0;
   if (f0_14(Symbol(), TimeFrame_AC_AO, Gi_852) == 2 && f0_31(Symbol(), TimeFrame_AC_AO, Gi_852) == 2) Gi_848 = 1;
   if ((f0_14(Symbol(), TimeFrame_AC_AO, Gi_852) == 1 && f0_31(Symbol(), TimeFrame_AC_AO, Gi_852) == 2) || (f0_14(Symbol(), TimeFrame_AC_AO, Gi_852) == 2 && f0_31(Symbol(),
      TimeFrame_AC_AO, Gi_852) == 1)) Gi_848 = -1;
}
				       			 	 	  		 	    	 	 		         				  		 	  	  	  				     		      	   	 	 		 	  		      		  	 		    			  			 			 		  			 	 	 	  			 	
// 74AED1BB21463309D72135C6861709A4
int f0_19() {
   double ima_0 = iMA(Symbol(), TimeFrame_MA, Period_MA1, 0, MODE_EMA, PRICE_CLOSE, 0);
   double ima_8 = iMA(Symbol(), TimeFrame_MA, Period_MA1, 0, MODE_EMA, PRICE_CLOSE, 1);
   double ima_16 = iMA(Symbol(), TimeFrame_MA, Period_MA2, 0, MODE_EMA, PRICE_CLOSE, 0);
   double ima_24 = iMA(Symbol(), TimeFrame_MA, Period_MA2, 0, MODE_EMA, PRICE_CLOSE, 1);
   double ima_32 = iMA(Symbol(), TimeFrame_MA, Period_MA3, 0, MODE_EMA, PRICE_CLOSE, 0);
   double ima_40 = iMA(Symbol(), TimeFrame_MA, Period_MA3, 0, MODE_EMA, PRICE_CLOSE, 1);
   if ((iOpen(Symbol(), TimeFrame_MA, 1) < ima_40 && iClose(Symbol(), TimeFrame_MA, 1) > ima_40) || (ima_8 >= ima_24 && ima_24 >= ima_40)) return (10);
   if ((iOpen(Symbol(), TimeFrame_MA, 1) > ima_40 && iClose(Symbol(), TimeFrame_MA, 1) < ima_40) || (ima_8 < ima_24 && ima_24 < ima_40)) return (20);
   if ((iOpen(Symbol(), TimeFrame_MA, 1) > ima_24 && iClose(Symbol(), TimeFrame_MA, 1) < ima_24) || ima_8 <= ima_24 || ima_24 <= ima_40 || ima_8 <= ima_40) return (11);
   if ((iOpen(Symbol(), TimeFrame_MA, 1) < ima_24 && iClose(Symbol(), TimeFrame_MA, 1) > ima_24) || ima_8 >= ima_24 || ima_24 >= ima_40 || ima_8 >= ima_40) return (21);
   return (0);
}
	  			   			   	  	    	 		  		 	 	 		   			  	      	 	 	  	 					 				 		 			  	   			  	      		     		 			  	   	 		   		 	    		  	  	   	 	
// F0F5242B145823ACE416134438F6133C
void f0_40() {
   int Li_0;
   int Li_4;
   if (f0_19() == 10) {
      Gi_920 = 0;
      Gd_972 = Gd_692;
      Gd_988 = Gd_700;
      Gd_980 = 1;
      Gd_996 = 1;
   } else {
      if (f0_19() == 20) {
         Gi_920 = 1;
         Gd_972 = 1;
         Gd_988 = 1;
         Gd_980 = Gd_692;
         Gd_996 = Gd_700;
      } else {
         if (f0_19() == 11) {
            Gi_920 = 1;
            Gd_972 = 1;
            Gd_988 = 1;
            Gd_980 = 1;
            Gd_996 = 1;
         } else {
            if (f0_19() == 21) {
               Gi_920 = 0;
               Gd_972 = 1;
               Gd_988 = 1;
               Gd_980 = 1;
               Gd_996 = 1;
            } else {
               Gi_920 = -1;
               Gd_972 = 1;
               Gd_988 = 1;
               Gd_980 = 1;
               Gd_996 = 1;
            }
         }
      }
   }
   int Li_8 = Gi_920;
   for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
      OrderSelect(pos_12, SELECT_BY_POS);
      if (OrderType() == OP_BUY) Li_0++;
      else
         if (OrderType() == OP_SELL) Li_4++;
   }
   if (OrdersTotal() != 0) {
      if (Li_0 >= 1 && Gi_924 == FALSE) Gi_924 = TRUE;
      if (PauseMA_AllSignal == TRUE) Gi_920 = -2;
      if (Li_4 >= 1 && Gi_928 == FALSE) Gi_928 = TRUE;
      if (PauseMA_AllSignal == TRUE) Gi_920 = -2;
   }
   if (UseSignal_PauseMA == TRUE) {
      if (Li_0 == 0 && Gi_924 == TRUE && Gi_932 == 0) {
         Gi_932 = TimeCurrent() + 60 * TimePauseMA;
         Gi_920 = -2;
      }
      if (TimeCurrent() >= Gi_932 && Li_0 == 0 && Gi_924 == TRUE) {
         Gi_932 = 0;
         Gi_920 = -1;
         Gi_924 = FALSE;
      }
      if (Li_4 == 0 && Gi_928 == TRUE && Gi_936 == 0) {
         Gi_936 = TimeCurrent() + 60 * TimePauseMA;
         Gi_920 = -2;
      }
      if (TimeCurrent() >= Gi_936 && Li_4 == 0 && Gi_928 == TRUE) {
         Gi_936 = 0;
         Gi_920 = -1;
         Gi_928 = FALSE;
      }
      if (Gi_924 == TRUE && Li_0 == 0) Gi_920 = -2;
      if (Gi_928 == TRUE && Li_4 == 0) Gi_920 = -2;
      if (PauseMA_Comment == TRUE) {
         Comment("\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", 
            "\n", "PauseMA_AllSignal=" + PauseMA_AllSignal, 
            "\n", 
            "\n", "BUY=" + Li_0, 
            "\n", "SELL=" + Li_4, 
            "\n", 
            "\n", "iOrderTypeMA =" + Gi_920, 
            "\n", "MA_OLD=" + Li_8, 
            "\n", 
            "\n", "iOrderPauseBUY=" + Gi_924, 
            "\n", "iOrderPauseSELL=" + Gi_928, 
            "\n", 
            "\n", "TimePauseMA=" + TimePauseMA, 
            "\n", "TimeCloseBUY=" + TimeToStr(Gi_932, TIME_MINUTES), 
            "\n", "TimeCloseSELL=" + TimeToStr(Gi_936, TIME_MINUTES), 
         "\n", "TimeCurrent    =" + TimeToStr(TimeCurrent(), TIME_MINUTES));
      }
   }
}
	  		 	 				 				 	  						       	 	 	 				 	  	     				  		 	 		 	  				 	   		     		 	  		 			  		  	 		 	     		 		  			  	  						 	  	   
// 36546C22DD6AC3234F265917EF318839
void f0_9() {
   int Li_0 = -1;
   for (int Li_4 = 0; Li_4 < 10; Li_4++) Gda_908[Li_4] = iRSI(NULL, TimeFrame_RSI, Period_RSI, PRICE_CLOSE, Li_4);
   G_irsi_892 = iRSI(NULL, TimeFrame_RSI, Period_RSI, PRICE_CLOSE, 0);
   if (Logic_RSI == TRUE) {
      if (Gda_908[0] < Filter_RSI_Min) Li_0 = 0;
      if (Gda_908[0] > Filter_RSI_Max) Li_0 = 1;
   } else {
      Gs_912 = "L2";
      if (Gda_908[0] < Filter_RSI_Max) {
         if (Gda_908[3] < Gda_908[2] && Gda_908[2] < Gda_908[1] && Gda_908[1] < Gda_908[0]) Li_0 = 0;
         else Li_0 = -1;
      } else {
         if (Gda_908[0] > Filter_RSI_Min) {
            if (Gda_908[3] > Gda_908[2] && Gda_908[2] > Gda_908[1] && Gda_908[1] > Gda_908[0]) Li_0 = 1;
            else Li_0 = -1;
         }
      }
   }
   Gs_900 = "";
   Gs_900 = Gs_900 + DoubleToStr(Gda_908[2], 1) + " ";
   Gs_900 = Gs_900 + DoubleToStr(Gda_908[1], 1) + " ";
   Gs_900 = Gs_900 + "" + Gs_912;
   if (Gi_888 != Li_0) Gi_888 = Li_0;
}
			  	 	    	    	 		      							 	 	 	    	 		 					    		  	 	  	 		    	 			  					  	 		  	   		  		 	  	 					  	  		   		 		      	 		 			
// 26A0EFF9744E3D8E8CE8B01A1336B041
void f0_6() {
   if (UseColorBlackFon == FALSE) {
      Gi_660 = 7346457;
      Gi_664 = 13749760;
      Gi_668 = 7451452;
      Gi_672 = 3329330;
      Gi_676 = 255;
      Gi_680 = 16711680;
      Gi_684 = 8721863;
      Gi_688 = 32768;
   }
   Gd_unused_1004 = TakeProfit;
   Gd_1012 = StepOrders;
   Gd_1020 = StepOrders;
   Gd_1028 = StepOrders;
   Gd_940 = MinRisk;
   Gd_948 = MaxRisk;
   Gd_956 = MinRisk;
   Gd_964 = MaxRisk;
   Gd_972 = 1;
   Gd_988 = 1;
   Gd_980 = 1;
   Gd_996 = 1;
   Gd_940 = MinRisk * Gd_972;
   Gd_948 = MaxRisk * Gd_988;
   Gd_956 = MinRisk * Gd_980;
   Gd_964 = MaxRisk * Gd_996;
   Gi_820 = -1;
   Gi_824 = -1;
   if (MoneyManagement == TRUE) {
      Gd_1072 = f0_38(MinRisk);
      Gd_1080 = f0_38(MaxRisk);
      Gd_1088 = f0_38(Gd_940);
      Gd_1096 = f0_38(Gd_948);
      Gd_1104 = f0_38(Gd_956);
      Gd_1112 = f0_38(Gd_964);
   } else {
      Gd_1072 = MinLot;
      Gd_1080 = MaxLot;
      Gd_1088 = MinLot;
      Gd_1096 = MaxLot;
      Gd_1104 = MinLot;
      Gd_1112 = MaxLot;
   }
   f0_40();
   f0_9();
   f0_18();
   f0_29();
   Gi_1216 = f0_10(OP_BUY, Gi_800);
   Gi_1220 = f0_10(OP_SELL, Gi_804);
   if (Gi_1216 == 0 && Gi_1220 == 0) G_bool_816 = UseForсeStart;
   else G_bool_816 = FALSE;
   f0_39();
   RefreshRates();
   Gd_1120 = f0_34(OP_BUY, Gi_800);
   Gd_1128 = f0_34(OP_SELL, Gi_804);
   Gi_1208 = Gi_1216;
   Gd_1168 = f0_36(OP_BUY, Gd_1088, Gd_1096, Gi_1208);
   Gi_1212 = Gi_1220;
   Gd_1176 = f0_36(OP_SELL, Gd_1104, Gd_1112, Gi_1212);
   Gd_1184 = f0_33(OP_BUY, Gi_800);
   Gd_1192 = f0_33(OP_SELL, Gi_804);
}
		      	 	 		 							 		 			 	  			    	 	 			 		 		  		  	 			  		  			 		  	 	  		 								  	 				           	 	 					   		 		   	 								  
// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   if (IsTesting() == TRUE) {
      Gd_768 = AccountEquity();
      G_time2str_776 = TimeToStr(TimeCurrent(), TIME_DATE);
   }
   if (Digits == 5 || Digits == 3) Gi_1036 = 10;
   else Gi_1036 = 1;
   /*switch (MarketInfo(Symbol(), MODE_MINLOT)) {
   case 0.001:
      Gd_1048 = 3;
      break;
   case 0.01:
      Gd_1048 = 2;
      break;
   case 0.1:
      Gd_1048 = 1;
      break;
   case 1.0:
      Gd_1048 = 0;
   }*/
   Gd_1048 = MathLog10(1/MarketInfo(Symbol(), MODE_MINLOT));
   Gs_808 = "FST 1.19" + " " + Symbol();
   Gi_800 = MagicNumber;
   Gi_804 = MagicNumber + 1;
   Gi_920 = -1;
   Gi_888 = -1;
   Gi_828 = -1;
   Gi_848 = -1;
   f0_6();
   f0_16();
   if (LogicVagonetka == 1) Gs_628 = "Close All Profit = " + DoubleToStr(SaveProfit, 0);
   else {
      if (LogicVagonetka == 2) Gs_628 = "Close B/S Profit = " + DoubleToStr(SaveProfit, 0);
      else
         if (LogicVagonetka == 3) Gs_628 = "Trailing " + DoubleToStr(TrailStart2, 0) + " / " + DoubleToStr(TrailStop2, 0);
   }
   Gd_640 = TrailStart;
   Gd_648 = TrailStop;
   G_bool_636 = UseTrailing;
   return (0);
}
	    	 	 		 	     			    								 		 	 	 		 	 		   			   	 	  	 				 		  			 			 	 				   			  	 				  			   	 		  	  	       		          			 			
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   f0_25();
   Print(G_time2str_776, "-", TimeToStr(TimeCurrent(), TIME_DATE), " | Profit=", AccountEquity() - Gd_768, " | DrawDown=", MathAbs(Gd_784), " | MinRisk=", MinRisk, "/",
      Gd_692, "; MaxRisk=", MaxRisk, "/", Gd_692, "; MLF=", MultiLotsFactor, "/", MultiLotsFactorExp, "; MaxOrders=", MaxOrders, "/", MaxOrdersStopNextStep, "; Step=",
      StepOrders, "; TP=", TakeProfit, "; SL=", StopLoss, "; Ratio=", Grid_Ratio, "; MA=", UseSignal_MA, "/", f0_7(TimeFrame_MA), "; Bars=", UseSignal_Bars, "/", f0_7(TimeFrame_Bars),
      "; AC_AO=", UseSignal_AC_AO, "/", f0_7(TimeFrame_AC_AO), "; RSI=", UseSignal_RSI, "/", f0_7(TimeFrame_RSI), "/", Period_RSI, "/", Gs_912, "/", Filter_RSI_Min, "/",
      Filter_RSI_Max, "; Vagonetka=", UseVagonetka, "/Logic=", Gs_628, "; Lock=", OpenLockPosition, "DD=" + DoubleToStr(SafeEquityRisk, 0) + "% K-t=" + DoubleToStr(dKoeffLockPosition,
      1) + " SL=" + DoubleToStr(StopLossLock, 0));
   return (0);
}
	 			 	  	 	 			     			 	      	   	 	  	 	 	    	   		 		 		 			  	  	 	  	    		    	     		  	   		 					 	 	 	 		 	  				    						     	  	
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_0;
   int Li_4;
   string Ls_8;
   int mb_code_16;
   bool bool_52;
   int error_56;
   int Li_60;
   double Ld_68;
   if (WorkByBars == TRUE) {
      if (G_time_1040 == Time[0]) return (0);
      G_time_1040 = Time[0];
   }
   f0_6();
   if (OnlyCommentNotTrade == TRUE) {
      f0_16();
      return (0);
   }
   if (CloseAllOrders) {
      if (Gi_1216 != 0 || Gi_1220 != 0) {
         Ls_8 = "ALL positions will be closed on " + Symbol();
         if (UseMAGIC == TRUE) Ls_8 = Ls_8 + " ( only Magics " + Gi_800 + " / " + Gi_804 + " )";
         mb_code_16 = MessageBox(Ls_8 + " !\nAre you sure ?", "ATTENTION!", MB_YESNO|32|256);
         if (mb_code_16 == IDYES) {
            f0_17();
            return (0);
         }
      }
   }
   double Ld_20 = f0_33(OP_BUY, Gi_800);
   double Ld_28 = f0_33(OP_SELL, Gi_804);
   if (Gi_1216 > 0)
      if (UseTrailing == TRUE) f0_26(OP_BUY, Gi_800, TrailStart, TrailStop, G_price_1136);
   if (Gi_1220 > 0)
      if (UseTrailing == TRUE) f0_26(OP_SELL, Gi_804, TrailStart, TrailStop, G_price_1144);
   if (SafeEquityStopOut == TRUE) f0_13();
   if (Gi_1216 == 0) Gi_1248 = FALSE;
   if (Gi_1220 == 0) Gi_1252 = FALSE;
   for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
      OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == OP_BUY && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_800) || (OrderType() == OP_BUY && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) {
         Gi_1224 = TRUE;
         break;
      }
   }
   for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
      OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == OP_SELL && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_804) || (OrderType() == OP_SELL && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) {
         Gi_1228 = TRUE;
         break;
      }
   }
   Gi_1232 = FALSE;
   if (Gi_1216 > 0 && Gi_1216 <= MaxOrders) {
      Li_0 = f0_8(Gi_1224, 0, Bid, Ask, Gd_1120, 0, Point, Gd_1020, Gi_1036);
      if (Li_0 == 1) Gi_1232 = TRUE;
   }
   Gi_1236 = FALSE;
   if (Gi_1220 > 0 && Gi_1220 <= MaxOrders) {
      Li_4 = f0_8(0, Gi_1228, Bid, Ask, 0, Gd_1128, Point, Gd_1028, Gi_1036);
      if (Li_4 == 1) Gi_1236 = TRUE;
   }
   if (Gi_1216 < 1) {
      Gi_1224 = FALSE;
      Gi_1232 = TRUE;
   }
   if (Gi_1220 < 1) {
      Gi_1228 = FALSE;
      Gi_1236 = TRUE;
   }
   if (Gi_1232) {
      if (Gi_1224) {
         if (UseSignal_MA == TRUE && Gi_920 != 0 && Gi_1216 >= MaxOrdersStopNextStep) Print("Signal MA = SELL ! Next Step LONG not open " + Gi_1216);
         else {
            if (UseSignal_Bars == TRUE && Gi_828 != 0 && Gi_1216 >= MaxOrdersStopNextStep) Print("Signal Bars = SELL ! Next Step LONG not open " + Gi_1216);
            else {
               if (UseSignal_AC_AO == TRUE && Gi_848 != 0 && Gi_1216 >= MaxOrdersStopNextStep) Print("Signal AC_AO = SELL ! Next Step LONG not open " + Gi_1216);
               else {
                  if (UseSignal_RSI == TRUE && Gi_888 != 0 && Gi_1216 >= MaxOrdersStopNextStep) Print(Gs_900 + " Signal RSI = SELL ! Next Step LONG not open " + Gi_1216);
                  else {
                     Gd_1168 = f0_36(OP_BUY, Gd_1088, Gd_1096, Gi_1208);
                     Gi_1208 = Gi_1216;
                     if (Gd_1168 > 0.0) {
                        RefreshRates();
                        Gs_808 = "FST 1.19" + " " + Symbol() + " Long " + Gi_800 + "-" + Gi_1208;
                        Gi_1200 = f0_5(0, Gd_1168, Slippage, StopLoss, 0, Gs_808, Gi_800, 0, Lime);
                        if (Gi_1200 < 0) return (0);
                        Gd_1120 = f0_34(OP_BUY, Gi_800);
                        Gi_1232 = FALSE;
                        Gi_1240 = TRUE;
                     }
                  }
               }
            }
         }
      }
   }
   if (Gi_1236) {
      if (Gi_1228) {
         if (UseSignal_MA == TRUE && Gi_920 != 1 && Gi_1220 >= MaxOrdersStopNextStep) Print("Signal MA = BUY ! Next Step SHORT not open " + Gi_1220);
         else {
            if (UseSignal_Bars == TRUE && Gi_828 != 1 && Gi_1220 >= MaxOrdersStopNextStep) Print("Signal Bars = BUY ! Next Step SHORT not open " + Gi_1220);
            else {
               if (UseSignal_AC_AO == TRUE && Gi_848 != 1 && Gi_1220 >= MaxOrdersStopNextStep) Print("Signal AC_AO = BUY ! Next Step SHORT not open " + Gi_1220);
               else {
                  if (UseSignal_RSI == TRUE && Gi_888 != 1 && Gi_1220 >= MaxOrdersStopNextStep) Print(Gs_900 + " Signal RSI = BUY ! Next Step SHORT not open " + Gi_1220);
                  else {
                     Gd_1176 = f0_36(OP_SELL, Gd_1104, Gd_1112, Gi_1212);
                     Gi_1212 = Gi_1220;
                     if (Gd_1176 > 0.0) {
                        RefreshRates();
                        Gs_808 = "FST 1.19" + " " + Symbol() + " Short " + Gi_804 + "-" + Gi_1212;
                        Gi_1204 = f0_5(1, Gd_1176, Slippage, StopLoss, 0, Gs_808, Gi_804, 0, HotPink);
                        if (Gi_1204 < 0) return (0);
                        Gd_1128 = f0_34(OP_SELL, Gi_804);
                        Gi_1236 = FALSE;
                        Gi_1244 = TRUE;
                     }
                  }
               }
            }
         }
      }
   }
   if ((Gi_1232 && Gi_1216 < 1 && f0_30()) || Gi_1256) {
      if (!Gi_1224 || (Gi_1256 && Gi_1216 <= 2)) {
         Gi_1208 = Gi_1216;
         if (!(UseSignal_MA == TRUE) || !(Gi_920 != 0)) {
            if (!(UseSignal_Bars == TRUE && Gi_828 != 0) || !(G_bool_816 == FALSE)) {
               if (!(UseSignal_AC_AO == TRUE && Gi_848 != 0) || !(G_bool_816 == FALSE)) {
                  if (!(UseSignal_RSI == TRUE && Gi_888 != 0) || !(G_bool_816 == FALSE)) {
                     Gi_820 = 0;
                     Gd_1168 = f0_36(Gi_820, Gd_1088, Gd_1096, Gi_1208);
                     if (Gd_1168 > 0.0) {
                        Gs_808 = "FST 1.19" + " " + Symbol() + " Long " + Gi_800 + "-" + Gi_1208;
                        Gi_1200 = f0_5(Gi_820, Gd_1168, Slippage, StopLoss, 0, Gs_808, Gi_800, 0, Lime);
                        if (Gi_1200 < 0) return (0);
                        Gd_1120 = f0_34(Gi_820, Gi_800);
                        Gi_1240 = TRUE;
                     }
                  }
               }
            }
         }
      }
      Gi_1232 = FALSE;
   }
   if ((Gi_1236 && Gi_1220 < 1 && f0_30()) || Gi_1260) {
      if (!Gi_1228 || (Gi_1260 && Gi_1220 <= 2)) {
         Gi_1212 = Gi_1220;
         if (!(UseSignal_MA == TRUE) || !(Gi_920 != 1)) {
            if (!(UseSignal_Bars == TRUE && Gi_828 != 1) || !(G_bool_816 == FALSE)) {
               if (!(UseSignal_AC_AO == TRUE && Gi_848 != 1) || !(G_bool_816 == FALSE)) {
                  if (!(UseSignal_RSI == TRUE && Gi_888 != 1) || !(G_bool_816 == FALSE)) {
                     Gi_824 = 1;
                     Gd_1176 = f0_36(Gi_824, Gd_1104, Gd_1112, Gi_1212);
                     if (Gd_1176 > 0.0) {
                        Gs_808 = "FST 1.19" + " " + Symbol() + " Short " + Gi_804 + "-" + Gi_1212;
                        Gi_1204 = f0_5(Gi_824, Gd_1176, Slippage, StopLoss, 0, Gs_808, Gi_804, 0, HotPink);
                        if (Gi_1204 < 0) return (0);
                        Gd_1128 = f0_34(Gi_824, Gi_804);
                        Gi_1244 = TRUE;
                     }
                  }
               }
            }
         }
      }
      Gi_1236 = FALSE;
   }
   Gi_1216 = f0_10(OP_BUY, Gi_800);
   Gi_1220 = f0_10(OP_SELL, Gi_804);
   G_price_1136 = 0;
   G_price_1144 = 0;
   double Ld_36 = 0;
   double Ld_44 = 0;
   for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
      OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == OP_BUY && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_800) || (OrderType() == OP_BUY && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) {
         G_price_1136 += OrderOpenPrice() * OrderLots();
         Ld_36 += OrderLots();
      }
   }
   for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
      OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == OP_SELL && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_804) || (OrderType() == OP_SELL && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) {
         G_price_1144 += OrderOpenPrice() * OrderLots();
         Ld_44 += OrderLots();
      }
   }
   if (Gi_1216 > 0) G_price_1136 = NormalizeDouble(G_price_1136 / Ld_36, Digits);
   if (Gi_1240 || AutoModifyTP) {
      for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
         OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
         if ((OrderType() == OP_BUY && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_800) || (OrderType() == OP_BUY && OrderSymbol() == Symbol() &&
            UseMAGIC == FALSE)) {
            G_price_1152 = NormalizeDouble(G_price_1136 + TakeProfit * Point * Gi_1036, Digits);
            Gi_1248 = TRUE;
         }
      }
   }
   if (Gi_1220 > 0) G_price_1144 = NormalizeDouble(G_price_1144 / Ld_44, Digits);
   if (Gi_1244 || AutoModifyTP) {
      for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
         OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
         if ((OrderType() == OP_SELL && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_804) || (OrderType() == OP_SELL && OrderSymbol() == Symbol() &&
            UseMAGIC == FALSE)) {
            G_price_1160 = NormalizeDouble(G_price_1144 - TakeProfit * Point * Gi_1036, Digits);
            Gi_1252 = TRUE;
         }
      }
   }
   int count_64 = 0;
   if (Gi_1240 || AutoModifyTP) {
      if (Gi_1248) {
         for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
            OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
            if ((OrderType() == OP_BUY && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_800) || (OrderType() == OP_BUY && OrderSymbol() == Symbol() &&
               UseMAGIC == FALSE)) {
               if (G_price_1152 != NormalizeDouble(OrderTakeProfit(), Digits)) {
                  count_64 = 0;
                  while (true) {
                     count_64++;
                     bool_52 = OrderModify(OrderTicket(), G_price_1136, OrderStopLoss(), G_price_1152, 0, Yellow);
                     Li_60 = 0;
                     if (bool_52 != TRUE) {
                        error_56 = GetLastError();
                        if (error_56 > 2/* COMMON_ERROR */) Print("OrderModify LastError = ", error_56);
                     } else error_56 = 0;
                     if (error_56 == 129/* INVALID_PRICE */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 135/* PRICE_CHANGED */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 136/* OFF_QUOTES */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 137/* BROKER_BUSY */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 138/* REQUOTE */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 4108/* INVALID_TICKET */) {
                        RefreshRates();
                        Li_60 = 0;
                     }
                     if (Li_60 == 100) continue;
                     break;
                  }
                  Gi_1240 = FALSE;
               }
            }
         }
      }
   }
   if (Gi_1244 || AutoModifyTP) {
      if (Gi_1252) {
         for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
            OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
            if ((OrderType() == OP_SELL && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_804) || (OrderType() == OP_SELL && OrderSymbol() == Symbol() &&
               UseMAGIC == FALSE)) {
               if (G_price_1160 != NormalizeDouble(OrderTakeProfit(), Digits)) {
                  count_64 = 0;
                  while (true) {
                     count_64++;
                     bool_52 = OrderModify(OrderTicket(), G_price_1144, OrderStopLoss(), G_price_1160, 0, Yellow);
                     Li_60 = 0;
                     if (bool_52 != TRUE) {
                        error_56 = GetLastError();
                        if (error_56 > 2/* COMMON_ERROR */) Print("OrderModify LastError = ", error_56);
                     } else error_56 = 0;
                     if (error_56 == 129/* INVALID_PRICE */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 135/* PRICE_CHANGED */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 136/* OFF_QUOTES */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 137/* BROKER_BUSY */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 138/* REQUOTE */) {
                        RefreshRates();
                        Li_60 = 100;
                     }
                     if (error_56 == 4108/* INVALID_TICKET */) {
                        RefreshRates();
                        Li_60 = 0;
                     }
                     if (Li_60 == 100) continue;
                     break;
                  }
                  Gi_1244 = FALSE;
               }
            }
         }
      }
   }
   f0_16();
   if (OpenLockPosition == TRUE) {
      if (OrderSelect(G_ticket_600, SELECT_BY_TICKET, MODE_HISTORY) == TRUE) {
         if (Bid - G_order_open_price_612 >= Gi_1036 * StepOrders * Point) {
            Gi_592 = FALSE;
            G_ticket_600 = 0;
         }
      }
      if (OrderSelect(G_ticket_596, SELECT_BY_TICKET, MODE_HISTORY) == TRUE) {
         if (Point * StepOrders * Gi_1036 <= G_order_open_price_604 - Ask) {
            Gi_588 = FALSE;
            G_ticket_596 = 0;
         }
      }
      if (OrderSelect(G_ticket_600, SELECT_BY_TICKET, MODE_TRADES) == TRUE) Gi_592 = TRUE;
      if (OrderSelect(G_ticket_596, SELECT_BY_TICKET, MODE_TRADES) == TRUE) Gi_588 = TRUE;
      Ld_68 = NormalizeDouble((Ld_36 - Ld_44) * dKoeffLockPosition, Gd_1048);
      if (Gd_524 > SafeEquityRisk) {
         if (Ld_68 > 0.0) {
            if (Gi_1216 > Gi_1220) {
               Gs_808 = "FST 1.19" + " " + Symbol() + " Short LOCK " + Gi_804 + "-" + Gi_1212;
               if (Gi_592 == FALSE || Gd_524 > SafeEquityRiskMax) {
                  G_ticket_600 = f0_5(1, Ld_68, Slippage, StopLossLock, 0, Gs_808, Gi_804, 0, HotPink);
                  Print(Gs_808, " ", Ld_68);
                  if (OrderSelect(G_ticket_600, SELECT_BY_TICKET, MODE_TRADES) == TRUE) G_order_open_price_612 = OrderOpenPrice();
                  Gi_592 = TRUE;
               }
            }
         } else {
            if (Ld_68 < 0.0) {
               if (Gi_1216 < Gi_1220) {
                  Ld_68 = -Ld_68;
                  Gs_808 = "FST 1.19" + " " + Symbol() + " Long LOCK " + Gi_800 + "-" + Gi_1208;
                  if (Gi_588 == FALSE || Gd_524 > SafeEquityRiskMax) {
                     G_ticket_596 = f0_5(0, Ld_68, Slippage, StopLossLock, 0, Gs_808, Gi_800, 0, Lime);
                     Print(Gs_808, " ", Ld_68);
                     if (OrderSelect(G_ticket_596, SELECT_BY_TICKET, MODE_TRADES) == TRUE) G_order_open_price_604 = OrderOpenPrice();
                     Gi_588 = TRUE;
                  }
               }
            }
         }
      }
   }
   if (Gd_792 < AccountEquity()) Gd_792 = AccountEquity();
   if (Gd_784 > AccountEquity() - Gd_792) Gd_784 = AccountEquity() - Gd_792;
   if (UseVagonetka) f0_22();
   return (0);
}
	   				 		   	   		  	  			 	 		 						 		    	   	 		  	 		   						   					 	 	 	 	    		  		 			  				  					  		       	  	    	 	   		   		
// E18D5F00BE42624CEA348A85292694F3
double f0_39() {
   int Li_0 = Gi_1216 - 1;
   if (Li_0 == 0) Gd_1020 = Gd_1012;
   else {
      if (Grid_Ariphmetic + Grid_Multiplier > 0 && Li_0 > 1) {
         if (Grid_Ariphmetic == TRUE) Gd_1020 = Gd_1012 + Grid_Ratio * Li_0;
         else
            if (Grid_Multiplier == TRUE) Gd_1020 = Gd_1012 * (Grid_Ratio * Li_0);
      }
   }
   Li_0 = Gi_1220 - 1;
   if (Li_0 == 0) Gd_1028 = Gd_1012;
   else {
      if (Grid_Ariphmetic + Grid_Multiplier > 0 && Li_0 > 1) {
         if (Grid_Ariphmetic == TRUE) Gd_1028 = Gd_1012 + Grid_Ratio * Li_0;
         else
            if (Grid_Multiplier == TRUE) Gd_1028 = Gd_1012 * (Grid_Ratio * Li_0);
      }
   }
   return (0.0);
}
			   		    			  	 				    		  			 	  		    		 	 				 	   		 	  	  	       	   	  			    	 					   						 	   						 	   		  	 	 		  		  	 			 		
// DE4D92F6194352A18E930521911E829B
double f0_36(int A_cmd_0, double Ad_4, double Ad_12, int Ai_20) {
   double Ld_ret_24 = NormalizeDouble(Ad_4 * MathPow(MultiLotsFactor * MultiLotsFactorExp, MultiLotsFactorExp * Ai_20), Gd_1048);
   if (Ld_ret_24 > Ad_12) Ld_ret_24 = Ad_12;
   if (AccountFreeMarginCheck(Symbol(), A_cmd_0, Ld_ret_24) <= 0.0) return (-1);
   if (GetLastError() == 134/* NOT_ENOUGH_MONEY */) return (-2);
   return (Ld_ret_24);
}
	  	 	 						   	 	 	   			 				  	  	 						 			   		  		    	  		  		 			  					  			 	 	 	  				 	  	 	 	 	 	      	 	  	  			  	    	 	 	 		 
// 40EEFCDDBABD0646D1AD5819251A2B82
int f0_10(int A_cmd_0, int A_magic_4) {
   int count_8 = 0;
   for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
      OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == A_cmd_0 && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == A_magic_4) || (OrderType() == A_cmd_0 && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) count_8++;
   }
   return (count_8);
}
	 	 		  		     		  	   			 	 		    			  		    	 	 		 	 						 		 	 							 				 				 				  	    		 	     		 		    			 			 	 	 	 	 	 	  		  	  	  
// 665AA69E687D058679025D6E7A303C81
void f0_17() {
   int is_closed_0;
   int error_4;
   int Li_8;
   if (Gi_1216 == 0 && Gi_1220 == 0) return;
   int count_12 = 0;
   for (int pos_16 = OrdersTotal() - 1; pos_16 >= 0; pos_16--) {
      OrderSelect(pos_16, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol()) {
         if ((OrderType() == OP_BUY && UseMAGIC == TRUE && OrderMagicNumber() == Gi_800) || (OrderType() == OP_BUY && UseMAGIC == FALSE) || (OrderType() == OP_SELL && UseMAGIC == TRUE &&
            OrderMagicNumber() == Gi_804) || (OrderType() == OP_SELL && UseMAGIC == FALSE)) {
            count_12 = 0;
            while (true) {
               count_12++;
               is_closed_0 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, Red);
               Li_8 = 0;
               if (is_closed_0 != 1) {
                  error_4 = GetLastError();
                  if (error_4 > 2/* COMMON_ERROR */) Print("OrderClose LastError = ", error_4);
               } else error_4 = 0;
               if (error_4 == 129/* INVALID_PRICE */) {
                  RefreshRates();
                  Li_8 = 100;
               }
               if (error_4 == 135/* PRICE_CHANGED */) {
                  RefreshRates();
                  Li_8 = 100;
               }
               if (error_4 == 136/* OFF_QUOTES */) {
                  RefreshRates();
                  Li_8 = 100;
               }
               if (error_4 == 137/* BROKER_BUSY */) {
                  RefreshRates();
                  Li_8 = 100;
               }
               if (error_4 == 138/* REQUOTE */) {
                  RefreshRates();
                  Li_8 = 100;
               }
               if (error_4 == 4108/* INVALID_TICKET */) {
                  RefreshRates();
                  Li_8 = 0;
               }
               if (Li_8 != 100) break;
            }
         } else {
            if (OrderType() != OP_BUY && OrderType() != OP_SELL) {
               OrderDelete(OrderTicket());
               if (GetLastError() > 1/* NO_RESULT */) Print("Error OrderDelete() ticket= ", OrderTicket(), " err= ", GetLastError());
            }
         }
         Sleep(1000);
      }
   }
   if (CloseAllOrders == TRUE) CloseAllOrders = FALSE;
}
	  	   	 					    	 		   		 	 			 	    	 							    	    	   		 			   	  		   		 	  	 	   	 		 	 		 		 			 	   		    		    	 			   	 	    	 					
// 1DA81063C651243F2603388CFF7D564F
double f0_4(double Ad_0, int Ai_8) {
   if (Ai_8 == 0) return (0);
   return (NormalizeDouble(Ad_0 - Ai_8 * Point * Gi_1036, Digits));
}
	  	 	 	 				     	 	    		 					 	  	 	 				 		    		   	    	 			  		  		  			 	  			   	 	  	 		 	  			 	 	 		     	    	  		   	      	 	 			
// 458307E5BB59B18CCDFA52BEA5FC3833
double f0_11(double Ad_0, int Ai_8) {
   if (Ai_8 == 0) return (0);
   return (NormalizeDouble(Ad_0 + Ai_8 * Point * Gi_1036, Digits));
}
	 		 		  	 		 		    	 		 	  		  	    		  	 		     	 				 		    			   	 	 	   	   		 		 	    	 	  	  	 	 				 		 	 	    	  		      		  		    	   	
// 76AE4AED2EB702C79D6EB0B3B7E21DBB
double f0_20(double Ad_0, int Ai_8) {
   if (Ai_8 == 0) return (0);
   return (NormalizeDouble(Ad_0 + Ai_8 * Point * Gi_1036, Digits));
}
		  		 		 	     				    	 		 			 					 		 	   				 	 	  	  		 	   					 	 							  	 		 				   		 		   	    		 	 	 		 	 		  	 				  	   				  		 
// DEC8D51DED953CA6514DE96F70058BBB
double f0_37(double Ad_0, int Ai_8) {
   if (Ai_8 == 0) return (0);
   return (NormalizeDouble(Ad_0 - Ai_8 * Point * Gi_1036, Digits));
}
		  		 	  	      			      		 									 	  	   		 	 	 	     		 	 	 					   						   	 		  			   	  		   		   		 			 		 	  	  	 		 	  	    			  			
// CE0090325B010AAD58F56D41047A666F
double f0_33(int A_cmd_0, int A_magic_4) {
   double Ld_ret_8 = 0;
   for (G_pos_1044 = OrdersTotal() - 1; G_pos_1044 >= 0; G_pos_1044--) {
      OrderSelect(G_pos_1044, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == A_cmd_0 && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == A_magic_4) || (OrderType() == A_cmd_0 && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) Ld_ret_8 += OrderProfit();
   }
   return (Ld_ret_8);
}
	 	 	 				   		 	  	 		 		 	   	   		 				   	 		 		  	 						   	 		   		 		  					    	  	 					 	 			 		 	 		  				  	 	 		 		 	 			 	  	 	 	 
// 259C0804EECE39A685AB1EB75CD249F2
int f0_5(int Ai_0, double A_lots_4, int A_slippage_12, int Ai_16, int Ai_20, string A_comment_24, int A_magic_32, int A_datetime_36, color A_color_40) {
   if (!IsDemo() && AccountName() != AccountName() || AccountNumber() != AccountNumber() && (!IsDemo() && AccountName() != "Andrey Belov" || AccountNumber() != 2845915) && (!IsDemo() &&
      AccountName() != "Andrey Belov" || AccountNumber() != 339956) && (!IsDemo() && AccountName() != "Andrey Belov" || AccountNumber() != 908945) && (!IsDemo() && AccountName() != "Kalitnik Evgeni" ||
      AccountNumber() != 375430) && (!IsDemo() && AccountName() != "Фатеев Михаил Михайлович" || AccountNumber() != 3093858) && (!IsDemo() && AccountName() != "Ivan Glazov" ||
      AccountNumber() != 426169) && (!IsDemo() && AccountName() != "Ivan Glazov" || AccountNumber() != 430811) && (!IsDemo() && AccountName() != "Shevelev Boris Yakovlevich" ||
      AccountNumber() != 711224) && (!IsDemo() && AccountName() != "Belmont corp. Lutskovich Aliaksandr" || AccountNumber() != 5015654) && (!IsDemo() && AccountName() != "Vorontsov Aleksandr" ||
      AccountNumber() != 2734467) && (!IsDemo() && AccountName() != "Vorontsov Aleksandr" || AccountNumber() != 2734468) && (!IsDemo() && AccountName() != "Levashev Sergei" ||
      AccountNumber() != 1706252) && (!IsDemo() && AccountName() != "Arthur Abakumov" || AccountNumber() != 2692669) && (!IsDemo() && AccountName() != "Верещагин Андрей Павлович" ||
      AccountNumber() != 3538049) && (!IsDemo() && AccountName() != "Верещагин Андрей Павлович" || AccountNumber() != 3538053) && (!IsDemo() && AccountName() != "Iurii Nikulin" ||
      AccountNumber() != 8027643) && (!IsDemo() && AccountName() != "Iurii Nikulin" || AccountNumber() != 8027846) && (!IsDemo() && AccountName() != "Иванов Евгений Викторович" ||
      AccountNumber() != 404) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 2863) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 2872) &&
      (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 52426) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 3953890) && (!IsDemo() &&
      AccountName() != "Виктор Коваль" || AccountNumber() != 102948) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 102785) && (!IsDemo() && AccountName() != "Виктор Коваль" ||
      AccountNumber() != 379727) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 5018202) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 5139764) &&
      (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 5140285) && (!IsDemo() && AccountName() != "Виктор Коваль" || AccountNumber() != 5017246) && (!IsDemo() &&
      AccountName() != "Виктор Коваль" || AccountNumber() != 5144934) && (!IsDemo() && AccountName() != "Glazov Ivan" || AccountNumber() != 290196) && (!IsDemo() && AccountName() != "Перехрест Виталий Владимирович" ||
      AccountNumber() != 3546431) && (!IsDemo() && AccountName() != "Shevelev Andrei Borisovich" || AccountNumber() != 911125) && (!IsDemo() && AccountName() != "Shevelev Andrei Borisovich" ||
      AccountNumber() != 1600893)) {
      Print("Dear ", AccountName(), "! ", AccountNumber(), "For acquisition of the working version EA ask to the author: abb1963@yandex.ru");
      return (-1);
   }
   int ticket_44 = 0;
   int error_48 = 0;
   int count_52 = 0;
   int Li_56 = 100;
   switch (Ai_0) {
   case -1:
      return (-1);
   case 0:
      for (count_52 = 0; count_52 < Li_56; count_52++) {
         RefreshRates();
         ticket_44 = OrderSend(Symbol(), OP_BUY, A_lots_4, Ask, A_slippage_12, f0_4(Bid, Ai_16), f0_11(Ask, Ai_20), A_comment_24, A_magic_32, A_datetime_36, A_color_40);
         error_48 = GetLastError();
         if (error_48 == 0/* NO_ERROR */) break;
         if (!((error_48 == 4/* SERVER_BUSY */ || error_48 == 137/* BROKER_BUSY */ || error_48 == 146/* TRADE_CONTEXT_BUSY */ || error_48 == 136/* OFF_QUOTES */))) break;
         Sleep(5000);
      }
      break;
   case 1:
      for (count_52 = 0; count_52 < Li_56; count_52++) {
         ticket_44 = OrderSend(Symbol(), OP_SELL, A_lots_4, Bid, A_slippage_12, f0_20(Ask, Ai_16), f0_37(Bid, Ai_20), A_comment_24, A_magic_32, A_datetime_36, A_color_40);
         error_48 = GetLastError();
         if (error_48 == 0/* NO_ERROR */) break;
         if (!((error_48 == 4/* SERVER_BUSY */ || error_48 == 137/* BROKER_BUSY */ || error_48 == 146/* TRADE_CONTEXT_BUSY */ || error_48 == 136/* OFF_QUOTES */))) break;
         Sleep(5000);
      }
   }
   return (ticket_44);
}
									  	  	 		    	 	    	 	 	  					  	   				  		 	 	 	       		  	   		 		 	  	  		    			     		  						 		 	   					  						 	 		     	 
// 9259C017F5B3042DB913690D06EACE88
void f0_26(int A_cmd_0, int A_magic_4, int Ai_8, double A_pips_12, double A_price_20) {
   int Li_28;
   double Ld_32;
   double price_40;
   double price_48;
   bool bool_56;
   int error_60;
   int Li_64;
   int count_68 = 0;
   if (A_pips_12 != 0.0) {
      for (int pos_72 = OrdersTotal() - 1; pos_72 >= 0; pos_72--) {
         if (OrderSelect(pos_72, SELECT_BY_POS, MODE_TRADES)) {
            if ((OrderType() == A_cmd_0 && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == A_magic_4) || (OrderType() == A_cmd_0 && OrderSymbol() == Symbol() &&
               UseMAGIC == FALSE)) {
               if (OrderType() == OP_BUY) {
                  Li_28 = NormalizeDouble((Bid - A_price_20) / Point / Gi_1036, 0);
                  if (Li_28 < Ai_8) continue;
                  Ld_32 = OrderStopLoss();
                  price_40 = Bid - A_pips_12 * Point * Gi_1036;
                  if (Ld_32 == 0.0 || (Ld_32 != 0.0 && price_40 > Ld_32) || TrailTP == TRUE) {
                     count_68 = 0;
                     while (true) {
                        count_68++;
                        if (TrailTP == TRUE) price_48 = Bid + TakeProfit * Point * Gi_1036;
                        else price_48 = OrderTakeProfit();
                        if (Ld_32 != 0.0 && price_40 < Ld_32) {
                           price_40 = Ld_32;
                           Print("lTrendLong = TRUE, BUY dblNewStopLoss = ", price_40, " dblOrderStopLoss=", Ld_32);
                           Gi_1256 = TRUE;
                        } else Gi_1256 = FALSE;
                        bool_56 = OrderModify(OrderTicket(), A_price_20, price_40, price_48, 0, Aqua);
                        Li_64 = 0;
                        if (bool_56 != TRUE) {
                           error_60 = GetLastError();
                           if (error_60 > 2/* COMMON_ERROR */) Print("OrderModify LastError = ", error_60);
                        } else error_60 = 0;
                        if (error_60 == 129/* INVALID_PRICE */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 135/* PRICE_CHANGED */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 136/* OFF_QUOTES */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 137/* BROKER_BUSY */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 138/* REQUOTE */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 4108/* INVALID_TICKET */) {
                           RefreshRates();
                           Li_64 = 0;
                        }
                        if (Li_64 == 100) continue;
                        break;
                     }
                  }
               }
               if (OrderType() == OP_SELL) {
                  Li_28 = NormalizeDouble((A_price_20 - Ask) / Point / Gi_1036, 0);
                  if (Li_28 < Ai_8) continue;
                  Ld_32 = OrderStopLoss();
                  price_40 = Ask + A_pips_12 * Point * Gi_1036;
                  if (Ld_32 == 0.0 || (Ld_32 != 0.0 && price_40 < Ld_32) || TrailTP == TRUE) {
                     count_68 = 0;
                     while (true) {
                        count_68++;
                        if (TrailTP == TRUE) price_48 = Ask - TakeProfit * Point * Gi_1036;
                        else price_48 = OrderTakeProfit();
                        if (Ld_32 != 0.0 && price_40 > Ld_32) {
                           price_40 = Ld_32;
                           Print("lTrendShort = TRUE, SELL dblNewStopLoss = ", price_40, " dblOrderStopLoss=", Ld_32);
                           Gi_1260 = TRUE;
                        } else Gi_1260 = FALSE;
                        bool_56 = OrderModify(OrderTicket(), A_price_20, price_40, price_48, 0, Red);
                        Li_64 = 0;
                        if (bool_56 != TRUE) {
                           error_60 = GetLastError();
                           if (error_60 > 2/* COMMON_ERROR */) Print("OrderModify LastError = ", error_60);
                        } else error_60 = 0;
                        if (error_60 == 129/* INVALID_PRICE */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 135/* PRICE_CHANGED */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 136/* OFF_QUOTES */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 137/* BROKER_BUSY */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 138/* REQUOTE */) {
                           RefreshRates();
                           Li_64 = 100;
                        }
                        if (error_60 == 4108/* INVALID_TICKET */) {
                           RefreshRates();
                           Li_64 = 0;
                        }
                        if (Li_64 == 100) continue;
                        break;
                     }
                  }
               }
            }
            Sleep(1000);
         }
      }
   }
}
				   		  			  		  		  	   	 		 	     		  								 	   	 	  		       	 	     			 	 	 	 		  		 		   		 	  		   	 		  		 				 							 	  		  				 
// D936BDC31110ED57A162DF84303B5DD4
double f0_34(int A_cmd_0, int A_magic_4) {
   double order_open_price_8;
   int ticket_24;
   double Ld_unused_16 = 0;
   int ticket_28 = 0;
   for (int pos_32 = OrdersTotal() - 1; pos_32 >= 0; pos_32--) {
      OrderSelect(pos_32, SELECT_BY_POS, MODE_TRADES);
      if ((OrderType() == A_cmd_0 && OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == A_magic_4) || (OrderType() == A_cmd_0 && OrderSymbol() == Symbol() &&
         UseMAGIC == FALSE)) {
         ticket_24 = OrderTicket();
         if (ticket_24 > ticket_28) {
            order_open_price_8 = OrderOpenPrice();
            Ld_unused_16 = order_open_price_8;
            ticket_28 = ticket_24;
         }
      }
   }
   return (order_open_price_8);
}
			 		 	         	 	       	 					 			 	      		 			 	    			 	 	  				    					  		 		  	 	   	   	   		 	 		 						 	  		 	 		 		 	    	 	  			
// E0A009F10089DC19433D108300063491
double f0_38(double Ad_0) {
   double Ld_8 = MarketInfo(Symbol(), MODE_MINLOT);
   double Ld_16 = 0;
   if (Ld_8 == 1.0) Ld_16 = 0;
   if (Ld_8 == 0.1) Ld_16 = 1;
   if (Ld_8 == 0.05) Ld_16 = 2;
   if (Ld_8 == 0.01) Ld_16 = 3;
   if (Ld_8 == 0.001) Ld_16 = 4;
   double Ld_ret_24 = MinLot;
   if (MoneyManagement == TRUE) Ld_ret_24 = Ld_8;
   double Ld_32 = AccountEquity();
   double Ld_40 = 1;
   if (AccountLeverage() == 10) Ld_40 = 0.1;
   if (AccountLeverage() == 50) Ld_40 = 0.5;
   if (AccountLeverage() == 100) Ld_40 = 1;
   if (AccountLeverage() == 200) Ld_40 = 2;
   if (AccountLeverage() == 500) Ld_40 = 5;
   if (Ld_16 == 0.0)
      if (MoneyManagement == TRUE) Ld_ret_24 = MathCeil(Ld_32 * Ad_0 / 10000.0 * Ld_40);
   if (Ld_16 == 1.0)
      if (MoneyManagement == TRUE) Ld_ret_24 = MathCeil(Ld_32 * Ad_0 / 10000.0 * Ld_40) / 10.0;
   if (Ld_16 == 2.0)
      if (MoneyManagement == TRUE) Ld_ret_24 = MathCeil(Ld_32 * Ad_0 / 10000.0 * Ld_40) / 50.0;
   if (Ld_16 == 3.0)
      if (MoneyManagement == TRUE) Ld_ret_24 = MathCeil(Ld_32 * Ad_0 / 10000.0 * Ld_40) / 100.0;
   if (Ld_16 == 4.0)
      if (MoneyManagement == TRUE) Ld_ret_24 = MathCeil(Ld_32 * Ad_0 / 10000.0 * Ld_40) / 1000.0;
   if (Ld_ret_24 < Ld_8) Ld_ret_24 = Ld_8;
   return (Ld_ret_24);
}
		  		  	 	    					   		 		 		  					  	 	   	 		 	 	 		  		 		  							 					 	  	 							    	 		        		   	 		 				  	 	 		  	  					  	  
// 1B15837728C0CB4D4B7CA285BDA606B9
void f0_3(string A_name_0, int A_corner_8, int A_x_12, int A_y_16, string A_text_20, int A_fontsize_28, string A_fontname_32, color A_color_40) {
   ObjectDelete(A_name_0);
   ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 1.0);
   ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_8);
   ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_12);
   ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_16);
   ObjectSetText(A_name_0, A_text_20, A_fontsize_28, A_fontname_32, A_color_40);
}
		        	 		 	 					 	  			 	 				      	 			  	 		  	   	 				 		  		  		  	    		 		 					    				  	       		 	 			 	   		  	   	 	 						 	
// 7FD9B179809028DA6169844F92B961CE
int f0_23(double Ad_0) {
   int Li_ret_8 = Gi_660;
   if (Ad_0 > 0.0) Li_ret_8 = Gi_672;
   if (Ad_0 < 0.0) Li_ret_8 = Gi_676;
   return (Li_ret_8);
}
		  					 	   	 				  	 	 		 	 	 								 	    			 	 		 	  		     				  	 				 		  	 	  				  			 		  		    				 	 		   		  	  			  	 	 				   	 
// 5E26A52F312E51EADE5F3EE6A80B5EA9
int f0_15(int Ai_0 = 0) {
   int Li_4 = Year() - MathFloor(Ai_0 / 4);
   Ai_0 = MathMod(Ai_0, 4);
   int Li_8 = Month() - MathMod(Month() + 2, 3) + 3 * Ai_0;
   if (Li_8 < 1) {
      Li_8 += 12;
      Li_4--;
   }
   if (Li_8 > 12) {
      Li_8 -= 12;
      Li_4++;
   }
   return (StrToTime(Li_4 + "-" + Li_8 + "-01"));
}
		 	  		  					  		 			   	 	  				   		  				 	 	  	 	      	  	 	       	    	    	    		 				  	 					  	  				   	   	 	 	 	 	 	 		  		 		 		
// 8A729F392CA03BCF676C04744BE4AB2E
int f0_24(int Ai_0 = 0) {
   for (int Li_ret_4 = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)); TimeDayOfWeek(Li_ret_4) != 1; Li_ret_4 -= 86400) {
   }
   Li_ret_4 += 60 * (60 * (24 * (7 * Ai_0)));
   return (Li_ret_4);
}
	   	 		 		  		   		 		  			   		 			 		 		  	 	   	  	  	 			  					    				  	 	 	      		 			 			 					  	 			  			      		 	    			   		 	 		
// 97B33371DB9421BC085384C5CE31D77C
double f0_27(string As_0 = "", int A_cmd_8 = -1, int A_magic_12 = -1, int Ai_16 = 0) {
   double Ld_ret_20 = 0;
   int hist_total_32 = OrdersHistoryTotal();
   if (As_0 == "0") As_0 = Symbol();
   for (int pos_28 = 0; pos_28 < hist_total_32; pos_28++) {
      if (OrderSelect(pos_28, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderSymbol() == As_0 || As_0 == "" && A_cmd_8 < OP_BUY || OrderType() == A_cmd_8) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (A_magic_12 <= 0 || OrderMagicNumber() == A_magic_12 || OrderMagicNumber() == A_magic_12 + 1)
                  if (Ai_16 < OrderCloseTime()) Ld_ret_20 += OrderProfit() + OrderCommission() + OrderSwap();
            }
         }
      }
   }
   return (Ld_ret_20);
}
		 		 	   		 			 		  			  	     			 	 	   		 	   	    		    		 		 	 	  	  	 	          	 		  		   	  		 	  		 	 		  		 	 	 			   	 					 		  	  	
// 10A3AB1ECBA2B204BC0AA7FDB8382079
void f0_1(string A_name_0, string A_text_8, color A_color_16, int A_x_20, int A_y_24, int A_corner_28, int A_fontsize_32) {
   if (ObjectFind(A_name_0) < 0) ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(A_name_0, A_text_8, A_fontsize_32);
   ObjectSet(A_name_0, OBJPROP_COLOR, A_color_16);
   ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_20);
   ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_24);
   ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_28);
   ObjectSet(A_name_0, OBJPROP_FONTSIZE, A_fontsize_32);
}
		  		    	    	 			   	  		 		 						    	   	  	 	 	 	   		 			 						  					    	 			 			      		    	   		  		 		 		 	  	 	  	  	  	 			  	 	
// 6199BC7318D94D49745FC7ED4CC5E182
void f0_16() {
   string Ls_0;
   string Ls_24;
   int Li_32;
   string Ls_36;
   if (IsDemo()) Ls_0 = "DEMO  ";
   else Ls_0 = "LIVE  ";
   if (!IsDemo()) Gi_708 = Gi_668;
   else Gi_708 = Gi_664;
   string Ls_8 = Ls_0 + AccountNumber() + "   " + AccountServer();
   f0_3("AccountNumber", 0, 5, 12, "" + Ls_8 + "", Gi_656, "Tahoma", Gi_708);
   string Ls_16 = "EDUCATED VERSION";
   if (!IsDemo() && AccountName() == "Andrey Belov" && AccountNumber() == 2729806) Ls_16 = "Licence 0  " + "Andrey Belov";
   if (!IsDemo() && AccountName() == "Andrey Belov" && AccountNumber() == 2845915) Ls_16 = "Licence 0  " + "Andrey Belov";
   if (!IsDemo() && AccountName() == "Andrey Belov" && AccountNumber() == 339956) Ls_16 = "Licence 0  " + "Andrey Belov";
   if (!IsDemo() && AccountName() == "Andrey Belov" && AccountNumber() == 908945) Ls_16 = "Licence 0  " + "Andrey Belov";
   if (!IsDemo() && AccountName() == "Kalitnik Evgeni" && AccountNumber() == 375430) Ls_16 = "Licence 1  " + "Kalitnik Evgeni";
   if (!IsDemo() && AccountName() == "Фатеев Михаил Михайлович" && AccountNumber() == 3093858) Ls_16 = "Licence 2  " + "Фатеев Михаил Михайлович";
   if (!IsDemo() && AccountName() == "Ivan Glazov" && AccountNumber() == 426169) Ls_16 = "Licence 3  " + "Ivan Glazov";
   if (!IsDemo() && AccountName() == "Shevelev Boris Yakovlevich" && AccountNumber() == 711224) Ls_16 = "Licence 4  " + "Shevelev Boris Yakovlevich";
   if (!IsDemo() && AccountName() == "Belmont corp. Lutskovich Aliaksandr" && AccountNumber() == 5015654) Ls_16 = "Licence 5  " + "Belmont corp. Lutskovich Aliaksandr";
   if (!IsDemo() && AccountName() == "Vorontsov Aleksandr" && AccountNumber() == 2734467) Ls_16 = "Licence 6  " + "Vorontsov Aleksandr";
   if (!IsDemo() && AccountName() == "Vorontsov Aleksandr" && AccountNumber() == 2734468) Ls_16 = "Licence 6 " + "Vorontsov Aleksandr";
   if (!IsDemo() && AccountName() == "Levashev Sergei" && AccountNumber() == 1706252) Ls_16 = "Licence 7 " + "Levashev Sergei";
   if (!IsDemo() && AccountName() == "Arthur Abakumov" && AccountNumber() == 2692669) Ls_16 = "Licence 8 " + "Arthur Abakumov";
   if (!IsDemo() && AccountName() == "Верещагин Андрей Павлович" && AccountNumber() == 3538049) Ls_16 = "Licence 9 " + "Верещагин Андрей Павлович";
   if (!IsDemo() && AccountName() == "Верещагин Андрей Павлович" && AccountNumber() == 3538053) Ls_16 = "Licence 9 " + "Верещагин Андрей Павлович";
   if (!IsDemo() && AccountName() == "Iurii Nikulin" && AccountNumber() == 8027643) Ls_16 = "Licence 10 " + "Iurii Nikulin";
   if (!IsDemo() && AccountName() == "Iurii Nikulin" && AccountNumber() == 8027846) Ls_16 = "Licence 10 " + "Iurii Nikulin";
   if (!IsDemo() && AccountName() == "Иванов Евгений Викторович" && AccountNumber() == 404) Ls_16 = "Licence 11 " + "Иванов Евгений Викторович";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 2863) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 2872) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 52426) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 3953890) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 102948) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 102785) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 379727) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 5018202) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 5139764) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 5140285) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 5017246) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Виктор Коваль" && AccountNumber() == 5144934) Ls_16 = "Licence 12 " + "Виктор Коваль";
   if (!IsDemo() && AccountName() == "Glazov Ivan" && AccountNumber() == 290196) Ls_16 = "Licence 3  " + "Glazov Ivan";
   if (!IsDemo() && AccountName() == "Перехрест Виталий Владимирович" && AccountNumber() == 3546431) Ls_16 = "Licence 13 " + "Перехрест Виталий Владимирович";
   if (!IsDemo() && AccountName() == "Ivan Glazov" && AccountNumber() == 430811) Ls_16 = "Licence 3  " + "Ivan Glazov";
   if (!IsDemo() && AccountName() == "Shevelev Andrei Borisovich" && AccountNumber() == 911125) Ls_16 = "Licence 4  " + "Shevelev Andrei Borisovich";
   if (!IsDemo() && AccountName() == "Shevelev Andrei Borisovich" && AccountNumber() == 1600893) Ls_16 = "Licence 4  " + "Shevelev Andrei Borisovich";
   f0_3("Licence", 0, 5, 26, "" + Ls_16 + "", Gi_656, "Tahoma", Gi_708);
   if (OnlyCommentNotTrade != FALSE) {
      Ls_24 = "Expert DISABLED";
      Li_32 = 3937500;
      f0_3("MagicNumber", 0, 5, 40, "" + Ls_24 + "", Gi_656, "Tahoma", Li_32);
   } else {
      Ls_36 = "Only Magic: " + Gi_800 + " / " + Gi_804;
      if (UseMAGIC == FALSE) Ls_36 = "ALL ORDERS WORKING!";
      f0_3("MagicNumber", 0, 5, 40, "" + Ls_36 + "", Gi_656, "Tahoma", Gi_708);
   }
   if (IndicationAll == TRUE) f0_28();
}
			 	 	      			 	 	 			   	    		 		 	      	   			  		  				 		  		  	   		     		   	 	 	 		    	 		 	 	 	 	 						 	 		 		   		 				 	 	 	  	
// 9CDBDC36847236E5672CFFD3FE83CB86
void f0_28() {
   string Ls_64;
   string Ls_72;
   double Ld_84;
   double Ld_92;
   double Ld_372;
   double Ld_380;
   int Li_388;
   string Ls_416;
   int Li_504;
   int str2time_508;
   int Li_512;
   int str2time_516;
   double Ld_520;
   double Ld_528;
   string Ls_536;
   double Ld_544;
   double Ld_552;
   double Ld_560;
   double Ld_568;
   double Ld_576;
   double Ld_584;
   double Ld_592;
   double Ld_600;
   double Ld_608;
   string Ls_616;
   double Ld_628;
   double Ld_636;
   double Ld_644;
   double Ld_652;
   double Ld_660;
   double Ld_668;
   double Ld_676;
   double Ld_684;
   double Ld_692;
   double Ld_700;
   string Ls_708;
   string Ls_716;
   string Ls_724;
   string Ls_732;
   string Ls_740;
   string Ls_748;
   string Ls_756;
   string Ls_764;
   string Ls_772;
   string Ls_780;
   string Ls_788;
   string Ls_796;
   string Ls_804;
   string Ls_812;
   string Ls_820;
   string Ls_828;
   string Ls_836;
   string Ls_844;
   string Ls_852;
   string Ls_860;
   string Ls_868;
   int Li_876;
   int Li_880;
   string Ls_884;
   string Ls_892;
   string dbl2str_900;
   string dbl2str_908;
   string dbl2str_916;
   string dbl2str_924;
   string dbl2str_932;
   int Li_940;
   int Li_944;
   int Li_948;
   string Ls_952;
   string Ls_960;
   string Ls_968;
   int Li_976;
   string Ls_980;
   int Li_988;
   string Ls_992;
   int Li_1000;
   int Li_1004;
   string Ls_1008;
   int Li_1016;
   int Li_1020;
   string Ls_1024;
   int Li_1032;
   int Li_1036;
   string Ls_1040;
   string Ls_1048;
   string Ls_1056;
   double Ld_1064;
   string Ls_1072;
   int Li_1080;
   int Li_1084;
   int Li_0 = 12;
   int Li_4 = Gi_720 + 2;
   string Ls_8 = "Work By Ticks";
   if (WorkByBars == TRUE) Ls_8 = "Work By Bars " + f0_2(0);
   f0_3("WorkByBars", 1, 2, Li_0, "" + Ls_8 + "", Gi_656, "Tahoma", Gi_708);
   string Ls_16 = "";
   Ls_16 = Ls_16 + " MA " + "(" + Period_MA3 + ") ";
   Ls_16 = Ls_16 + f0_2(TimeFrame_MA) + " - " + f0_12(Gi_920) + "";
   int Li_24 = Gi_660;
   if (UseSignal_MA == TRUE) {
      if (Gi_920 == -1) Li_24 = Gi_688;
      else {
         if (Gi_920 == 1) Li_24 = Gi_684;
         else Li_24 = Gi_680;
      }
   }
   Li_0 += Li_4;
   f0_3("TimeFrameMA", 1, 2, Li_0, "" + Ls_16 + "", Gi_656, "Tahoma", Li_24);
   string Ls_28 = "";
   Ls_28 = Ls_28 + Gs_900 + " ";
   Ls_28 = Ls_28 + " RSI " + "(" + Period_RSI + ") " + f0_2(TimeFrame_RSI) + " - " + f0_12(Gi_888) + "";
   int Li_36 = Gi_660;
   if (UseSignal_RSI == TRUE) {
      if (Gi_888 == -1) Li_36 = Gi_688;
      else {
         if (Gi_888 == 1) Li_36 = Gi_684;
         else Li_36 = Gi_680;
      }
      Li_0 += Li_4;
      f0_3("TimeFrameRSI", 1, 2, Li_0, "" + Ls_28 + "", Gi_656, "Tahoma", Li_36);
   }
   string Ls_40 = "";
   Ls_40 = " Bars " + f0_2(TimeFrame_Bars) + " - " + f0_12(Gi_828) + "";
   int Li_48 = Gi_660;
   if (UseSignal_Bars == TRUE) {
      if (Gi_828 == -1) Li_48 = Gi_688;
      else {
         if (Gi_828 == 1) Li_48 = Gi_684;
         else Li_48 = Gi_680;
      }
      Li_0 += Li_4;
      f0_3("TimeFrameBars", 1, 2, Li_0, "" + Ls_40 + "", Gi_656, "Tahoma", Li_48);
   }
   string Ls_52 = "";
   Ls_52 = " AC/AO " + f0_2(TimeFrame_AC_AO) + " - " + f0_12(Gi_848) + "";
   int Li_60 = Gi_660;
   if (UseSignal_AC_AO == TRUE) {
      if (Gi_848 == -1) Li_60 = Gi_688;
      else {
         if (Gi_848 == 1) Li_60 = Gi_684;
         else Li_60 = Gi_680;
      }
      Li_0 += Li_4;
      f0_3("TimeFrameAC_AO", 1, 2, Li_0, "" + Ls_52 + "", Gi_656, "Tahoma", Li_60);
   }
   if (OpenLockPosition == TRUE) {
      Ls_64 = "";
      Ls_64 = "Long LOCK " + Gi_588 + " " + G_ticket_596 + " " + DoubleToStr(G_order_open_price_604, Digits);
      Li_0 += Li_4;
      f0_3("LongLOCK", 1, 2, Li_0, "" + Ls_64 + "", Gi_656, "Tahoma", Gi_660);
      Ls_72 = "";
      Ls_72 = "Short LOCK " + Gi_592 + " " + G_ticket_600 + " " + DoubleToStr(G_order_open_price_612, Digits);
      Li_0 += Li_4;
      f0_3("ShortLOCK", 1, 2, Li_0, "" + Ls_72 + "", Gi_656, "Tahoma", Gi_660);
   }
   int Li_80 = MathLog(1 / MarketInfo(Symbol(), MODE_LOTSTEP)) / MathLog(10);
   double Ld_116 = 0;
   double Ld_124 = 0;
   double Ld_132 = 0;
   double Ld_140 = 0;
   double Ld_148 = 0;
   double Ld_156 = 0;
   int count_164 = 0;
   int count_168 = 0;
   int count_172 = 0;
   int count_176 = 0;
   int count_180 = 0;
   int count_184 = 0;
   double order_open_price_188 = 0;
   double order_open_price_196 = 0;
   double order_open_price_204 = 0;
   double order_open_price_212 = 0;
   double order_open_price_220 = 0;
   double order_open_price_228 = 0;
   double order_open_price_236 = 0;
   double order_open_price_244 = 0;
   double order_open_price_252 = 0;
   double order_open_price_260 = 0;
   double order_open_price_268 = 0;
   double order_open_price_276 = 0;
   double Ld_284 = 0;
   double Ld_292 = 0;
   double Ld_300 = 0;
   int ticket_308 = 0;
   double Ld_312 = 0;
   double Ld_320 = 0;
   double Ld_328 = 0;
   int ticket_336 = 0;
   double tickvalue_340 = MarketInfo(Symbol(), MODE_TICKVALUE);
   for (int pos_348 = 0; pos_348 < OrdersTotal(); pos_348++) {
      if (OrderSelect(pos_348, SELECT_BY_POS, MODE_TRADES)) {
         if ((OrderSymbol() == Symbol() && UseMAGIC == FALSE) || (OrderSymbol() == Symbol() && UseMAGIC == TRUE && OrderMagicNumber() == Gi_804 || OrderMagicNumber() == Gi_800)) {
            if (OrderType() == OP_BUY) {
               count_164++;
               Ld_116 += OrderLots();
               Ld_84 += OrderProfit() + OrderSwap() + OrderCommission();
               if (order_open_price_196 == 0.0) order_open_price_196 = OrderOpenPrice();
               if (order_open_price_188 == 0.0) order_open_price_188 = OrderOpenPrice();
               if (order_open_price_196 > OrderOpenPrice()) order_open_price_196 = OrderOpenPrice();
               if (order_open_price_188 < OrderOpenPrice()) order_open_price_188 = OrderOpenPrice();
               if (Ld_284 == 0.0) {
                  Ld_284 = OrderProfit() + OrderSwap() + OrderCommission();
                  Ld_292 = 100.0 * (Ld_284 / AccountBalance());
                  Ld_300 = 1.0 * ((-Bid) + OrderOpenPrice());
                  ticket_308 = OrderTicket();
               }
               if (Ld_284 > OrderProfit() + OrderSwap() + OrderCommission()) {
                  Ld_284 = OrderProfit() + OrderSwap() + OrderCommission();
                  Ld_292 = 100.0 * (Ld_284 / AccountBalance());
                  Ld_300 = 1.0 * ((-Bid) + OrderOpenPrice());
                  ticket_308 = OrderTicket();
               }
            }
            if (OrderType() == OP_BUYLIMIT) {
               count_172++;
               Ld_132 += OrderLots();
               if (order_open_price_212 == 0.0) order_open_price_212 = OrderOpenPrice();
               if (order_open_price_204 == 0.0) order_open_price_204 = OrderOpenPrice();
               if (order_open_price_212 > OrderOpenPrice()) order_open_price_212 = OrderOpenPrice();
               if (order_open_price_204 < OrderOpenPrice()) order_open_price_204 = OrderOpenPrice();
            }
            if (OrderType() == OP_BUYSTOP) {
               count_180++;
               Ld_148 += OrderLots();
               if (order_open_price_228 == 0.0) order_open_price_228 = OrderOpenPrice();
               if (order_open_price_220 == 0.0) order_open_price_220 = OrderOpenPrice();
               if (order_open_price_228 > OrderOpenPrice()) order_open_price_228 = OrderOpenPrice();
               if (order_open_price_220 < OrderOpenPrice()) order_open_price_220 = OrderOpenPrice();
            }
            if (OrderType() == OP_SELL) {
               count_168++;
               Ld_124 += OrderLots();
               Ld_92 += OrderProfit() + OrderSwap() + OrderCommission();
               if (order_open_price_236 == 0.0) order_open_price_236 = OrderOpenPrice();
               if (order_open_price_244 == 0.0) order_open_price_244 = OrderOpenPrice();
               if (order_open_price_236 < OrderOpenPrice()) order_open_price_236 = OrderOpenPrice();
               if (order_open_price_244 > OrderOpenPrice()) order_open_price_244 = OrderOpenPrice();
               if (Ld_312 == 0.0) {
                  Ld_312 = OrderProfit() + OrderSwap() + OrderCommission();
                  Ld_320 = 100.0 * (Ld_312 / AccountBalance());
                  Ld_328 = OrderOpenPrice() + Ask;
                  ticket_336 = OrderTicket();
               }
               if (Ld_312 > OrderProfit() + OrderSwap() + OrderCommission()) {
                  Ld_312 = OrderProfit() + OrderSwap() + OrderCommission();
                  Ld_320 = 100.0 * (Ld_312 / AccountBalance());
                  Ld_328 = OrderOpenPrice() + Ask;
                  ticket_336 = OrderTicket();
               }
            }
            if (OrderType() == OP_SELLLIMIT) {
               count_176++;
               Ld_140 += OrderLots();
               if (order_open_price_252 == 0.0) order_open_price_252 = OrderOpenPrice();
               if (order_open_price_260 == 0.0) order_open_price_260 = OrderOpenPrice();
               if (order_open_price_252 < OrderOpenPrice()) order_open_price_252 = OrderOpenPrice();
               if (order_open_price_260 > OrderOpenPrice()) order_open_price_260 = OrderOpenPrice();
            }
            if (OrderType() == OP_SELLSTOP) {
               count_184++;
               Ld_156 += OrderLots();
               if (order_open_price_268 == 0.0) order_open_price_268 = OrderOpenPrice();
               if (order_open_price_276 == 0.0) order_open_price_276 = OrderOpenPrice();
               if (order_open_price_268 < OrderOpenPrice()) order_open_price_268 = OrderOpenPrice();
               if (order_open_price_276 > OrderOpenPrice()) order_open_price_276 = OrderOpenPrice();
            }
         }
      }
   }
   double Ld_100 = NormalizeDouble(Ld_84 + Ld_92, 2);
   Ld_116 = NormalizeDouble(Ld_116, Li_80);
   Ld_124 = NormalizeDouble(Ld_124, Li_80);
   double Ld_108 = NormalizeDouble(Ld_116 - Ld_124, Li_80);
   Gd_516 = NormalizeDouble(MathAbs(Ld_108), Li_80);
   if (AccountBalance() + AccountCredit() != 0.0) Gd_524 = 100.0 * ((AccountBalance() + AccountCredit() - AccountEquity()) / (AccountBalance() + AccountCredit()));
   double Ld_352 = f0_10(OP_BUY, Gi_800);
   double Ld_360 = f0_10(OP_SELL, Gi_804);
   if (Gd_524 > Gd_532 && Ld_352 > Ld_360) {
      G_datetime_580 = TimeCurrent();
      Gd_532 = Gd_524;
      if (Ld_352 > Gd_548) Gd_548 = Ld_352;
      if (Gd_516 > Gd_564) Gd_564 = Gd_516;
   }
   if (Gd_524 > Gd_540 && Ld_352 < Ld_360) {
      G_datetime_584 = TimeCurrent();
      Gd_540 = Gd_524;
      if (Ld_360 > Gd_556) Gd_556 = Ld_360;
      if (Gd_516 > Gd_572) Gd_572 = Gd_516;
   }
   int Li_368 = Gi_660;
   G_color_740 = ColorZeroLevel;
   if (Ld_352 > 1.0 || Ld_360 > 1.0) {
      Ld_372 = 0;
      Ld_380 = 0;
      if (Gd_516 > 0.0 && tickvalue_340 != 0.0) {
         Ld_372 = (Gd_756 - Ld_100) / tickvalue_340 / Gd_516;
         Ld_380 = Ld_100 / tickvalue_340 / Gd_516;
      }
      if (Ld_108 > 0.0) Gd_748 = NormalizeDouble(Bid - Ld_380 * Point, Digits);
      else Gd_748 = NormalizeDouble(Ask + Ld_380 * Point, Digits);
   }
   if ((!IsTesting()) || IsVisualMode()) f0_42("LineZL", Gd_748, G_color_740, 0);
   if (Gd_516 > 0.0 && tickvalue_340 != 0.0) Li_388 = NormalizeDouble((AccountEquity() - AccountStopoutLevel() * AccountEquity() / 100.0) / Gd_516 / tickvalue_340, 0);
   Gi_unused_764 = 0;
   if (MoneyManagement == TRUE) Gi_unused_764 = 1;
   string Ls_392 = DoubleToStr(Li_388, 0);
   string Ls_400 = " ";
   string Ls_408 = " ";
   if (Ld_108 != 0.0) {
      Ls_416 = DoubleToStr(MathAbs(Ld_380), 0);
      if (Gi_1036 == 10) Ls_416 = DoubleToStr(MathAbs(Ld_380 / Gi_1036), 1);
      Ls_416 = "Zero Level " + Ls_416 + " pips ";
      if (Ld_108 < 0.0) {
         if (Gi_1036 == 10) Ls_392 = DoubleToStr(Li_388 / Gi_1036, 1);
         Ls_392 = "StopOut Level " + Ls_392 + " pips ";
         Ls_400 = "й";
         Ls_408 = "к";
         if (UseChangeColors == TRUE) Li_368 = Gi_676;
      } else {
         if (Gi_1036 == 10) Ls_392 = DoubleToStr(Li_388 / Gi_1036, 1);
         Ls_392 = "StopOut Level " + Ls_392 + " pips ";
         Ls_400 = "к";
         Ls_408 = "й";
         if (UseChangeColors == TRUE) Li_368 = Gi_676;
      }
   } else {
      if (Ld_116 == 0.0 && Ld_124 == 0.0) {
         Ls_392 = "No orders";
         Ls_400 = "";
         Ls_416 = "";
         Ls_408 = "";
      } else {
         Ls_392 = "Waiting first order...";
         Ls_400 = "";
         Ls_416 = "Placed Lock";
         Ls_408 = "";
      }
   }
   double Ld_424 = NormalizeDouble(AccountBalance(), 0);
   double Ld_432 = NormalizeDouble(AccountEquity(), 0);
   int Li_440 = Gi_660;
   int Li_444 = Gi_660;
   int Li_448 = Gi_656;
   if (UseChangeColors == TRUE) {
      if (Gd_524 > 85.0) {
         Li_440 = 255;
         Li_448 = Gi_656 + 6;
      }
      if (Gd_524 > 70.0 && Gd_524 <= 85.0) {
         Li_440 = 3937500;
         Li_448 = Gi_656 + 5;
      }
      if (Gd_524 > 60.0 && Gd_524 <= 70.0) {
         Li_440 = 17919;
         Li_448 = Gi_656 + 4;
      }
      if (Gd_524 > 30.0 && Gd_524 <= 60.0) {
         Li_440 = 55295;
         Li_448 = Gi_656 + 3;
      }
      if (Gd_524 > 20.0 && Gd_524 <= 30.0) {
         Li_440 = 65535;
         Li_448 = Gi_656 + 2;
      }
      if (Gd_524 > 10.0 && Gd_524 <= 20.0) {
         Li_440 = 12903679;
         Li_448 = Gi_656 + 1;
      }
      if (Gd_524 > 0.0 && Gd_524 <= 10.0) {
         Li_440 = Gi_660;
         Li_448 = Gi_656 + 1;
      }
      if (Gd_524 < 0.0) {
         Li_440 = 65280;
         Li_448 = Gi_656 + 2;
      }
   }
   double Ld_452 = 0;
   double Ld_460 = 0;
   int count_468 = 0;
   int count_472 = 0;
   int hist_total_480 = OrdersHistoryTotal();
   for (int pos_476 = 0; pos_476 < hist_total_480; pos_476++) {
      if (OrderSelect(pos_476, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderType() == 6) {
            if (OrderProfit() > 0.0) {
               Ld_452 += OrderProfit();
               count_468++;
            }
            if (OrderProfit() < 0.0) {
               Ld_460 += OrderProfit();
               count_472++;
            }
         }
      }
   }
   if (IndicationTopLeft == TRUE) {
      for (int Li_484 = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)); TimeDayOfWeek(Li_484) < 1 || TimeDayOfWeek(Li_484) > 5; Li_484 -= 86400) {
      }
      for (int Li_488 = Li_484 - 86400; TimeDayOfWeek(Li_488) < 1 || TimeDayOfWeek(Li_488) > 5; Li_488 -= 86400) {
      }
      for (int Li_492 = Li_488 - 86400; TimeDayOfWeek(Li_492) < 1 || TimeDayOfWeek(Li_492) > 5; Li_492 -= 86400) {
      }
      for (int Li_496 = Li_492 - 86400; TimeDayOfWeek(Li_496) < 1 || TimeDayOfWeek(Li_496) > 5; Li_496 -= 86400) {
      }
      for (int Li_500 = Li_496 - 86400; TimeDayOfWeek(Li_500) < 1 || TimeDayOfWeek(Li_500) > 5; Li_500 -= 86400) {
      }
      Li_504 = f0_24();
      str2time_508 = StrToTime(Year() + "-" + Month() + "-01");
      Li_512 = f0_15();
      str2time_516 = StrToTime(Year() + "-01-01");
      Ld_520 = AccountBalance();
      Ld_528 = AccountProfit();
      if (lCalcCurrentSymbol == TRUE) Ld_528 = Ld_100;
      Ls_536 = "";
      if (lCalcCurrentSymbol == TRUE) Ls_536 = Symbol();
      Ld_544 = f0_27(Ls_536, -1, -1, Li_484);
      Ld_552 = f0_27(Ls_536, -1, -1, Li_488) - Ld_544;
      Ld_560 = f0_27(Ls_536, -1, -1, Li_492) - Ld_552 - Ld_544;
      Ld_568 = f0_27(Ls_536, -1, -1, Li_496) - Ld_560 - Ld_552 - Ld_544;
      Ld_576 = f0_27(Ls_536, -1, -1, Li_500) - Ld_568 - Ld_560 - Ld_552 - Ld_544;
      Ld_584 = f0_27(Ls_536, -1, -1, Li_504);
      Ld_592 = f0_27(Ls_536, -1, -1, str2time_508);
      Ld_600 = f0_27(Ls_536, -1, -1, Li_512);
      Ld_608 = f0_27(Ls_536, -1, -1, str2time_516);
      switch (Gi_712) {
      case 0:
         Ls_616 = "Current Balance";
         break;
      case 1:
         Ld_520 -= Ld_544;
         Ls_616 = "Balance by Day";
         break;
      case 2:
         Ld_520 -= Ld_584;
         Ls_616 = "Balance by Week";
         break;
      case 3:
         Ld_520 -= Ld_592;
         Ls_616 = "Balance by Month";
         break;
      case 4:
         Ld_520 -= Ld_600;
         Ls_616 = "Balance by Quarter";
         break;
      case 5:
         Ld_520 -= Ld_608;
         Ls_616 = "Balance by Year";
         break;
      case 6:
         if (Ld_452 != 0.0) {
            Ld_520 = Ld_452;
            Ls_616 = "Deposit";
         } else {
            Ld_520 -= Ld_608;
            Ls_616 = "Balance by Year";
         }
      }
      if (Ld_520 != 0.0) {
         Ld_628 = 100.0 * Ld_528 / Ld_520;
         Ld_636 = 100.0 * Ld_544 / Ld_520;
         Ld_644 = 100.0 * Ld_552 / Ld_520;
         Ld_652 = 100.0 * Ld_560 / Ld_520;
         Ld_660 = 100.0 * Ld_568 / Ld_520;
         Ld_668 = 100.0 * Ld_576 / Ld_520;
         Ld_676 = 100.0 * Ld_584 / Ld_520;
         Ld_684 = 100.0 * Ld_592 / Ld_520;
         Ld_692 = 100.0 * Ld_600 / Ld_520;
         Ld_700 = 100.0 * Ld_608 / Ld_520;
      }
      if (lCalcCurrentSymbol == TRUE) f0_1("iProfit05", "Profit/Loss for:    " + Ls_536, Gi_660, Gi_724, Gi_716, 0, Gi_656);
      else f0_1("iProfit05", "Profit/Loss for:    All pairs", Gi_660, Gi_724, Gi_716, 0, Gi_656);
      f0_1("iProfit11", "Current P/L", Gi_660, Gi_724, Gi_716 + 1 * Gi_720, 0, Gi_656);
      f0_1("iProfit21", "P/L today", Gi_660, Gi_724, Gi_716 + Gi_720 * 2, 0, Gi_656);
      f0_1("iProfit31", "P/L " + TimeToStr(Li_488, TIME_DATE), Gi_660, Gi_724, Gi_716 + 3 * Gi_720, 0, Gi_656);
      f0_1("iProfit41", "P/L " + TimeToStr(Li_492, TIME_DATE), Gi_660, Gi_724, Gi_716 + Gi_720 * 4, 0, Gi_656);
      f0_1("iProfit51", "P/L " + TimeToStr(Li_496, TIME_DATE), Gi_660, Gi_724, Gi_716 + 5 * Gi_720, 0, Gi_656);
      f0_1("iProfit61", "P/L " + TimeToStr(Li_500, TIME_DATE), Gi_660, Gi_724, Gi_716 + 6 * Gi_720, 0, Gi_656);
      f0_1("iProfit71", "P/L Week", Gi_660, Gi_724, Gi_716 + 7 * Gi_720, 0, Gi_656);
      f0_1("iProfit81", "P/L Month", Gi_660, Gi_724, Gi_716 + Gi_720 * 8, 0, Gi_656);
      f0_1("iProfit91", "P/L Quarter", Gi_660, Gi_724, Gi_716 + 9 * Gi_720, 0, Gi_656);
      f0_1("iProfit01", "P/L Year", Gi_660, Gi_724, Gi_716 + 10 * Gi_720, 0, Gi_656);
      f0_1("iProfit101", "Calculate % of:   " + Ls_616, Gi_660, Gi_724, Gi_716 + 11 * Gi_720, 0, Gi_656);
      f0_1("iProfit13", DoubleToStr(Ld_528, 2), f0_23(Ld_528), Gi_728, Gi_716 + 1 * Gi_720, 0, Gi_656);
      f0_1("iProfit23", DoubleToStr(Ld_544, 2), f0_23(Ld_544), Gi_728, Gi_716 + Gi_720 * 2, 0, Gi_656);
      f0_1("iProfit33", DoubleToStr(Ld_552, 2), f0_23(Ld_552), Gi_728, Gi_716 + 3 * Gi_720, 0, Gi_656);
      f0_1("iProfit43", DoubleToStr(Ld_560, 2), f0_23(Ld_560), Gi_728, Gi_716 + Gi_720 * 4, 0, Gi_656);
      f0_1("iProfit53", DoubleToStr(Ld_568, 2), f0_23(Ld_568), Gi_728, Gi_716 + 5 * Gi_720, 0, Gi_656);
      f0_1("iProfit63", DoubleToStr(Ld_576, 2), f0_23(Ld_576), Gi_728, Gi_716 + 6 * Gi_720, 0, Gi_656);
      f0_1("iProfit73", DoubleToStr(Ld_584, 2), f0_23(Ld_584), Gi_728, Gi_716 + 7 * Gi_720, 0, Gi_656);
      f0_1("iProfit83", DoubleToStr(Ld_592, 2), f0_23(Ld_592), Gi_728, Gi_716 + Gi_720 * 8, 0, Gi_656);
      f0_1("iProfit93", DoubleToStr(Ld_600, 2), f0_23(Ld_600), Gi_728, Gi_716 + 9 * Gi_720, 0, Gi_656);
      f0_1("iProfit03", DoubleToStr(Ld_608, 2), f0_23(Ld_608), Gi_728, Gi_716 + 10 * Gi_720, 0, Gi_656);
      f0_1("iProfit14", DoubleToStr(Ld_628, 2) + " %", f0_23(Ld_628), Gi_732, Gi_716 + 1 * Gi_720, 0, Gi_656);
      f0_1("iProfit24", DoubleToStr(Ld_636, 2) + " %", f0_23(Ld_636), Gi_732, Gi_716 + Gi_720 * 2, 0, Gi_656);
      f0_1("iProfit34", DoubleToStr(Ld_644, 2) + " %", f0_23(Ld_644), Gi_732, Gi_716 + 3 * Gi_720, 0, Gi_656);
      f0_1("iProfit44", DoubleToStr(Ld_652, 2) + " %", f0_23(Ld_652), Gi_732, Gi_716 + Gi_720 * 4, 0, Gi_656);
      f0_1("iProfit54", DoubleToStr(Ld_660, 2) + " %", f0_23(Ld_660), Gi_732, Gi_716 + 5 * Gi_720, 0, Gi_656);
      f0_1("iProfit64", DoubleToStr(Ld_668, 2) + " %", f0_23(Ld_668), Gi_732, Gi_716 + 6 * Gi_720, 0, Gi_656);
      f0_1("iProfit74", DoubleToStr(Ld_676, 2) + " %", f0_23(Ld_676), Gi_732, Gi_716 + 7 * Gi_720, 0, Gi_656);
      f0_1("iProfit84", DoubleToStr(Ld_684, 2) + " %", f0_23(Ld_684), Gi_732, Gi_716 + Gi_720 * 8, 0, Gi_656);
      f0_1("iProfit94", DoubleToStr(Ld_692, 2) + " %", f0_23(Ld_692), Gi_732, Gi_716 + 9 * Gi_720, 0, Gi_656);
      f0_1("iProfit04", DoubleToStr(Ld_700, 2) + " %", f0_23(Ld_700), Gi_732, Gi_716 + 10 * Gi_720, 0, Gi_656);
   }
   if (IndicationBottomLeft == TRUE) {
      Li_0 = 5;
      Ls_708 = "";
      if (count_172 != 0) {
         Ls_708 = Ls_708 + "BL " + count_172 + "  ( " + DoubleToStr(Ld_132, 2) + " )" + "  " + DoubleToStr(order_open_price_212, Digits) + " - " + DoubleToStr(order_open_price_204,
            Digits);
      }
      Ls_716 = "";
      if (count_180 != 0) {
         Ls_716 = Ls_716 + "BS " + count_180 + "  ( " + DoubleToStr(Ld_148, 2) + " )" + "  " + DoubleToStr(order_open_price_228, Digits) + " - " + DoubleToStr(order_open_price_220,
            Digits);
      }
      Ls_724 = "";
      if (count_176 != 0) {
         Ls_724 = Ls_724 + "SL " + count_176 + "  ( " + DoubleToStr(Ld_140, 2) + " )" + "  " + DoubleToStr(order_open_price_260, Digits) + " - " + DoubleToStr(order_open_price_252,
            Digits);
      }
      Ls_732 = "";
      if (count_184 != 0) {
         Ls_732 = Ls_732 + "SS " + count_184 + "  ( " + DoubleToStr(Ld_156, 2) + " )" + "  " + DoubleToStr(order_open_price_276, Digits) + " - " + DoubleToStr(order_open_price_268,
            Digits);
      }
      f0_3("OrdersSELLStop", 2, 5, Li_0, "" + Ls_732 + "", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("OrdersSELLLimit", 2, 5, Li_0, "" + Ls_724 + "", Gi_656, "Tahoma", Gi_660);
      Li_0 = Li_0 + Li_4 + 2;
      f0_3("OrdersBUYStop", 2, 5, Li_0, "" + Ls_716 + "", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("OrdersBUYLimit", 2, 5, Li_0, "" + Ls_708 + "", Gi_656, "Tahoma", Gi_660);
      Li_0 += 6;
      Ls_740 = "Lock Position:  OFF";
      if (OpenLockPosition == TRUE) {
         Ls_740 = "Lock Position:  DD= " + DoubleToStr(SafeEquityRisk, 0) + " % K-t " + DoubleToStr(dKoeffLockPosition, 1);
         Ls_740 = Ls_740 + " SL= " + DoubleToStr(StopLossLock, 0);
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("OpenLockPosition", 2, 5, Li_0, "" + Ls_740 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_748 = "Vagonetka:       OFF";
      if (UseVagonetka == TRUE) {
         Ls_748 = "Vagonetka:         ON  ";
         if (LogicVagonetka == 1) Gs_628 = "Close All Profit= " + DoubleToStr(SaveProfit, 0);
         else {
            if (LogicVagonetka == 2) Gs_628 = "Close B/S Profit= " + DoubleToStr(SaveProfit, 0);
            else
               if (LogicVagonetka == 3) Gs_628 = "Trailing " + DoubleToStr(TrailStart2, 0) + " / " + DoubleToStr(TrailStop2, 0);
         }
         Ls_748 = Ls_748 + Gs_628;
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("Vagonetka", 2, 5, Li_0, "" + Ls_748 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_756 = "CloseAllOrders:  OFF";
      if (CloseAllOrders == TRUE) {
         Ls_756 = "CloseAllOrders:  ON";
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("CloseAllOrders", 2, 5, Li_0, "" + Ls_756 + "", Gi_656, "Tahoma", Gi_676);
      }
      Ls_764 = "AutoModifyTP:    OFF";
      if (AutoModifyTP == TRUE) {
         Ls_764 = "AutoModifyTP:    ON";
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("AutoModifyTP", 2, 5, Li_0, "" + Ls_764 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_772 = "FreezeAfterTP:    OFF";
      if (FreezeAfterTP == TRUE) {
         Ls_772 = "FreezeAfterTP:    ON";
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("FreezeAfterTP", 2, 5, Li_0, "" + Ls_772 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_780 = "ForсeStart:         OFF";
      if (UseForсeStart == TRUE) {
         Ls_780 = "ForсeStart:         ON";
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("ForсeStart", 2, 5, Li_0, "" + Ls_780 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_788 = "SafeEquityRisk:   OFF";
      if (SafeEquityStopOut == TRUE) {
         Ls_788 = "SafeEquityRisk:   " + DoubleToStr(SafeEquityRisk, 0) + " %";
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("SafeEquityRisk", 2, 5, Li_0, "" + Ls_788 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
      Ls_796 = "TrailingStop:       OFF";
      if (UseTrailing == TRUE) {
         Ls_796 = "TrailingStop:       " + DoubleToStr(TrailStart, 0);
         Ls_796 = Ls_796 + " / " + DoubleToStr(TrailStop, 0);
         Li_0 = Li_0 + Li_4 - 1;
         f0_3("UseTrailing", 2, 5, Li_0, "" + Ls_796 + "", Gi_656 - 2, "Tahoma", Gi_660);
      } else Li_0 += Li_4;
      f0_3("UseTrailing", 2, 5, Li_0, "" + Ls_796 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_804 = "Ratio:                OFF";
      if (Grid_Ariphmetic == TRUE) Ls_804 = "Ariphmetic Ratio: " + DoubleToStr(Grid_Ratio, 2);
      else
         if (Grid_Multiplier == TRUE) Ls_804 = "Multiplier Ratio: " + DoubleToStr(Grid_Ratio, 2);
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("Ratio", 2, 5, Li_0, "" + Ls_804 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_812 = "StopLoss:           " + DoubleToStr(StopLoss, 0);
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("StopLoss", 2, 5, Li_0, "" + Ls_812 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_820 = "TakeProfit:         " + DoubleToStr(TakeProfit, 0);
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("TakeProfit", 2, 5, Li_0, "" + Ls_820 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_828 = "StepOrders:       " + DoubleToStr(StepOrders, 0);
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("StepOrders", 2, 5, Li_0, "" + Ls_828 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_836 = "MultiLotsFactor:  " + DoubleToStr(MultiLotsFactor, 2);
      if (MultiLotsFactorExp != 1.0) Ls_836 = Ls_836 + " ( " + DoubleToStr(MultiLotsFactorExp, 2) + " )";
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("MultiLotsFactor", 2, 5, Li_0, "" + Ls_836 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_844 = "";
      Ls_844 = Ls_844 + "MaxOrders:         " + MaxOrders;
      if (MaxOrdersStopNextStep != MaxOrders) Ls_844 = Ls_844 + "  ( " + MaxOrdersStopNextStep + "  Stop )";
      Li_0 = Li_0 + Li_4 - 1;
      f0_3("MaxOrders", 2, 5, Li_0, "" + Ls_844 + "", Gi_656 - 2, "Tahoma", Gi_660);
      Ls_852 = "";
      Ls_852 = Ls_852 + "Risk:   Min  " + DoubleToStr(MinRisk, 1) + " %";
      Ls_852 = Ls_852 + " ( " + DoubleToStr(Gd_1072, 2) + " )";
      Ls_852 = Ls_852 + "  Max  " + DoubleToStr(MaxRisk, 1) + " %";
      Ls_852 = Ls_852 + " ( " + DoubleToStr(Gd_1080, 2) + " )";
      Ls_860 = "";
      Ls_860 = Ls_860 + "Risk Long:  Min  " + DoubleToStr(Gd_940, 1) + " %";
      Ls_860 = Ls_860 + " ( " + DoubleToStr(Gd_1088, 2) + " )";
      Ls_860 = Ls_860 + "  Max  " + DoubleToStr(Gd_948, 1) + " %";
      Ls_860 = Ls_860 + " ( " + DoubleToStr(Gd_1096, 2) + " )";
      Ls_868 = "";
      Ls_868 = Ls_868 + "Risk Short: Min  " + DoubleToStr(Gd_956, 1) + " %";
      Ls_868 = Ls_868 + " ( " + DoubleToStr(Gd_1104, 2) + " )";
      Ls_868 = Ls_868 + "  Max  " + DoubleToStr(Gd_964, 1) + " %";
      Ls_868 = Ls_868 + " ( " + DoubleToStr(Gd_1112, 2) + " )";
      Li_876 = Gi_660;
      Li_880 = Gi_660;
      if (Gd_940 > MinRisk || Gd_948 > MaxRisk) Li_876 = Gi_676;
      if (Gd_956 > MinRisk || Gd_964 > MaxRisk) Li_880 = Gi_676;
      if (Gd_692 != 1.0) {
         Li_0 = Li_0 + Li_4 + 2;
         f0_3("RiskShort", 2, 5, Li_0, "" + Ls_868 + "", Gi_656 - 2, "Tahoma", Li_880);
         Li_0 += Li_4;
         f0_3("RiskLong", 2, 5, Li_0, "" + Ls_860 + "", Gi_656 - 2, "Tahoma", Li_876);
      } else {
         Li_0 = Li_0 + Li_4 + 2;
         f0_3("Risk", 2, 5, Li_0, "" + Ls_852 + "", Gi_656 - 2, "Tahoma", Gi_660);
      }
   }
   if (IndicationTopRight == TRUE) {
      Ls_884 = " (" + count_468 + ")  " + DoubleToStr(Ld_452, 2);
      Ls_892 = " (" + count_472 + ")  " + DoubleToStr(Ld_460, 2);
      dbl2str_900 = DoubleToStr(AccountBalance(), 2);
      dbl2str_908 = DoubleToStr(AccountEquity(), 2);
      dbl2str_916 = DoubleToStr(AccountCredit(), 2);
      dbl2str_924 = DoubleToStr(AccountFreeMargin(), 2);
      dbl2str_932 = DoubleToStr(AccountProfit(), 2);
      Li_940 = Gi_672;
      if (AccountProfit() < 0.0) Li_940 = Gi_676;
      Li_0 = 6 * Li_4 + 5;
      f0_3("Deposit", 1, 5, Li_0, Ls_884 + " - D ", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("Widtrawal", 1, 5, Li_0, Ls_892 + " - W", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("Balance", 1, 5, Li_0, dbl2str_900 + " - B ", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("Equity", 1, 5, Li_0, dbl2str_908 + " - E ", Gi_656, "Tahoma", Gi_660);
      Li_0 += Li_4;
      f0_3("Credit", 1, 5, Li_0, dbl2str_916 + " - Cr", Gi_656, "Credit", Gi_660);
      Li_0 += Li_4;
      f0_3("FreeMargin", 1, 5, Li_0, dbl2str_924 + " - M", Gi_656, "Tahoma", Li_440);
      Li_0 += Li_4;
      f0_3("AccountProfit", 1, 5, Li_0, "" + dbl2str_932 + " - Р/L", Gi_656, "Tahoma", Li_940);
   }
   if (IndicationBottomRight == TRUE) {
      Li_944 = Gi_660;
      Li_948 = Gi_660;
      if (UseChangeColors == TRUE) {
         if (Ld_352 >= 6 * (MaxOrders / 7)) Li_944 = 255;
         if (Ld_352 >= 5 * (MaxOrders / 7) && Ld_352 < 6 * (MaxOrders / 7)) Li_944 = 3937500;
         if (Ld_352 >= MaxOrders / 7 * 4 && Ld_352 < 5 * (MaxOrders / 7)) Li_944 = 17919;
         if (Ld_352 >= 3 * (MaxOrders / 7) && Ld_352 < MaxOrders / 7 * 4) Li_944 = 55295;
         if (Ld_352 >= MaxOrders / 7 * 2 && Ld_352 < 3 * (MaxOrders / 7)) Li_944 = 65535;
         if (Ld_352 >= MaxOrders / 7 && Ld_352 < MaxOrders / 7 * 2) Li_944 = 12903679;
         if (Ld_352 < MaxOrders / 7) Li_944 = Gi_660;
         if (Ld_360 >= 6 * (MaxOrders / 7)) Li_948 = 255;
         if (Ld_360 >= 5 * (MaxOrders / 7) && Ld_360 < 6 * (MaxOrders / 7)) Li_948 = 3937500;
         if (Ld_360 >= MaxOrders / 7 * 4 && Ld_360 < 5 * (MaxOrders / 7)) Li_948 = 17919;
         if (Ld_360 >= 3 * (MaxOrders / 7) && Ld_360 < MaxOrders / 7 * 4) Li_948 = 55295;
         if (Ld_360 >= MaxOrders / 7 * 2 && Ld_360 < 3 * (MaxOrders / 7)) Li_948 = 65535;
         if (Ld_360 >= MaxOrders / 7 && Ld_360 < MaxOrders / 7 * 2) Li_948 = 12903679;
         if (Ld_360 < MaxOrders / 7) Li_948 = Gi_660;
      }
      Li_0 = 5;
      Ls_952 = "";
      Ls_952 = Ls_952 + "SHORT Tr  " + DoubleToStr(Ld_360, 0);
      Ls_952 = Ls_952 + " ( " + DoubleToStr(Ld_124, 2) + " )";
      Ls_952 = Ls_952 + "  Next L  " + DoubleToStr(Gd_1176, 2);
      if (Grid_Ariphmetic + Grid_Multiplier > 0) Ls_952 = Ls_952 + "  St  " + DoubleToStr(Gd_1028, 0);
      f0_3("NextLots", 3, 5, Li_0, "" + Ls_952 + "", Gi_656, "Tahoma", Li_948);
      Li_0 += Li_4;
      Ls_960 = "";
      Ls_960 = Ls_960 + "LONG  Tr  " + DoubleToStr(Ld_352, 0);
      Ls_960 = Ls_960 + " ( " + DoubleToStr(Ld_116, 2) + " )";
      Ls_960 = Ls_960 + "  Next L  " + DoubleToStr(Gd_1168, 2);
      if (Grid_Ariphmetic + Grid_Multiplier > 0) Ls_960 = Ls_960 + "  St  " + DoubleToStr(Gd_1020, 0);
      f0_3("OpenTrades", 3, 5, Li_0, "" + Ls_960 + "", Gi_656, "Tahoma", Li_944);
      Li_4 = 16;
      Li_0 += Li_4;
      Ls_968 = "Profit Long  " + DoubleToStr(Ld_84, 2) + " $";
      Li_976 = Gi_660;
      Ls_980 = "Profit Short " + DoubleToStr(Ld_92, 2) + " $";
      Li_988 = Gi_660;
      if (UseChangeColors == TRUE) {
         if (Ld_84 < 0.0) Li_976 = Gi_676;
         if (Ld_92 < 0.0) Li_988 = Gi_676;
         if (Ld_84 > 0.0) Li_976 = Gi_672;
         if (Ld_92 > 0.0) Li_988 = Gi_672;
      }
      f0_3("OrderProfit_sell", 3, 5, Li_0, Ls_980 + "", Gi_656, "Tahoma", Li_988);
      Li_0 += Li_4;
      f0_3("OrderProfit_buy", 3, 5, Li_0, Ls_968 + "", Gi_656, "Tahoma", Li_976);
      Li_0 += Li_4;
      Ls_992 = "Max Loss Long  ";
      Ls_992 = Ls_992 + DoubleToStr(Ld_284, 2) + "$  " + DoubleToStr(Ld_292, 2) + " %";
      Li_1000 = Gi_660;
      Li_1004 = Gi_656;
      if (UseChangeColors == TRUE) {
         if (Ld_292 < -5.0) {
            Li_1000 = 255;
            Li_1004 = Gi_656 + 6;
         }
         if (Ld_292 >= -5.0 && Ld_292 < -3.0) {
            Li_1000 = 3937500;
            Li_1004 = Gi_656 + 5;
         }
         if (Ld_292 >= -3.0 && Ld_292 < -2.0) {
            Li_1000 = 17919;
            Li_1004 = Gi_656 + 4;
         }
         if (Ld_292 >= -2.0 && Ld_292 < -1.5) {
            Li_1000 = 55295;
            Li_1004 = Gi_656 + 3;
         }
         if (Ld_292 >= -1.5 && Ld_292 < -1.0) {
            Li_1000 = 65535;
            Li_1004 = Gi_656 + 2;
         }
         if (Ld_292 >= -1.0 && Ld_292 < -0.5) {
            Li_1000 = 12903679;
            Li_1004 = Gi_656 + 1;
         }
         if (Ld_292 > -0.5) {
            Li_1000 = Gi_660;
            Li_1004 = Gi_656;
         }
      }
      Ls_1008 = "Max Loss Short ";
      Ls_1008 = Ls_1008 + DoubleToStr(Ld_312, 2) + "$  " + DoubleToStr(Ld_320, 2) + " %";
      Li_1016 = Gi_660;
      Li_1020 = Gi_656;
      if (UseChangeColors == TRUE) {
         if (Ld_320 < -5.0) {
            Li_1016 = 255;
            Li_1020 = Gi_656 + 6;
         }
         if (Ld_320 >= -5.0 && Ld_320 < -3.0) {
            Li_1016 = 3937500;
            Li_1020 = Gi_656 + 5;
         }
         if (Ld_320 >= -3.0 && Ld_320 < -2.0) {
            Li_1016 = 17919;
            Li_1020 = Gi_656 + 4;
         }
         if (Ld_320 >= -2.0 && Ld_320 < -1.5) {
            Li_1016 = 55295;
            Li_1020 = Gi_656 + 3;
         }
         if (Ld_320 >= -1.5 && Ld_320 < -1.0) {
            Li_1016 = 65535;
            Li_1020 = Gi_656 + 2;
         }
         if (Ld_320 >= -1.0 && Ld_320 < -0.5) {
            Li_1016 = 12903679;
            Li_1020 = Gi_656 + 1;
         }
         if (Ld_320 > -0.5) {
            Li_1016 = Gi_660;
            Li_1020 = Gi_656;
         }
      }
      f0_3("MaxLoss_sell", 3, 5, Li_0, Ls_1008 + "", Li_1020, "Tahoma", Li_1016);
      Li_0 += Li_4;
      f0_3("MaxLoss_buy", 3, 5, Li_0, Ls_992 + "", Li_1004, "Tahoma", Li_1000);
      Li_4 = 20;
      Li_0 += Li_4;
      Ls_1024 = "";
      Li_1032 = Gi_660;
      if (UseChangeColors == TRUE) {
         if (Ld_108 == 0.0) Li_1032 = Gi_688;
         else {
            if (Ld_108 > 0.0) Li_1032 = Gi_684;
            else Li_1032 = Gi_680;
         }
      }
      if (Ld_108 == 0.0) Ls_1024 = "BUY = SELL";
      else {
         if (Ld_108 > 0.0) Ls_1024 = "NEEDED SELL   " + DoubleToStr(Ld_108, 2) + "  lots";
         else Ls_1024 = "NEEDED BUY   " + DoubleToStr(-Ld_108, 2) + "  lots";
      }
      f0_3("Needed", 3, 5, Li_0, "" + Ls_1024 + "", Gi_656 + 2, "Tahoma", Li_1032);
      Li_0 = Li_0 + Li_4 + 1;
      Li_1036 = Gi_656;
      if (Gi_1036 == 10) Li_388 /= Gi_1036;
      if (Li_388 > 0 && Li_388 < 50) {
         Li_368 = 255;
         Li_1036 = Gi_656 + 6;
      }
      if (Li_388 >= 50 && Li_388 < 100) {
         Li_368 = 3937500;
         Li_1036 = Gi_656 + 5;
      }
      if (Li_388 >= 100 && Li_388 < 150) {
         Li_368 = 17919;
         Li_1036 = Gi_656 + 4;
      }
      if (Li_388 >= 150 && Li_388 < 200) {
         Li_368 = 4678655;
         Li_1036 = Gi_656 + 3;
      }
      if (Li_388 >= 200 && Li_388 < 300) {
         Li_368 = 4678655;
         Li_1036 = Gi_656 + 2;
      }
      if (Li_388 >= 300 && Li_388 < 400) {
         Li_368 = 4678655;
         Li_1036 = Gi_656 + 1;
      }
      if (Li_388 >= 400) {
         Li_368 = 4678655;
         Li_1036 = Gi_656;
      }
      f0_3("PipsBeforeStopOut", 3, 20, Li_0, "" + Ls_392 + "", Li_1036, "Tahoma", Li_368);
      f0_3("PipsBeforeStopOut2", 3, 5, Li_0 - 2, "" + Ls_400 + "", Gi_656 + 2, "Wingdings", Li_368);
      Li_0 += Li_4;
      f0_3("ZeroLevel", 3, 20, Li_0, "" + Ls_416 + "", Gi_656 - 2, "Tahoma", ColorZeroLevel);
      f0_3("ZeroLevel2", 3, 5, Li_0 - 2, "" + Ls_408 + "", Gi_656 + 2, "Wingdings", ColorZeroLevel);
      Li_0 += 1 * Li_4;
      if (OpenLockPosition == TRUE) {
         Ls_1040 = "";
         Ls_1040 = Ls_1040 + " Max DD " + DoubleToStr(Gd_540, 2) + " % ";
         Ls_1040 = Ls_1040 + " Short " + DoubleToStr(Gd_556, 0);
         Ls_1040 = Ls_1040 + " ( " + DoubleToStr(Gd_572, 2) + " ) ";
         Ls_1040 = Ls_1040 + TimeToStr(G_datetime_584, TIME_DATE);
         Ls_1040 = Ls_1040 + " " + TimeToStr(G_datetime_584, TIME_MINUTES);
         f0_3("DrawDownMaxShort", 3, 5, Li_0, "" + Ls_1040 + "", Gi_656, "Tahoma", Li_444);
         Li_0 += 1 * Li_4;
         Ls_1048 = "";
         Ls_1048 = Ls_1048 + " Max DD " + DoubleToStr(Gd_532, 2) + " % ";
         Ls_1048 = Ls_1048 + " Long " + DoubleToStr(Gd_548, 0);
         Ls_1048 = Ls_1048 + " ( " + DoubleToStr(Gd_564, 2) + " ) ";
         Ls_1048 = Ls_1048 + TimeToStr(G_datetime_580, TIME_DATE);
         Ls_1048 = Ls_1048 + " " + TimeToStr(G_datetime_580, TIME_MINUTES);
         f0_3("DrawDownMaxLong", 3, 5, Li_0, "" + Ls_1048 + "", Gi_656, "Tahoma", Li_444);
         Li_0 += 1 * Li_4;
      }
      Ls_1056 = "";
      if (Gd_524 < 0.0) {
         Ls_1056 = Ls_1056 + " PROFIT  ";
         Ls_1056 = Ls_1056 + DoubleToStr(-Gd_524, 2) + " %";
      } else {
         Ls_1056 = Ls_1056 + " DrawDown  ";
         Ls_1056 = Ls_1056 + DoubleToStr(Gd_524, 2) + " %";
      }
      f0_3("DrawDown", 3, 5, Li_0, "" + Ls_1056 + "", Li_448, "Tahoma", Li_440);
      Ld_1064 = 0;
      if (AccountEquity() - AccountFreeMargin() != 0.0) Ld_1064 = 100.0 * ((AccountEquity() - AccountCredit()) / (AccountEquity() - AccountFreeMargin()));
      Ls_1072 = " Real Free Margin " + DoubleToStr(Ld_1064, 2);
      Li_1080 = Gi_660;
      Li_1084 = Gi_656;
      if (UseChangeColors == TRUE) {
         if (Ld_1064 > 0.0 && Ld_1064 < 50.0) {
            Li_1080 = 255;
            Li_1084 = Gi_656 + 10;
         }
         if (Ld_1064 >= 50.0 && Ld_1064 < 100.0) {
            Li_1080 = 3937500;
            Li_1084 = Gi_656 + 8;
         }
         if (Ld_1064 >= 100.0 && Ld_1064 < 150.0) {
            Li_1080 = 17919;
            Li_1084 = Gi_656 + 6;
         }
         if (Ld_1064 >= 150.0 && Ld_1064 < 200.0) {
            Li_1080 = 55295;
            Li_1084 = Gi_656 + 4;
         }
         if (Ld_1064 >= 200.0 && Ld_1064 < 250.0) {
            Li_1080 = 65535;
            Li_1084 = Gi_656 + 2;
         }
         if (Ld_1064 >= 250.0 && Ld_1064 < 300.0) {
            Li_1080 = 12903679;
            Li_1084 = Gi_656 + 1;
         }
         if (Ld_1064 > 300.0) {
            Li_1080 = 65280;
            Li_1084 = Gi_656;
         }
      }
      Li_0 = Li_0 + Li_4 + 2;
      f0_3("RUM", 3, 5, Li_0, "" + Ls_1072 + " %", Li_1084, "Tahoma", Li_1080);
   }
   double Ld_1088 = f0_38(MinRisk);
   Gd_756 = NormalizeDouble(Ld_1088 * TakeProfit / Gd_1072, 2);
}
		 						 		  	 			   	 	 	  	 	 		 					 		   			   		 	   	     	 		  	 	 		 		    	  			   			 	   		   					 	  	   		 		  			 		 	 			    	 
// FFCAA643B493573EC6A0A6AFE59C37B8
void f0_42(string A_name_0, double A_price_8, color A_color_16, int A_width_20) {
   ObjectDelete(A_name_0);
   ObjectCreate(A_name_0, OBJ_HLINE, 0, 0, A_price_8);
   ObjectSet(A_name_0, OBJPROP_COLOR, A_color_16);
   ObjectSet(A_name_0, OBJPROP_WIDTH, A_width_20);
   ObjectSet(A_name_0, OBJPROP_RAY, FALSE);
}
	    			 		 	 	   			 	  					 		 		 			 		 	  	   				  	 	    				 	   			 	 	 	 			    			 		 				 				   				  	           	      	   			  		
// 8E1F261E75CC5A16E464538B5F856933
void f0_25() {
   Comment("");
   string Ls_0 = "iProfit";
   for (int count_8 = 0; count_8 < 10; count_8++) {
      for (int Li_12 = 1; Li_12 < 8; Li_12++)
         if (ObjectFind(Ls_0 + count_8 + Li_12) >= 0) ObjectDelete(Ls_0 + count_8 + Li_12);
   }
   if (ObjectFind("AccountNumber") >= 0) ObjectDelete("AccountNumber");
   if (ObjectFind("Licence") >= 0) ObjectDelete("Licence");
   if (ObjectFind("iProfit101") >= 0) ObjectDelete("iProfit101");
   if (ObjectFind("DrawDown") >= 0) ObjectDelete("DrawDown");
   if (ObjectFind("DrawDownMaxLong") >= 0) ObjectDelete("DrawDownMaxLong");
   if (ObjectFind("DrawDownMaxShort") >= 0) ObjectDelete("DrawDownMaxShort");
   if (ObjectFind("LongLOCK") >= 0) ObjectDelete("LongLOCK");
   if (ObjectFind("ShortLOCK") >= 0) ObjectDelete("ShortLOCK");
   if (ObjectFind("OpenLockPosition") >= 0) ObjectDelete("OpenLockPosition");
   if (ObjectFind("AccountProfit") >= 0) ObjectDelete("AccountProfit");
   if (ObjectFind("Risk") >= 0) ObjectDelete("Risk");
   if (ObjectFind("RiskLong") >= 0) ObjectDelete("RiskLong");
   if (ObjectFind("RiskShort") >= 0) ObjectDelete("RiskShort");
   if (ObjectFind("NextLots") >= 0) ObjectDelete("NextLots");
   if (ObjectFind("OpenTrades") >= 0) ObjectDelete("OpenTrades");
   if (ObjectFind("MagicNumber") >= 0) ObjectDelete("MagicNumber");
   if (ObjectFind("MagicNumberShort") >= 0) ObjectDelete("MagicNumberShort");
   if (ObjectFind("TradeComment") >= 0) ObjectDelete("TradeComment");
   if (ObjectFind("RUM") >= 0) ObjectDelete("RUM");
   if (ObjectFind("MaxLoss_sell") >= 0) ObjectDelete("MaxLoss_sell");
   if (ObjectFind("MaxLoss_buy") >= 0) ObjectDelete("MaxLoss_buy");
   if (ObjectFind("MaxOrders") >= 0) ObjectDelete("MaxOrders");
   if (ObjectFind("MultiLotsFactor") >= 0) ObjectDelete("MultiLotsFactor");
   if (ObjectFind("StepOrders") >= 0) ObjectDelete("StepOrders");
   if (ObjectFind("TakeProfit") >= 0) ObjectDelete("TakeProfit");
   if (ObjectFind("StopLoss") >= 0) ObjectDelete("StopLoss");
   if (ObjectFind("Deposit") >= 0) ObjectDelete("Deposit");
   if (ObjectFind("Widtrawal") >= 0) ObjectDelete("Widtrawal");
   if (ObjectFind("Balance") >= 0) ObjectDelete("Balance");
   if (ObjectFind("Equity") >= 0) ObjectDelete("Equity");
   if (ObjectFind("Credit") >= 0) ObjectDelete("Credit");
   if (ObjectFind("FreeMargin") >= 0) ObjectDelete("FreeMargin");
   if (ObjectFind("Needed") >= 0) ObjectDelete("Needed");
   if (ObjectFind("TotalBUY") >= 0) ObjectDelete("TotalBUY");
   if (ObjectFind("TotalSELL") >= 0) ObjectDelete("TotalSELL");
   if (ObjectFind("OrderProfit_buy") >= 0) ObjectDelete("OrderProfit_buy");
   if (ObjectFind("OrderProfit_sell") >= 0) ObjectDelete("OrderProfit_sell");
   if (ObjectFind("Ratio") >= 0) ObjectDelete("Ratio");
   if (ObjectFind("UseTrailing") >= 0) ObjectDelete("UseTrailing");
   if (ObjectFind("SafeEquityRisk") >= 0) ObjectDelete("SafeEquityRisk");
   if (ObjectFind("ForсeStart") >= 0) ObjectDelete("ForсeStart");
   if (ObjectFind("FreezeAfterTP") >= 0) ObjectDelete("FreezeAfterTP");
   if (ObjectFind("CloseAllOrders") >= 0) ObjectDelete("CloseAllOrders");
   if (ObjectFind("AutoModifyTP") >= 0) ObjectDelete("AutoModifyTP");
   if (ObjectFind("OrdersBUYLimit") >= 0) ObjectDelete("OrdersBUYLimit");
   if (ObjectFind("OrdersBUYStop") >= 0) ObjectDelete("OrdersBUYStop");
   if (ObjectFind("OrdersSELLLimit") >= 0) ObjectDelete("OrdersSELLLimit");
   if (ObjectFind("OrdersSELLStop") >= 0) ObjectDelete("OrdersSELLStop");
   if (ObjectFind("WorkByBars") >= 0) ObjectDelete("WorkByBars");
   if (ObjectFind("TimeFrameBars") >= 0) ObjectDelete("TimeFrameBars");
   if (ObjectFind("TimeFrameAC_AO") >= 0) ObjectDelete("TimeFrameAC_AO");
   if (ObjectFind("TimeFrameMA") >= 0) ObjectDelete("TimeFrameMA");
   if (ObjectFind("TimeFrameRSI") >= 0) ObjectDelete("TimeFrameRSI");
   if (ObjectFind("TimeFrameCCI") >= 0) ObjectDelete("TimeFrameCCI");
   if (ObjectFind("LineTP") >= 0) ObjectDelete("LineTP");
   if (ObjectFind("LineZL") >= 0) ObjectDelete("LineZL");
   if (ObjectFind("PipsBeforeStopOut") >= 0) ObjectDelete("PipsBeforeStopOut");
   if (ObjectFind("PipsBeforeStopOut2") >= 0) ObjectDelete("PipsBeforeStopOut2");
   if (ObjectFind("ZeroLevel") >= 0) ObjectDelete("ZeroLevel");
   if (ObjectFind("ZeroLevel2") >= 0) ObjectDelete("ZeroLevel2");
   if (ObjectFind("Vagonetka") >= 0) ObjectDelete("Vagonetka");
   if (ObjectFind("SaveProfit") >= 0) ObjectDelete("SaveProfit");
   if (ObjectFind("LogicVagonetka") >= 0) ObjectDelete("LogicVagonetka");
   if (ObjectFind("OrdersVagonetka") >= 0) ObjectDelete("OrdersVagonetka");
}
	 	   	  	  				   					 	 		   	  	  	  	  		    			 		 			 	 			 	   	 	 	     				  	   				  	 				 			   	 	 		 	 	  	  	    	  			   			  	
// 4D38720114D7F1EF5AD9903121DEFF2A
string f0_12(int Ai_0) {
   string Ls_ret_4 = " UNKNOWN ";
   if (Ai_0 == -1) Ls_ret_4 = " N/A  ";
   if (Ai_0 == 0) Ls_ret_4 = " BUY  ";
   if (Ai_0 == 2) Ls_ret_4 = " BL ";
   if (Ai_0 == 4) Ls_ret_4 = " BS ";
   if (Ai_0 == 1) Ls_ret_4 = " SELL ";
   if (Ai_0 == 3) Ls_ret_4 = " SL ";
   if (Ai_0 == 5) Ls_ret_4 = " SS ";
   if (Ai_0 == -2) Ls_ret_4 = " SLEEP ";
   return (Ls_ret_4);
}
		 		 		  		 		  		  		   	    				 	 		  		 	 	 	    	     		  	 	 	     	 	  	         		  			  	  				  		 				  		   	 			 	 	 				  		  	 		
// 13355A7642AB8F27ACE9B8939EC5DF48
string f0_2(int Ai_0) {
   string Ls_ret_4 = " UNKNOWN ";
   if (Ai_0 == 0) Ls_ret_4 = " Current ";
   if (Ai_0 == 1) Ls_ret_4 = "   M1 ";
   if (Ai_0 == 5) Ls_ret_4 = "   M5 ";
   if (Ai_0 == 15) Ls_ret_4 = " M15 ";
   if (Ai_0 == 30) Ls_ret_4 = " M30 ";
   if (Ai_0 == 60) Ls_ret_4 = "   H1 ";
   if (Ai_0 == 240) Ls_ret_4 = "   H4 ";
   if (Ai_0 == 1440) Ls_ret_4 = "   D1 ";
   if (Ai_0 == 10080) Ls_ret_4 = "   W1 ";
   if (Ai_0 == 43200) Ls_ret_4 = "   MN ";
   return (Ls_ret_4);
}
	      				 		  	 				  					 		  		   				 					  		   		 	 		  			  	 				  				 		 	 	 				 							 	 	     	   	 		 	    				    	  	 						 
// 28E40C77B3BBC288F914557C556E99A1
string f0_7(int Ai_0) {
   string Ls_unused_4;
   return (StringTrimRight(StringTrimLeft(f0_2(Ai_0))));
}
					 		   	 		  	   		        			  	 		   	 	 	 		   	   	 		  	   	       	  	  	      	   			     				 			 					 		   					 	 						  	   	 		
// 7EE79B12E123DDF668F0A56D69FB80FE
int f0_22() {
   if (LogicVagonetka == 3 && Gi_1216 < OrdersVagonetka && Gi_1220 < OrdersVagonetka) {
      TrailStart = Gd_640;
      TrailStop = Gd_648;
      if (G_bool_636 == FALSE) UseTrailing = FALSE;
   }
   if (LogicVagonetka == 1) f0_35();
   if (LogicVagonetka == 2) {
      if (Gi_1216 >= OrdersVagonetka) f0_41();
      if (Gi_1220 >= OrdersVagonetka) f0_0();
   }
   if (LogicVagonetka == 3) {
      if (Gi_1216 >= OrdersVagonetka) f0_21();
      if (Gi_1220 >= OrdersVagonetka) f0_32();
   }
   return (0);
}
			 			       		 	 	  		   	 	  		 				          			 			  			  		  			 	   			    		 	 	 	 	  	    	  	 	 	 			 					  	 		 	    		 	 		 	 	    	
// DE2001BB450D9B894B453C9C6918AF8B
int f0_35() {
   Gd_1184 = f0_33(OP_BUY, Gi_800);
   Gd_1192 = f0_33(OP_SELL, Gi_804);
   if (Gd_1184 + Gd_1192 >= SaveProfit && LogicVagonetka == 1 && Gi_1216 >= OrdersVagonetka || Gi_1220 >= OrdersVagonetka) f0_17();
   return (0);
}
	  			  				   		 	    				  		   	 		  				  	 	    	 			  	 		 		 							 			 		   				 	     			      	 			      	 			  		 	 	  		  		 	   	  
// F87F6767037CEA698CADEEF70C7B8AE9
int f0_41() {
   int is_closed_0;
   double bid_4;
   int Li_16;
   int Li_20;
   int cmd_12 = 0;
   Gd_1184 = f0_33(OP_BUY, Gi_800);
   if (Gd_1184 >= SaveProfit && LogicVagonetka == 2 && Gi_1216 >= OrdersVagonetka) {
      for (int order_total_24 = OrdersTotal(); order_total_24 >= 0; order_total_24--) {
         OrderSelect(order_total_24, SELECT_BY_POS);
         cmd_12 = OrderType();
         while (true) {
            RefreshRates();
            if (cmd_12 != OP_BUY) break;
            bid_4 = Bid;
            is_closed_0 = OrderClose(OrderTicket(), OrderLots(), bid_4, 2, Green);
            Li_20 = 0;
            if (Li_16 == 129) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 135) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 136) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 137) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 138) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 4108) {
               RefreshRates();
               Li_20 = 0;
            }
            if (Li_16 == 1) {
               RefreshRates();
               Li_20 = 0;
            }
            if (Li_20 == 100 && OrdersTotal() >= 1) continue;
            break;
         }
      }
   }
   return (0);
}
	 	  	  		  	  		  		  			 				    	 	  		  	 	 	 				 					  		 	 	 					 	 		 									  		   		 		    		  	    		  			 	   	 	 	    		  		 	  
// 0E7B02971F7A12CF02DEC73E2F9EEAC1
int f0_0() {
   int is_closed_0;
   double ask_4;
   int Li_16;
   int Li_20;
   int cmd_12 = 0;
   Gd_1192 = f0_33(OP_SELL, Gi_804);
   if (Gd_1192 >= SaveProfit && LogicVagonetka == 2 && Gi_1220 >= OrdersVagonetka) {
      for (int order_total_24 = OrdersTotal(); order_total_24 >= 0; order_total_24--) {
         OrderSelect(order_total_24, SELECT_BY_POS);
         cmd_12 = OrderType();
         while (true) {
            RefreshRates();
            if (cmd_12 != OP_SELL) break;
            ask_4 = Ask;
            is_closed_0 = OrderClose(OrderTicket(), OrderLots(), ask_4, 2, Red);
            Li_20 = 0;
            if (Li_16 == 129) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 135) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 136) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 137) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 138) {
               RefreshRates();
               Li_20 = 100;
            }
            if (Li_16 == 4108) {
               RefreshRates();
               Li_20 = 0;
            }
            if (Li_16 == 1) {
               RefreshRates();
               Li_20 = 0;
            }
            if (Li_20 == 100 && OrdersTotal() >= 1) continue;
            break;
         }
      }
   }
   return (0);
}
			   			   			 		 				 	  		  	 	 	  			   		 						 	 	 		 	     	    	  	   		 			   		 						  					  	   		 			 	  			  	 				  		 		 			 	 
// 7D74D81F546A6F8248AC4D6D0BF01E51
int f0_21() {
   Gd_1184 = f0_33(OP_BUY, Gi_800);
   if (Gd_1184 >= SaveProfit && LogicVagonetka == 3 && Gi_1216 >= OrdersVagonetka) {
      TrailStart = TrailStart2;
      TrailStop = TrailStop2;
      if (UseTrailing == FALSE) UseTrailing = TRUE;
   }
   return (0);
}
	  	 		  				 		  	 	 		 		 		  	 	  		  				       				 	     				  	 	 		  	   	  		 	  	 	 	  		 	 	 		 	 		 	      	   	       	  		  	 	   	
// B7D00F2BA0BD1CAD3F7A67B1A6D9F275
int f0_32() {
   Gd_1192 = f0_33(OP_SELL, Gi_804);
   if (Gd_1192 >= SaveProfit && LogicVagonetka == 3 && Gi_1220 >= OrdersVagonetka) {
      TrailStart = TrailStart2;
      TrailStop = TrailStop2;
      if (UseTrailing == FALSE) UseTrailing = TRUE;
   }
   return (0);
}
			  	 		   	   		 		   	  					 	 	 	 		   	 								  	 		  	    	 		 	  	 				 					 		 		  		  		  	  	  	 	 			  	 			   					     		 		 		 
// 560DBD5642FF49864B7495B9F356DD4C
void f0_13() {
   int ticket_28;
   color color_32;
   string Ls_36;
   double Ld_unused_0 = 0;
   double Ld_8 = MathMax(100.0 * ((AccountBalance() - AccountEquity()) / (AccountBalance() + AccountCredit())), 0);
   double Ld_16 = 0;
   if (AccountProfit() < 0.0 && Ld_8 > SafeEquityRisk) {
      for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
         if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == Gi_800 || OrderMagicNumber() == Gi_804) {
               if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
                  if (OrderProfit() + OrderSwap() < 0.0) {
                     if (OrderType() == OP_BUY) Ld_16 = OrderOpenPrice() - Ask;
                     if (OrderType() == OP_SELL) Ld_16 = Bid - OrderOpenPrice();
                     if (Gi_512 == 1 || Ld_16 >= G_pips_620 * Point) {
                        Ld_8 = MathMax(100.0 * ((AccountBalance() - AccountEquity()) / (AccountBalance() + AccountCredit())), 0);
                        if (Gi_512 == 1 || (AccountProfit() < 0.0 && Ld_8 > SafeEquityRisk)) {
                           Print("dMaxRelativeDrawDown = ", DoubleToStr(Ld_8, 2), " Order Profit+Swap=", OrderProfit() + OrderSwap(), " Equity=", AccountEquity(), " Balance=" + DoubleToStr(AccountBalance(),
                              2));
                           ticket_28 = OrderTicket();
                           Ld_unused_0 = 0;
                           if (OrderType() == OP_BUY) Ld_unused_0 = Bid;
                           else
                              if (OrderType() == OP_SELL) Ld_unused_0 = Ask;
                           color_32 = Blue;
                           if (OrderType() == OP_SELL) color_32 = Red;
                           if (!OrderClose(ticket_28, OrderLots(), OrderClosePrice(), 5, color_32)) {
                              Print("Error OrderClose() ticket= ", ticket_28, " err= ", GetLastError());
                              continue;
                           }
                           if (GetLastError() > 1/* NO_RESULT */) {
                              Ls_36 = "Close by dMaxRelativeDrawDown " + ticket_28 + " Priсe= " + DoubleToStr(OrderOpenPrice(), Digits) + " ClosePriсe= " + DoubleToStr(OrderClosePrice(), Digits) + " Profit+Swap= " + DoubleToStr(OrderProfit() + OrderSwap(),
                                 2) + " Balance= " + DoubleToStr(AccountBalance(), 2) + " FreeMargin= " + DoubleToStr(AccountFreeMargin(), 2);
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
}