Navigation:Home > Content >

GPSForexRobotEURUSDv2.mq4

Time: 2016-04-14 | Download file:GPSForexRobotEURUSDv2.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.438.4 [-]
   Website: https://purebeam.biz
   E-mail : [email protected]
*/
#property copyright "Copyright © 2010, GPSForexRobot.com"
#property link      "http://gpsforexrobot.com/"

#import "GPSForexRobotEURUSDv2.dll"
   int GPSForexRobot(double& a0[], string a1, string a2, int a3, int a4, string a5);
   int GetGMT();
#import

extern string GPSForexRobotEURUSDv2 = " ";
extern string ____Authentication____ = "---------------------------------------------";
extern string EMail = "";
extern string CBReceipt = "";
extern string ____Size_Of_Lots____ = "---------------------------------------------";
extern bool UseMM = FALSE;
extern double Lots = 0.01;
extern double LotsRiskReductor = 10.0;
double gd_136 = 1000.0;
extern string ____Trading_Days____ = "---------------------------------------------";
extern bool AutoAnalysis = TRUE;
extern bool GPSEU_TradeMonday = TRUE;
extern bool GPSEU_TradeTuesday = TRUE;
extern bool GPSEU_TradeWednesday = TRUE;
extern bool GPSEU_TradeThursday = TRUE;
extern bool GPSEU_TradeFriday = TRUE;
extern string ____General_Options____ = "---------------------------------------------";
extern bool AutoGMTOffset = TRUE;
extern int GMTOffset = 1;
extern bool StealthMode = TRUE;
extern int Slippage = 2;
bool gi_200 = TRUE;
double gd_204 = 11.4;
double gd_212 = 15.8;
int gi_220 = 8;
int gi_224 = 0;
int gi_228 = -1;
int gi_232 = 0;
extern int GPSEU_MagicNumber = 20100106;
extern string __Recovery_Trade_Options__ = "---------------------------------------------";
extern bool GPSEU_UseRevAfterSL = TRUE;
double gd_252 = 14.3;
double gd_260 = 26.2;
extern double GPSEU_RevAfterSL_Multiplier = 5.9;
extern int GPSEU_RevAfterSL_MagNumber = 20100156;
extern string ____Trailing_Stop____ = "---------------------------------------------";
extern bool GPSEU_UseTrailingStop = FALSE;
extern double GPSEU_TrailingDistance = 6.0;
extern double GPSEU_TrailingStep = 1.0;
bool gi_308 = FALSE;
double gd_312 = 0.0;
double gd_320 = 0.0;
string gs_328 = "---------------------------------------------";
bool gi_336 = FALSE;
extern string ____Others____ = "---------------------------------------------";
extern string ExpertComment = "GPSForexRobotEURUSDv2";
extern color ColorBuy = Blue;
extern color ColorSell = Red;
extern bool SendEmail = FALSE;
extern bool SoundAlert = FALSE;
extern string SoundFileAtOpen = "alert.wav";
extern string SoundFileAtClose = "alert.wav";
extern bool WriteLog = FALSE;
extern bool WriteDebugLog = FALSE;
bool gi_396 = TRUE;
int gi_400 = 2;
int gi_404 = 1;
string gs_408 = "New Trade Information";
string gs_416 = "New Trade Information";
bool gi_424;
int gi_428;
int gi_432;
int gi_436;
double gd_440;
double gd_448;
double gd_456;
int gi_464;
int gi_472;
double gd_476;
double gd_484;
double gd_492;
double gd_500;
double gd_508;
double gd_516;
string gs_524;
string gs_532;
string gs_540;
int gi_548;
int gi_556;
bool gba_560[1];
double gda_564[1];
double gda_568[1];
int gia_572[1];
int gia_576[1];
bool gba_580[1][5];
int gia_584[1];
int gia_588[1];
int gia_592[1];
bool gba_596[1];
double gda_600[1];
double gda_604[1];
double gda_608[1];
int gia_612[1];
bool gba_616[1];
double gda_620[1];
double gda_624[1];
int gia_628[1][5];
double gda_632[1][5];
double gda_636[1][5];
bool gba_640[1];
double gda_644[1];
double gda_648[1];
double gda_652[1];
double gda_656[1];
bool gba_660[1];
bool gi_664;
bool gi_668;
int gi_672 = 0;
bool gi_676 = FALSE;
int gi_680 = 0;
double gda_684[26] = {0};
string gs_688 = "";
string gs_696 = "";
string gs_704 = "";
bool gi_712 = FALSE;

int init() {
   gi_668 = TRUE;
   if (!IsDllsAllowed()) {
      Alert("WARNING: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.");
      f0_8("WARNING: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.", "comment");
      gi_668 = FALSE;
      return (0);
   }
   if (StringSubstr(Symbol(), 0, 6) != "EURUSD") {
      Alert("WARNING: Use GPS Forex Robot EURUSD only on EURUSD pair.");
      f0_8("WARNING: Use GPS Forex Robot EURUSD only on EURUSD pair.", "comment");
      gi_668 = FALSE;
      return (0);
   }
   if (IsTesting()) {
      if (AutoGMTOffset) {
         f0_8("WARNING: Automatic GMT offset calculation works only on live/demo trading " + "and should be set as FALSE for backtests - strategy testing.", "comment");
         gi_668 = FALSE;
         return (0);
      }
   }
   if (!UseMM)
      if (Lots > AccountBalance() / 100.0 / 100.0) Alert("WARNING: For every $100 of your account balance you should use a 0.01 lot size value. It is dangerous if you set too large a lot size value for your account balance. If you still want to trade with such a lot size, click OK.");
   if (WriteDebugLog) {
      WriteLog = TRUE;
      Print("*************************** Initialization ***************************");
   }
   gs_524 = Symbol();
   gd_476 = MarketInfo(gs_524, MODE_MAXLOT);
   gd_484 = MarketInfo(gs_524, MODE_MINLOT);
   gd_508 = MarketInfo(gs_524, MODE_LOTSTEP);
   gd_440 = 12.5;
   if (gd_508 == 0.01) gi_428 = 2;
   else {
      if (gd_508 == 0.1) gi_428 = 1;
      else {
         if (gd_508 == 1.0) gi_428 = 0;
         else {
            if (gd_508 == 0.001) gi_428 = 3;
            else gi_428 = 4;
         }
      }
   }
   double ld_0 = AccountLeverage();
   gd_516 = NormalizeDouble(LotsRiskReductor * (100 / ld_0), 2);
   gd_456 = 1605680.72 * gd_440;
   gs_532 = AccountCurrency();
   gi_424 = IsTesting();
   gs_540 = DoubleToStr(gd_456, 0);
   if (Digits < 4) {
      gd_448 = 0.01;
      gi_432 = 2;
   } else {
      gd_448 = 0.0001;
      gi_432 = 4;
   }
   int li_8 = MathPow(10, Digits - gi_432);
   gi_436 = Slippage * li_8;
   gi_464 = StrToInteger(StringSubstr(gs_540, 0, 4));
   gd_492 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_432);
   gd_500 = gd_492;
   if (IsTesting()) {
      f0_13();
      if (gi_672 != 1) {
         f0_1();
         gi_668 = FALSE;
         return (0);
      }
   }
   gi_664 = TRUE;
   f0_8("Waiting for tick.");
   return (0);
}

int deinit() {
   if (WriteDebugLog) Print("************************** Deinitialization **************************");
   return (0);
}

int start() {
   int li_24;
   double ld_32;
   if (!gi_668) return (0);
   int li_0 = TimeCurrent();
   if (!IsTesting()) {
      if (gi_664) {
         if (AutoGMTOffset) {
            if (f0_6(GMTOffset)) gs_688 = GMTOffset + " (automatic)";
            else gs_688 = "Error";
         } else gs_688 = GMTOffset + " (manual)";
         f0_13();
         gi_676 = TRUE;
         gi_680 = li_0;
         gi_664 = FALSE;
      }
      if (gi_676 == TRUE && gi_680 < li_0 - 60) {
         gi_676 = FALSE;
         gi_680 = li_0 + 60 * (300 - f0_2(120));
      }
      if (gi_676 == FALSE && li_0 >= gi_680) {
         gi_676 = TRUE;
         f0_13();
      }
      f0_1();
   }
   if (gi_672 != 1) return (0);
   gd_492 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_432);
   if (gd_492 > gd_500) gd_500 = gd_492;
   int li_4 = TimeCurrent();
   int li_8 = li_4 - 3600 * GMTOffset;
   gi_548 = TimeYear(TimeCurrent());
   int li_12 = TimeDayOfWeek(li_4);
   int li_16 = iTime(NULL, PERIOD_D1, 0);
   for (int li_20 = 0; li_20 < 1; li_20++) {
      if (gba_560[li_20]) {
         if (!StealthMode) {
            f0_7(li_20, 0);
            if (gba_596[li_20]) f0_7(li_20, 1);
         }
         if (gba_616[li_20]) {
            li_24 = OrdersTotal();
            for (int li_28 = 0; li_28 <= li_24; li_28++) {
               if (OrderSelect(li_28, SELECT_BY_POS, MODE_TRADES))
                  if (OrderMagicNumber() == gia_588[li_20]) f0_3(OrderTicket(), li_20, 0);
            }
         }
         if (gba_640[li_20] && gba_596[li_20]) {
            li_24 = OrdersTotal();
            for (li_28 = 0; li_28 <= li_24; li_28++) {
               if (OrderSelect(li_28, SELECT_BY_POS, MODE_TRADES))
                  if (OrderMagicNumber() == gia_612[li_20]) f0_3(OrderTicket(), li_20, 1);
            }
         }
         f0_10(li_20, 0);
         if (gba_596[li_20]) f0_10(li_20, 1);
         if (gba_596[li_20])
            if (f0_9(-2, gia_612[li_20], li_16) == 0) f0_5(li_20);
         if (li_12 <= 0 || li_12 > 5) continue;
         gi_556 = TimeDay(TimeCurrent());
         if ((gba_580[li_20][li_12 - 1])) {
            if (gia_572[li_20] != TimeHour(li_4) || gia_576[li_20] != TimeMinute(li_4)) continue;
            if (f0_9(-2, gia_588[li_20], li_16) <= 0) {
               if (f0_9(-1, gia_588[li_20], li_16, gd_440) <= 0) {
                  ld_32 = f0_18(gia_592[li_20]);
                  if (gia_584[li_20] >= 0)
                     if (li_12 == gia_584[li_20]) ld_32 = NormalizeDouble(2.0 * ld_32, gi_428);
                  if ((gba_660[li_20] && f0_19()) || (!gba_660[li_20])) f0_4(li_20, 0, gia_592[li_20], gia_588[li_20], ExpertComment, ld_32);
               }
            }
         }
      }
   }
   return (0);
}

string f0_16(int ai_0) {
   string ls_8;
   switch (ai_0) {
   case 0:
   case 1:
      ls_8 = "no error";
      break;
   case 2:
      ls_8 = "common error";
      break;
   case 3:
      ls_8 = "invalid trade parameters";
      break;
   case 4:
      ls_8 = "trade server is busy";
      break;
   case 5:
      ls_8 = "old version of the client terminal";
      break;
   case 6:
      ls_8 = "no connection with trade server";
      break;
   case 7:
      ls_8 = "not enough rights";
      break;
   case 8:
      ls_8 = "too frequent requests";
      break;
   case 9:
      ls_8 = "malfunctional trade operation (never returned error)";
      break;
   case 64:
      ls_8 = "account disabled";
      break;
   case 65:
      ls_8 = "invalid account";
      break;
   case 128:
      ls_8 = "trade timeout";
      break;
   case 129:
      ls_8 = "invalid price";
      break;
   case 130:
      ls_8 = "invalid stops";
      break;
   case 131:
      ls_8 = "invalid trade volume";
      break;
   case 132:
      ls_8 = "market is closed";
      break;
   case 133:
      ls_8 = "trade is disabled";
      break;
   case 134:
      ls_8 = "not enough money";
      break;
   case 135:
      ls_8 = "price changed";
      break;
   case 136:
      ls_8 = "off quotes";
      break;
   case 137:
      ls_8 = "broker is busy (never returned error)";
      break;
   case 138:
      ls_8 = "requote";
      break;
   case 139:
      ls_8 = "order is locked";
      break;
   case 140:
      ls_8 = "long positions only allowed";
      break;
   case 141:
      ls_8 = "too many requests";
      break;
   case 145:
      ls_8 = "modification denied because order too close to market";
      break;
   case 146:
      ls_8 = "trade context is busy";
      break;
   case 147:
      ls_8 = "expirations are denied by broker";
      break;
   case 148:
      ls_8 = "amount of open and pending orders has reached the limit";
      break;
   case 149:
      ls_8 = "hedging is prohibited";
      break;
   case 150:
      ls_8 = "prohibited by FIFO rules";
      break;
   case 4000:
      ls_8 = "no error (never generated code)";
      break;
   case 4001:
      ls_8 = "wrong function pointer";
      break;
   case 4002:
      ls_8 = "array index is out of range";
      break;
   case 4003:
      ls_8 = "no memory for function call stack";
      break;
   case 4004:
      ls_8 = "recursive stack overflow";
      break;
   case 4005:
      ls_8 = "not enough stack for parameter";
      break;
   case 4006:
      ls_8 = "no memory for parameter string";
      break;
   case 4007:
      ls_8 = "no memory for temp string";
      break;
   case 4008:
      ls_8 = "not initialized string";
      break;
   case 4009:
      ls_8 = "not initialized string in array";
      break;
   case 4010:
      ls_8 = "no memory for array\' string";
      break;
   case 4011:
      ls_8 = "too long string";
      break;
   case 4012:
      ls_8 = "remainder from zero divide";
      break;
   case 4013:
      ls_8 = "zero divide";
      break;
   case 4014:
      ls_8 = "unknown command";
      break;
   case 4015:
      ls_8 = "wrong jump (never generated error)";
      break;
   case 4016:
      ls_8 = "not initialized array";
      break;
   case 4017:
      ls_8 = "dll calls are not allowed";
      break;
   case 4018:
      ls_8 = "cannot load library";
      break;
   case 4019:
      ls_8 = "cannot call function";
      break;
   case 4020:
      ls_8 = "expert function calls are not allowed";
      break;
   case 4021:
      ls_8 = "not enough memory for temp string returned from function";
      break;
   case 4022:
      ls_8 = "system is busy (never generated error)";
      break;
   case 4050:
      ls_8 = "invalid function parameters count";
      break;
   case 4051:
      ls_8 = "invalid function parameter value";
      break;
   case 4052:
      ls_8 = "string function internal error";
      break;
   case 4053:
      ls_8 = "some array error";
      break;
   case 4054:
      ls_8 = "incorrect series array using";
      break;
   case 4055:
      ls_8 = "custom indicator error";
      break;
   case 4056:
      ls_8 = "arrays are incompatible";
      break;
   case 4057:
      ls_8 = "global variables processing error";
      break;
   case 4058:
      ls_8 = "global variable not found";
      break;
   case 4059:
      ls_8 = "function is not allowed in testing mode";
      break;
   case 4060:
      ls_8 = "function is not confirmed";
      break;
   case 4061:
      ls_8 = "send mail error";
      break;
   case 4062:
      ls_8 = "string parameter expected";
      break;
   case 4063:
      ls_8 = "integer parameter expected";
      break;
   case 4064:
      ls_8 = "double parameter expected";
      break;
   case 4065:
      ls_8 = "array as parameter expected";
      break;
   case 4066:
      ls_8 = "requested history data in update state";
      break;
   case 4099:
      ls_8 = "end of file";
      break;
   case 4100:
      ls_8 = "some file error";
      break;
   case 4101:
      ls_8 = "wrong file name";
      break;
   case 4102:
      ls_8 = "too many opened files";
      break;
   case 4103:
      ls_8 = "cannot open file";
      break;
   case 4104:
      ls_8 = "incompatible access to a file";
      break;
   case 4105:
      ls_8 = "no order selected";
      break;
   case 4106:
      ls_8 = "unknown symbol";
      break;
   case 4107:
      ls_8 = "invalid price parameter for trade function";
      break;
   case 4108:
      ls_8 = "invalid ticket";
      break;
   case 4109:
      ls_8 = "trade is not allowed in the expert properties";
      break;
   case 4110:
      ls_8 = "longs are not allowed in the expert properties";
      break;
   case 4111:
      ls_8 = "shorts are not allowed in the expert properties";
      break;
   case 4200:
      ls_8 = "object is already exist";
      break;
   case 4201:
      ls_8 = "unknown object property";
      break;
   case 4202:
      ls_8 = "object is not exist";
      break;
   case 4203:
      ls_8 = "unknown object type";
      break;
   case 4204:
      ls_8 = "no object name";
      break;
   case 4205:
      ls_8 = "object coordinates error";
      break;
   case 4206:
      ls_8 = "no specified subwindow";
      break;
   default:
      ls_8 = "unknown error";
   }
   return (ls_8);
}

string f0_20(int ai_0) {
   string ls_8;
   switch (ai_0) {
   case 0:
      ls_8 = "Buy";
      break;
   case 1:
      ls_8 = "Sell";
      break;
   case 2:
      ls_8 = "BuyLimit";
      break;
   case 3:
      ls_8 = "SellLimit";
      break;
   case 4:
      ls_8 = "BuyStop";
      break;
   case 5:
      ls_8 = "SellStop";
      break;
   default:
      ls_8 = "Unknown";
   }
   return (ls_8);
}

int f0_17(int ai_0) {
   ai_0 += GMTOffset;
   while (true) {
      if (ai_0 >= 24) {
         ai_0 -= 24;
         continue;
      }
      if (ai_0 >= 0) break;
      ai_0 += 24;
   }
   gi_472 = StrToInteger(StringSubstr(gs_540, 6, 2));
   return (ai_0);
}

void f0_7(int ai_0, int ai_4) {
   double ld_8;
   double ld_16;
   double ld_24;
   int li_48;
   double ld_52;
   double ld_60;
   double ld_68;
   double ld_76;
   bool li_84;
   double ld_88;
   bool li_96;
   double ld_100;
   bool li_108;
   if (ai_4 == 0) {
      ld_8 = gda_568[ai_0];
      ld_16 = gda_564[ai_0];
      ld_24 = gia_588[ai_0];
   } else {
      ld_8 = gda_604[ai_0];
      ld_16 = gda_600[ai_0];
      ld_24 = gia_612[ai_0];
   }
   double ld_32 = NormalizeDouble(MarketInfo(gs_524, MODE_STOPLEVEL) * Point, Digits);
   int li_40 = OrdersTotal() - 1;
   for (int li_44 = li_40; li_44 >= 0; li_44--) {
      if (!OrderSelect(li_44, SELECT_BY_POS, MODE_TRADES)) {
         if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderSelect() error = ", f0_16(GetLastError())));
      } else {
         if (OrderMagicNumber() == ld_24) {
            if (OrderSymbol() == gs_524) {
               li_48 = OrderType();
               ld_52 = NormalizeDouble(OrderClosePrice(), Digits);
               ld_60 = NormalizeDouble(OrderOpenPrice(), Digits);
               if (li_48 > OP_SELL)
                  if (NormalizeDouble(MathAbs(ld_60 - ld_52), Digits) <= ld_32) continue;
               ld_68 = NormalizeDouble(OrderStopLoss(), Digits);
               ld_76 = NormalizeDouble(OrderTakeProfit(), Digits);
               li_84 = FALSE;
               if (ld_68 == 0.0) {
                  if (ld_16 < 0.0) {
                     if (li_48 % 2 == 0) {
                        ld_88 = NormalizeDouble(ld_60 + ld_16, Digits);
                        if (NormalizeDouble(ld_52 - ld_88, Digits) > ld_32) li_84 = TRUE;
                        else ld_88 = ld_68;
                     } else {
                        ld_88 = NormalizeDouble(ld_60 - ld_16, Digits);
                        if (NormalizeDouble(ld_88 - ld_52, Digits) > ld_32) li_84 = TRUE;
                        else ld_88 = ld_68;
                     }
                  } else ld_88 = ld_68;
               } else ld_88 = ld_68;
               li_96 = FALSE;
               if (ld_76 == 0.0 && (!gba_616[ai_0] && ai_4 == 0) || (!gba_640[ai_0] && ai_4 == 1) || (gba_616[ai_0] && gda_620[ai_0] < ld_8) || (gba_640[ai_0] && gda_644[ai_0] < ld_8)) {
                  if (ld_8 > 0.0) {
                     if (li_48 % 2 == 0) {
                        ld_100 = NormalizeDouble(ld_60 + ld_8, Digits);
                        if (NormalizeDouble(ld_100 - ld_52, Digits) > ld_32) li_96 = TRUE;
                        else ld_100 = ld_76;
                     } else {
                        ld_100 = NormalizeDouble(ld_60 - ld_8, Digits);
                        if (NormalizeDouble(ld_52 - ld_100, Digits) > ld_32) li_96 = TRUE;
                        else ld_100 = ld_76;
                     }
                  } else ld_100 = ld_76;
               } else ld_100 = ld_76;
               if (li_84 || li_96 || (gba_616[ai_0] && ai_4 == 0) || (gba_640[ai_0] && ai_4 == 1)) {
                  while (!IsTradeAllowed()) Sleep(1000);
                  if (NormalizeDouble(OrderStopLoss(), Digits) != ld_88 || NormalizeDouble(OrderTakeProfit(), Digits) != ld_100) {
                     li_108 = OrderModify(OrderTicket(), ld_60, ld_88, ld_100, 0, CLR_NONE);
                     if (!li_108)
                        if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderModify(", f0_20(OrderType()), ") error = ", f0_16(GetLastError())));
                  }
               }
            }
         }
      }
   }
}

void f0_10(int ai_0, int ai_4) {
   double ld_16;
   double ld_24;
   double ld_32;
   double ld_40;
   double ld_48;
   int li_56;
   double ld_60;
   double ld_68;
   double ld_76;
   int li_8 = OrdersTotal() - 1;
   for (int li_12 = li_8; li_12 >= 0; li_12--) {
      if (!OrderSelect(li_12, SELECT_BY_POS, MODE_TRADES)) {
         if (WriteLog) Print(StringConcatenate("WatchOrderLevels: OrderSelect() error = ", f0_16(GetLastError())));
      } else {
         if (ai_4 == 0) {
            ld_16 = gda_568[ai_0];
            ld_24 = gda_564[ai_0];
            ld_32 = gia_588[ai_0];
            ld_40 = 0;
            ld_48 = 0;
            if (gba_616[ai_0]) {
               if (gda_620[ai_0] >= ld_16) ld_16 = 0;
               li_56 = f0_11(ai_0, OrderTicket());
               if (StealthMode && gda_632[ai_0][li_56] != 0.0) {
                  ld_24 = 0;
                  ld_40 = gda_632[ai_0][li_56];
                  ld_48 = gda_636[ai_0][li_56];
               }
            }
         } else {
            ld_16 = gda_604[ai_0];
            ld_24 = gda_600[ai_0];
            ld_32 = gia_612[ai_0];
            ld_40 = 0;
            ld_48 = 0;
            if (gba_640[ai_0]) {
               if (gda_644[ai_0] >= ld_16) ld_16 = 0;
               if (StealthMode && gda_652[ai_0] != 0.0) {
                  ld_24 = 0;
                  ld_40 = gda_652[ai_0];
                  ld_48 = gda_656[ai_0];
               }
            }
         }
         if (ld_16 <= 0.0 && ld_24 >= 0.0 && ld_48 == 0.0) break;
         if (OrderMagicNumber() == ld_32) {
            if (OrderType() <= OP_SELL) {
               if (OrderSymbol() == gs_524) {
                  ld_60 = NormalizeDouble(OrderClosePrice(), Digits);
                  ld_68 = NormalizeDouble(OrderOpenPrice(), Digits);
                  if (OrderType() == OP_BUY) {
                     ld_76 = NormalizeDouble(ld_60 - ld_68, Digits);
                     if (!((ld_16 > 0.0 && ld_76 >= ld_16) || (ld_24 < 0.0 && ld_76 <= ld_24) || (ld_48 != 0.0 && ld_76 <= ld_48))) continue;
                     if (WriteLog) Print("WatchOrderLevels: level for close BUY");
                     f0_15(OrderTicket(), OrderLots(), 0, gi_436);
                     if (ai_4 == 0) {
                        f0_0(ai_0, OrderTicket());
                        gda_632[ai_0][li_56] = 0;
                        gda_636[ai_0][li_56] = 0;
                        continue;
                     }
                     gda_652[ai_0] = 0;
                     gda_656[ai_0] = 0;
                     continue;
                  }
                  ld_76 = NormalizeDouble(ld_68 - ld_60, Digits);
                  if ((ld_16 > 0.0 && ld_76 >= ld_16) || (ld_24 < 0.0 && ld_76 <= ld_24) || (ld_48 != 0.0 && ld_76 <= ld_48)) {
                     if (WriteLog) Print("WatchOrderLevels: level for close SELL");
                     f0_15(OrderTicket(), OrderLots(), 1, gi_436);
                     if (ai_4 == 0) {
                        f0_0(ai_0, OrderTicket());
                        gda_632[ai_0][li_56] = 0;
                        gda_636[ai_0][li_56] = 0;
                        continue;
                     }
                     gda_652[ai_0] = 0;
                     gda_656[ai_0] = 0;
                  }
               }
            }
         }
      }
   }
}

double f0_18(int ai_0) {
   double ld_4;
   double ld_12;
   double ld_20;
   if (!UseMM) ld_4 = Lots;
   else {
      ld_12 = AccountFreeMargin() * gd_516 / 100.0;
      ld_20 = MarketInfo(gs_524, MODE_MARGINREQUIRED) * gd_508;
      ld_4 = NormalizeDouble(MathFloor(ld_12 / ld_20) * gd_508, gi_428);
   }
   if (ld_4 > gd_136) ld_4 = gd_136;
   if (ld_4 < gd_484) ld_4 = gd_484;
   if (ld_4 > gd_476) ld_4 = gd_476;
   return (ld_4);
}

int f0_4(int ai_0, int ai_4, int ai_8, int ai_12, string as_16, double ad_24, double ad_32 = 0.0) {
   color li_44;
   int li_80;
   int li_84;
   double ld_88;
   if (ai_8 > OP_SELL && ad_32 == 0.0) return (-1);
   int li_40 = ai_8 % 2;
   if (ad_24 < gd_484) ad_24 = gd_484;
   else
      if (ad_24 > gd_476) ad_24 = gd_476;
   if (AccountFreeMarginCheck(gs_524, li_40, ad_24) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) {
      if (!(WriteLog)) return (-1);
      Print("OpenOrder: you don\'t have free margin.");
      return (-1);
   }
   if (li_40 == OP_BUY) li_44 = ColorBuy;
   else li_44 = ColorSell;
   RefreshRates();
   double ld_48 = NormalizeDouble(MarketInfo(gs_524, MODE_STOPLEVEL) * Point, Digits);
   double ld_56 = NormalizeDouble(Ask, Digits);
   double ld_64 = NormalizeDouble(Bid, Digits);
   switch (ai_8) {
   case OP_BUY:
      ad_32 = ld_56;
      break;
   case OP_SELL:
      ad_32 = ld_64;
      break;
   case OP_BUYLIMIT:
      if (ad_32 >= ld_56) {
         ad_32 = ld_56;
         ai_8 = 0;
      } else
         if (NormalizeDouble(ld_56 - ad_32, Digits) < ld_48) return (-1);
      break;
   case OP_SELLLIMIT:
      if (ad_32 <= ld_64) {
         ad_32 = ld_64;
         ai_8 = 1;
      } else
         if (NormalizeDouble(ad_32 - ld_64, Digits) < ld_48) return (-1);
      break;
   case OP_BUYSTOP:
      if (ad_32 <= ld_56) {
         ad_32 = ld_56;
         ai_8 = 0;
      } else
         if (NormalizeDouble(ad_32 - ld_56, Digits) < ld_48) return (-1);
      break;
   case OP_SELLSTOP:
      if (ad_32 >= ld_64) {
         ad_32 = ld_64;
         ai_8 = 1;
      } else
         if (NormalizeDouble(ld_64 - ad_32, Digits) < ld_48) return (-1);
      break;
   default:
      return (-1);
   }
   int li_76 = gi_400;
   while (li_76 > 0) {
      while (!IsTradeAllowed()) Sleep(1000);
      li_80 = OrderSend(gs_524, ai_8, ad_24, ad_32, gi_436, 0, 0, as_16, ai_12, 0, li_44);
      Sleep(MathRand() / 1000);
      if (li_80 < 0) {
         li_84 = GetLastError();
         if (WriteLog) {
            Print("OpenOrder: OrderSend(", f0_20(ai_8), ") error = ", f0_16(li_84));
            Print("OpenOrder: order ", gs_524, " ", f0_20(ai_8), " lot = ", DoubleToStr(ad_24, 8), " op = ", DoubleToStr(ad_32, 8), " slippage = ", gi_436);
         }
         if (li_84 != 136/* OFF_QUOTES */) break;
         if (!(gi_396)) break;
         Sleep(6000);
         RefreshRates();
         if (ai_8 == OP_BUY) ld_88 = NormalizeDouble(Ask, Digits);
         else ld_88 = NormalizeDouble(Bid, Digits);
         if (NormalizeDouble(MathAbs((ld_88 - ad_32) / gd_448), 0) > gi_404) break;
         ad_32 = ld_88;
         li_76--;
         if (li_76 > 0)
            if (WriteLog) Print("... Possible to open order.");
         ad_24 = NormalizeDouble(ad_24 / 2.0, gi_428);
         if (ad_24 < gd_484) ad_24 = gd_484;
      } else {
         if (OrderSelect(li_80, SELECT_BY_TICKET)) ad_32 = OrderOpenPrice();
         if (SendEmail) {
            SendMail(gs_416, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(gs_524, 0, 6), 
               "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), 
               "\nOrder Type: ", f0_20(ai_8), 
               "\nPrice: ", DoubleToStr(ad_32, Digits), 
               "\nLot size: ", DoubleToStr(ad_24, gi_428), 
               "\nEvent: Trade Opened", 
               "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_532, 
            "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_532));
         }
         if (!(SoundAlert)) break;
         PlaySound(SoundFileAtOpen);
         break;
      }
   }
   if (ai_4 == 0) f0_12(ai_0, li_80);
   return (li_80);
}

int f0_15(int ai_0, double ad_4, int ai_12, int ai_16) {
   color li_20;
   double ld_40;
   bool li_48;
   int li_52;
   bool li_56;
   if (ai_12 == 0) li_20 = ColorBuy;
   else li_20 = ColorSell;
   int li_24 = 0;
   int li_28 = 0;
   int li_32 = 0;
   int li_36 = 0;
   while (true) {
      while (!IsTradeAllowed()) Sleep(1000);
      RefreshRates();
      if (ai_12 == 0) ld_40 = NormalizeDouble(Bid, Digits);
      else ld_40 = NormalizeDouble(Ask, Digits);
      li_48 = OrderClose(ai_0, ad_4, ld_40, ai_16, li_20);
      if (!li_48) {
         li_52 = GetLastError();
         if (WriteLog) Print(StringConcatenate("OrderClose(", f0_20(ai_12), ",", DoubleToStr(ai_0, 0), ") error = ", f0_16(li_52)));
         li_56 = FALSE;
         switch (li_52) {
         case 0/* NO_ERROR */:
            Sleep(10000);
            if (!(OrderSelect(ai_0, SELECT_BY_TICKET))) break;
            if (OrderCloseTime() != 0) break;
            li_56 = TRUE;
            break;
         case 1/* NO_RESULT */: break;
         case 2/* COMMON_ERROR */: break;
         case 3/* INVALID_TRADE_PARAMETERS */: break;
         case 4/* SERVER_BUSY */: break;
         case 5/* OLD_VERSION */: break;
         case 6/* NO_CONNECTION */:
            Sleep(10000);
            if (!(IsConnected())) break;
            li_56 = TRUE;
            break;
         case 7/* NOT_ENOUGH_RIGHTS */: break;
         case 8/* TOO_FREQUENT_REQUESTS */: break;
         case 9/* MALFUNCTIONAL_TRADE */: break;
         case 64/* ACCOUNT_DISABLED */: break;
         case 65/* INVALID_ACCOUNT */: break;
         case 128/* TRADE_TIMEOUT */:
            Sleep(70000);
            if (!(OrderSelect(ai_0, SELECT_BY_TICKET))) break;
            if (OrderCloseTime() != 0) break;
            li_56 = TRUE;
            break;
         case 129/* INVALID_PRICE */:
            Sleep(6000);
            li_24++;
            if (li_24 > 3) break;
            li_56 = TRUE;
            break;
         case 130/* INVALID_STOPS */:
            Sleep(6000);
            li_28++;
            if (li_28 > 3) break;
            li_56 = TRUE;
            break;
         case 131/* INVALID_TRADE_VOLUME */: break;
         case 132/* MARKET_CLOSED */: break;
         case 133/* TRADE_DISABLED */: break;
         case 134/* NOT_ENOUGH_MONEY */: break;
         case 135/* PRICE_CHANGED */:
            li_56 = TRUE;
            break;
         case 136/* OFF_QUOTES */:
            Sleep(6000);
            li_56 = TRUE;
            break;
         case 137/* BROKER_BUSY */:
            Sleep(20000);
            li_32++;
            if (li_32 > 3) break;
            li_56 = TRUE;
            break;
         case 138/* REQUOTE */:
            li_36++;
            if (li_36 > 3) break;
            li_56 = TRUE;
            break;
         case 139/* ORDER_LOCKED */: break;
         case 140/* LONG_POSITIONS_ONLY_ALLOWED */: break;
         case 141/* TOO_MANY_REQUESTS */: break;
         case 142:
            Sleep(70000);
            if (!(OrderSelect(ai_0, SELECT_BY_TICKET))) break;
            if (OrderCloseTime() != 0) break;
            li_56 = TRUE;
            break;
         case 143:
            Sleep(70000);
            if (!(OrderSelect(ai_0, SELECT_BY_TICKET))) break;
            if (OrderCloseTime() != 0) break;
            li_56 = TRUE;
            break;
         case 144: break;
         case 145/* TRADE_MODIFY_DENIED */:
            Sleep(20000);
            li_56 = TRUE;
            break;
         case 146/* TRADE_CONTEXT_BUSY */:
            while (IsTradeContextBusy()) Sleep(1000);
            li_56 = TRUE;
            break;
         case 147/* TRADE_EXPIRATION_DENIED */: break;
         case 148/* TRADE_TOO_MANY_ORDERS */: break;
         case 149/* TRADE_HEDGE_PROHIBITED */: break;
         case 150/* TRADE_PROHIBITED_BY_FIFO */: break;
         case 4000/* NO_MQLERROR */:
            Sleep(10000);
            if (!(OrderSelect(ai_0, SELECT_BY_TICKET))) break;
            if (OrderCloseTime() != 0) break;
            li_56 = TRUE;
         case 4051/* INVALID_FUNCTION_PARAMETER_VALUE */: break;
         case 4062/* STRING_PARAMETER_EXPECTED */: break;
         case 4063/* INTEGER_PARAMETER_EXPECTED */: break;
         case 4064/* DOUBLE_PARAMETER_EXPECTED */: break;
         case 4105/* NO_ORDER_SELECTED */: break;
         case 4106/* UNKNOWN_SYMBOL */: break;
         case 4107/* INVALID_PRICE_PARAM */: break;
         case 4108/* INVALID_TICKET */: break;
         case 4109/* TRADE_NOT_ALLOWED */: break;
         case 4110/* LONGS__NOT_ALLOWED */: break;
         case 4111/* SHORTS_NOT_ALLOWED */: break;
         }
         if (!(li_56)) break;
         continue;
      }
      if (OrderSelect(ai_0, SELECT_BY_TICKET)) ld_40 = OrderClosePrice();
      if (SendEmail) {
         SendMail(gs_416, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(gs_524, 0, 6), 
            "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), 
            "\nOrder Type: ", f0_20(ai_12), 
            "\nPrice: ", DoubleToStr(ld_40, Digits), 
            "\nLot size: ", DoubleToStr(ad_4, gi_428), 
            "\nEvent: Trade Closed", 
            "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_532, 
         "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_532));
      }
      if (!(SoundAlert)) break;
      PlaySound(SoundFileAtClose);
      break;
   }
   return (li_48);
}

int f0_9(int ai_0, int ai_4, int ai_8, double ad_12 = 0.0) {
   int li_28;
   int li_32;
   int li_40;
   int li_20 = 0;
   int li_24 = OrdersTotal() - 1;
   if (ad_12 == gd_440) {
      if (gi_548 < gi_464) return (1);
      if (gi_548 != gi_464) return (0);
      li_28 = StrToInteger(StringSubstr(gs_540, 4, 2));
      li_32 = TimeMonth(TimeCurrent());
      if (li_32 < li_28) return (1);
      if (li_32 != li_28) return (0);
      if (gi_556 < gi_472) return (1);
      return (0);
   }
   for (int li_36 = li_24; li_36 >= 0; li_36--) {
      if (!OrderSelect(li_36, SELECT_BY_POS, MODE_TRADES)) {
         if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect() error = ", f0_16(GetLastError())));
      } else {
         if (OrderMagicNumber() == ai_4) {
            if (OrderSymbol() == gs_524) {
               li_40 = OrderType();
               if (ai_0 == -4) {
                  if (li_40 % 2 != 0) continue;
               } else {
                  if (ai_0 == -5) {
                     if (li_40 % 2 != 1) continue;
                  } else {
                     if (ai_0 == -3) {
                        if (li_40 <= OP_SELL) continue;
                     } else {
                        if (ai_0 == -2) {
                           if (li_40 > OP_SELL) continue;
                        } else {
                           if (ai_0 >= OP_BUY)
                              if (li_40 != ai_0) continue;
                        }
                     }
                  }
               }
               if (OrderOpenTime() >= ai_8) li_20++;
            }
         }
      }
   }
   if (li_20 == 0) {
      li_24 = OrdersHistoryTotal() - 1;
      for (li_36 = li_24; li_36 >= 0; li_36--) {
         if (!OrderSelect(li_36, SELECT_BY_POS, MODE_HISTORY)) {
            if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect_2() error = ", f0_16(GetLastError())));
         } else {
            if (OrderMagicNumber() == ai_4) {
               if (OrderSymbol() == gs_524) {
                  li_40 = OrderType();
                  if (ai_0 == -4) {
                     if (li_40 % 2 != 0) continue;
                  } else {
                     if (ai_0 == -5) {
                        if (li_40 % 2 != 1) continue;
                     } else {
                        if (ai_0 == -3) {
                           if (li_40 <= OP_SELL) continue;
                        } else {
                           if (ai_0 == -2) {
                              if (li_40 > OP_SELL) continue;
                           } else {
                              if (ai_0 >= OP_BUY)
                                 if (li_40 != ai_0) continue;
                           }
                        }
                     }
                  }
                  if (OrderOpenTime() < ai_8) break;
                  li_20++;
               }
            }
         }
      }
   }
   return (li_20);
}

void f0_5(int ai_0) {
   int li_12;
   int li_16;
   double ld_20;
   double ld_28;
   double ld_36;
   double ld_44;
   double ld_52;
   int li_4 = OrdersHistoryTotal() - 1;
   for (int li_8 = li_4; li_8 >= 0; li_8--) {
      if (!OrderSelect(li_8, SELECT_BY_POS, MODE_HISTORY)) {
         if (WriteLog) Print(StringConcatenate("WatchReverseAfterSL: OrderSelect() error = ", f0_16(GetLastError())));
      } else {
         li_12 = OrderMagicNumber();
         if (li_12 == gia_612[ai_0]) break;
         if (li_12 == gia_588[ai_0]) {
            if (OrderSymbol() == gs_524) {
               if (OrderProfit() >= 0.0) break;
               li_16 = OrderCloseTime();
               if (TimeHour(li_16) != Hour()) break;
               if (TimeMinute(li_16) != Minute()) break;
               if (TimeDay(li_16) != Day()) break;
               if (TimeMonth(li_16) != Month()) break;
               ld_20 = NormalizeDouble(OrderOpenPrice(), Digits);
               ld_28 = NormalizeDouble(OrderClosePrice(), Digits);
               ld_36 = gda_564[ai_0];
               ld_44 = NormalizeDouble(ld_28 - ld_20, Digits);
               if (MathAbs(ld_20 - ld_28) < MathAbs(ld_36) - gi_436 * (1 / MathPow(10, Digits))) break;
               ld_52 = NormalizeDouble(OrderLots() * gda_608[ai_0], gi_428);
               if (ld_52 > gd_136) ld_52 = gd_136;
               if (ld_52 < gd_484) ld_52 = gd_484;
               if (ld_52 > gd_476) ld_52 = gd_476;
               f0_4(ai_0, 1, MathAbs(gia_592[ai_0] - 1), gia_612[ai_0], ExpertComment, ld_52);
               return;
            }
         }
      }
   }
}

int f0_6(int &ai_0) {
   int li_4 = GetGMT();
   if (li_4 < 0) return (0);
   int li_8 = TimeCurrent() - li_4;
   ai_0 = MathFloor((li_8 + 1800) / 3600);
   return (1);
}

int f0_8(string as_0, string as_8 = "") {
   Comment("\n\n" + "GPS FOREX ROBOT V2" 
      + "\n" 
      + "www.gpsforexrobot.com" 
   + "\n\n" + as_0);
   if (as_8 != "") {
      if (as_8 == "comment") Print(as_0);
      else Print(as_8);
   }
   return (1);
}

int f0_1() {
   string ls_0;
   string ls_8;
   if (gi_672 == 1) {
      if (IsDemo()) ls_0 = "Demo";
      else ls_0 = "Real";
      if (AutoAnalysis) ls_8 = "Enable";
      else ls_8 = "Disable";
      f0_8("AUTHENTICATION STATUS: " 
         + "\n" 
         + gs_696 
         + "\n" 
         + "---------------------------------------------------" 
         + "\n" 
         + "GENERAL INFORMATION:" 
         + "\n" 
         + "Broker Company:            " + AccountCompany() 
         + "\n" 
         + "Terminal Company:         " + TerminalCompany() 
         + "\n" 
         + "Server Name:                 " + AccountServer() 
         + "\n" 
         + "Current Server Time:       " + TimeToStr(TimeCurrent(), TIME_SECONDS) 
         + "\n" 
         + "---------------------------------------------------" 
         + "\n" 
         + "ACCOUNT INFORMATION:" 
         + "\n" 
         + "Account Name:               " + AccountName() 
         + "\n" 
         + "Account Number:             " + AccountNumber() 
         + "\n" 
         + "Account Type:                " + ls_0 
         + "\n" 
         + "Account Leverage:           1:" + DoubleToStr(AccountLeverage(), 0) 
         + "\n" 
         + "Account Balance:             " + DoubleToStr(AccountBalance(), 2) 
         + "\n" 
         + "Account Equity:               " + DoubleToStr(AccountEquity(), 2) 
         + "\n" 
         + "Account Floating P/L:        " + DoubleToStr(AccountProfit(), 2) 
         + "\n" 
         + "Account Currency:           " + AccountCurrency() 
         + "\n" 
         + "---------------------------------------------------" 
         + "\n" 
         + "ADDITIONAL INFORMATION:" 
         + "\n" 
         + "Current Spread:               " + DoubleToStr(gd_492, Digits - gi_432) 
         + "\n" 
         + "Maximum Spread:            " + DoubleToStr(gd_500, Digits - gi_432) 
         + "\n" 
         + "Free Margin:                   " + DoubleToStr(AccountFreeMargin(), 2) 
         + "\n" 
         + "Used Margin:                   " + DoubleToStr(AccountMargin(), 2) 
         + "\n" 
         + "Auto Analysis:                " + ls_8 
         + "\n" 
         + "---------------------------------------------------" 
         + "\n" 
         + "GMT SETTINGS:" 
         + "\n" 
      + "GMT Offset:                   " + gs_688);
   } else {
      if (!gi_712) {
         f0_8("AUTHENTICATION STATUS: " 
            + "\n" 
         + gs_696, gs_704);
         gi_712 = TRUE;
      }
   }
   return (0);
}

int f0_14() {
   gd_204 = gda_684[2];
   gd_212 = gda_684[3];
   gi_220 = gda_684[4];
   gi_224 = gda_684[5];
   gd_252 = gda_684[16];
   gd_260 = gda_684[17];
   if (AutoAnalysis) {
      if (gda_684[6] == 0.0) GPSEU_TradeMonday = FALSE;
      else GPSEU_TradeMonday = TRUE;
      if (gda_684[7] == 0.0) GPSEU_TradeTuesday = FALSE;
      else GPSEU_TradeTuesday = TRUE;
      if (gda_684[9] == 0.0) GPSEU_TradeWednesday = FALSE;
      else GPSEU_TradeWednesday = TRUE;
      if (gda_684[10] == 0.0) GPSEU_TradeThursday = FALSE;
      else GPSEU_TradeThursday = TRUE;
      if (gda_684[11] == 0.0) GPSEU_TradeFriday = FALSE;
      else GPSEU_TradeFriday = TRUE;
   }
   gba_560[0] = gi_200;
   gda_564[0] = NormalizeDouble((-1.0 * gd_204) * gd_448, Digits);
   gda_568[0] = NormalizeDouble(gd_212 * gd_448, Digits);
   gia_572[0] = f0_17(gi_220);
   gia_576[0] = gi_224;
   gba_580[0][0] = GPSEU_TradeMonday;
   gba_580[0][1] = GPSEU_TradeTuesday;
   gba_580[0][2] = GPSEU_TradeWednesday;
   gba_580[0][3] = GPSEU_TradeThursday;
   gba_580[0][4] = GPSEU_TradeFriday;
   gia_584[0] = gi_228;
   gia_592[0] = gi_232;
   gia_588[0] = GPSEU_MagicNumber;
   gba_596[0] = GPSEU_UseRevAfterSL;
   gda_600[0] = NormalizeDouble((-1.0 * gd_252) * gd_448, Digits);
   gda_604[0] = NormalizeDouble(gd_260 * gd_448, Digits);
   gda_608[0] = GPSEU_RevAfterSL_Multiplier;
   gia_612[0] = GPSEU_RevAfterSL_MagNumber;
   gba_616[0] = GPSEU_UseTrailingStop;
   gda_620[0] = NormalizeDouble(GPSEU_TrailingDistance * gd_448, Digits);
   gda_624[0] = NormalizeDouble(GPSEU_TrailingStep * gd_448, Digits);
   gba_640[0] = gi_308;
   gda_644[0] = NormalizeDouble(gd_312 * gd_448, Digits);
   gda_648[0] = NormalizeDouble(gd_320 * gd_448, Digits);
   gda_652[0] = 0;
   gda_656[0] = 0;
   gba_660[0] = gi_336;
   return (1);
}

int f0_13() {
   gi_672 = GPSForexRobot(gda_684, EMail, CBReceipt, IsDemo(), AccountNumber(), "eurusd");
   if (gi_672 == -1) {
      gs_696 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]";
      gs_704 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]";
      return (-1);
   }
   if (gi_672 == -2) {
      gs_696 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]";
      gs_704 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]";
      return (-2);
   }
   if (gi_672 == -3) {
      gs_696 = "Authentication Failed [Wrong E-Mail or CBReceipt]\n[Trades are not available]";
      gs_704 = "Authentication Failed: [Wrong E-Mail or CBReceipt] [Trades are not available]";
      return (-2);
   }
   if (gi_672 == -4) {
      gs_696 = "Authentication Failed [Invalid Real Money Account Number]\n[Trades are not available]";
      gs_704 = "Authentication Failed: [Invalid Real Money Account Number] [Trades are not available]";
      return (-2);
   }
   if (gi_672 == 1) {
      f0_14();
      gs_696 = "Authenticated [Trades are available]\nThank you for joining the GPS Robot Team!";
      gs_704 = "Authenticatd: [Trades are available]";
      return (1);
   }
   return (0);
}

int f0_2(int ai_0) {
   MathSrand(TimeLocal());
   return (MathRand() % ai_0);
}

int f0_19() {
   double ld_0 = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0);
   double ld_8 = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);
   if ((Bid < ld_0 && Bid > ld_8) || (Bid > ld_0 && Bid < ld_8)) return (0);
   if (Ask < ld_0 && Ask < ld_8) return (0);
   if (Bid > ld_0 && Bid > ld_8) return (1);
   return (0);
}

void f0_3(int ai_0, int ai_4, int ai_8) {
   double ld_12;
   double ld_20;
   int li_28;
   double ld_32;
   if (ai_8 == 0) {
      ld_12 = gda_620[ai_4];
      ld_20 = gda_624[ai_4];
      li_28 = f0_11(ai_4, ai_0);
      ld_32 = gda_632[ai_4][li_28];
   } else {
      ld_12 = gda_644[ai_4];
      ld_20 = gda_648[ai_4];
      ld_32 = gda_652[ai_4];
   }
   if (OrderSelect(ai_0, SELECT_BY_TICKET, MODE_TRADES)) {
      if (OrderType() == OP_BUY) {
         if (Bid - OrderOpenPrice() <= NormalizeDouble(ld_12, Digits)) return;
         if (!StealthMode) {
            if (!(OrderStopLoss() == 0.0 || OrderStopLoss() < Bid - NormalizeDouble(ld_12 + ld_20, Digits))) return;
            if (!OrderModify(ai_0, OrderOpenPrice(), Bid - NormalizeDouble(ld_12, Digits), OrderTakeProfit(), OrderExpiration())) {
               Print("Error Trailing: OrderModify function can not modify the order. Error Number: #", GetLastError());
               return;
            }
            if (ai_8 == 0) {
               gda_632[ai_4][li_28] = Bid - NormalizeDouble(ld_12, Digits);
               gda_636[ai_4][li_28] = NormalizeDouble(Bid - ld_12 - OrderOpenPrice(), Digits);
               return;
            }
            gda_652[ai_4] = Bid - NormalizeDouble(ld_12, Digits);
            gda_656[ai_4] = NormalizeDouble(Bid - ld_12 - OrderOpenPrice(), Digits);
            return;
         }
         if (!(ld_32 == 0.0 || ld_32 < Bid - NormalizeDouble(ld_12 + ld_20, Digits))) return;
         if (ai_8 == 0) {
            gda_632[ai_4][li_28] = Bid - NormalizeDouble(ld_12, Digits);
            gda_636[ai_4][li_28] = NormalizeDouble(Bid - ld_12 - OrderOpenPrice(), Digits);
            return;
         }
         gda_652[ai_4] = Bid - NormalizeDouble(ld_12, Digits);
         gda_656[ai_4] = NormalizeDouble(Bid - ld_12 - OrderOpenPrice(), Digits);
         return;
      }
      if (OrderType() == OP_SELL) {
         if (OrderOpenPrice() - Ask > NormalizeDouble(ld_12, Digits)) {
            if (!StealthMode) {
               if (!(OrderStopLoss() == 0.0 || OrderStopLoss() > Ask + NormalizeDouble(ld_12 + ld_20, Digits))) return;
               if (!OrderModify(ai_0, OrderOpenPrice(), Ask + NormalizeDouble(ld_12, Digits), OrderTakeProfit(), OrderExpiration())) {
                  Print("Error Trailing: OrderModify function can not modify the order. Error Number: #", GetLastError());
                  return;
               }
               if (ai_8 == 0) {
                  gda_632[ai_4][li_28] = Ask + NormalizeDouble(ld_12, Digits);
                  gda_636[ai_4][li_28] = NormalizeDouble(OrderOpenPrice() - (Ask + ld_12), Digits);
                  return;
               }
               gda_652[ai_4] = Ask + NormalizeDouble(ld_12, Digits);
               gda_656[ai_4] = NormalizeDouble(OrderOpenPrice() - (Ask + ld_12), Digits);
               return;
            }
            if (ld_32 == 0.0 || ld_32 > Ask + NormalizeDouble(ld_12 + ld_20, Digits)) {
               if (ai_8 == 0) {
                  gda_632[ai_4][li_28] = Ask + NormalizeDouble(ld_12, Digits);
                  gda_636[ai_4][li_28] = NormalizeDouble(OrderOpenPrice() - (Ask + ld_12), Digits);
                  return;
               }
               gda_652[ai_4] = Ask + NormalizeDouble(ld_12, Digits);
               gda_656[ai_4] = NormalizeDouble(OrderOpenPrice() - (Ask + ld_12), Digits);
            }
         }
      }
   }
}

int f0_11(int ai_0, int ai_4) {
   for (int li_8 = 0; li_8 < 5; li_8++)
      if (gia_628[ai_0][li_8] == ai_4) return (li_8);
   return (-1);
}

void f0_12(int ai_0, int ai_4) {
   for (int li_8 = 0; li_8 < 5; li_8++) {
      if (gia_628[ai_0][li_8] == 0) {
         gia_628[ai_0][li_8] = ai_4;
         return;
      }
   }
}

void f0_0(int ai_0, int ai_4) {
   for (int li_8 = 0; li_8 < 5; li_8++)
      if (gia_628[ai_0][li_8] == ai_4) gia_628[ai_0][li_8] = 0;
}

Recommend