// ApM SpecialEdition for FE_MOD_2.010c // Revision M3

#property copyright "Copyright ©2012, Umeku"
#property link      "http://umeku.com/fx/basketExposure"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 0.1
#property indicator_buffers 1
#property indicator_color1 Black

/*#import "wininet.dll"
   int InternetAttemptConnect(int a0);
   int InternetOpenA(string a0, int a1, string a2, string a3, int a4);
   int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5);
   int InternetReadFile(int a0, int& a1[], int a2, int& a3[]);
   int InternetCloseHandle(int a0);
#import*/

extern string __ = "FE_MOD Controls:";
extern bool FreezeAfterTPGlobal = FALSE;
extern bool FreezeAfterTP_SWB = FALSE;
extern double FreezeAfterTP_DD = 50;
extern double SendEmailOnDD = 50;
extern string ___ = "basketExposure";
extern double Deposits = 0.0;
extern double Bonuses = 0.0;
extern double Withdrawals = 0.0;
extern double BalanceMultiplier = 1.0;
extern bool BonusIncludedInBalance = FALSE;
extern bool ReduceMarginBalanceByBonus = TRUE;
extern bool ResetMaxMarginUsed = FALSE;
extern bool ResetMaxDD = FALSE;
extern bool ResetMaxValuesEachWeek = FALSE;
extern int TimeShift = 0;
extern int AlertLevel = 13;
extern int NegativeBasketAlertDelay = 30;
extern color ExtColor = DarkOrange;
extern color DimColor = DimGray;
extern color NulColor = DarkGray;
extern color PosColor = Lime;
extern color NegColor = Red;
extern color AlertColor = Red;
extern bool ShowRealDD = TRUE;
extern bool HideMagicNumberColumn = FALSE;
extern bool HideBuyLevelColumn = FALSE;
extern bool HideBuyLotsColumn = FALSE;
extern bool HideSellLevelColumn = FALSE;
extern bool HideSellLotsColumn = FALSE;
extern bool HideProfitColumn = FALSE;
extern bool HidePotentialProfitColumn = FALSE;
extern bool HideBuyPipsColumn = FALSE;
extern bool HideBuyTPColumn = FALSE;
extern bool HideSellPipsColumn = FALSE;
extern bool HideSellTPColumn = FALSE;
extern bool HideSwapColumn = FALSE;
extern bool HideSpreadColumn = FALSE;
extern bool HideAgeColumn = FALSE;
extern bool HideTodayProfitColumn = FALSE;
extern bool HideYesterdayProfitColumn = FALSE;
extern string Column1Title = "#";
extern string Column2Title = "Symbol";
extern string Column3Title = "Lvl";
extern string Column4Title = "Buy";
extern string Column5Title = "Lvl";
extern string Column6Title = "Sell";
extern string Column7Title = "Profit";
extern string Column8Title = "Potential Profit";
extern string Column9Title = "BPip";
extern string Column10Title = "T/P Buy";
extern string Column11Title = "SPip";
extern string Column12Title = "T/P Sell";
extern string Column13Title = "Swap";
extern string Column14Title = "<>";
extern string Column15Title = "Basket Age";
extern string Column16Title = "Today";
extern string Column17Title = "Previous";
extern int MagicLongEURUSD = 0;
extern int MagicLongGBPUSD = 0;
extern int MagicLongEURJPY = 0;
extern int MagicLongEURGBP = 0;
extern int MagicLongUSDCAD = 0;
extern int MagicLongAUDUSD = 0;
extern int MagicLongNZDUSD = 0;
extern int MagicLongUSDJPY = 0;
extern int MagicLongAUDNZD = 0;
extern int MagicShortEURUSD = 0;
extern int MagicShortGBPUSD = 0;
extern int MagicShortEURJPY = 0;
extern int MagicShortUSDCAD = 0;
extern int MagicShortUSDJPY = 0;
string gs_424 = "Exposure v1.6";
string gsa_432[21];
double gda_436[21][14];
double gda_440[21][2];
int gia_444[21][2];
int gia_448[21][2];
int gia_452[21];
int g_count_456 = -1;
string gsa_460[19];
bool gba_464[19];
int gia_468[19] = {20, 120, 25, 55, 25, 55, 60, 50, 60, 30, 65, 30, 60, 40, 30, 50, 60, 50, 50};
int gi_472 = 14;
double g_ibuf_476[];
string gsa_480[8] = {"", "Balance:", "Credit:", "Equity:", "Floating P/L:", "Margin:", "Margin Usage:", "Drawdown:"};
int gia_484[2] = {10, 100};
string gsa_488[8] = {"", "Leverage:", "Stop Out:", "Margin Mode:", "ROI (session):", "ROI (all-time):", "Max Margin Usage:", "Max Drawdown:"};
int gia_492[2] = {370, 480};
int gi_496 = 8;
bool gi_500 = FALSE;
int gi_504 = 0;
int gi_508 = 5;
int g_hist_total_512 = -1;
int g_day_of_week_516 = -1;
int gi_520 = 0;
bool gi_524 = FALSE;
string gs_528 = "";
int gia_536[3];
//ApM
bool email_is_send = FALSE;
int gLastTimeDD;

/*string f0_25(string as_0) {
   int lia_20[8192];
   int lia_24[1];
   int li_40;
   string ls_44;
   if (!IsDllsAllowed()) return ("");
   int li_8 = InternetAttemptConnect(0);
   if (li_8 != 0) return ("");
   int li_12 = InternetOpenA("Microsoft Internet Explorer", 0, "", "", 0);
   if (li_12 <= 0) return ("");
   int li_16 = InternetOpenUrlA(li_12, as_0, "", 0, 0, 0);
   if (li_16 <= 0) {
      InternetCloseHandle(li_12);
      return (-1);
   }
   for (string ls_ret_28 = ""; !IsStopped(); ls_ret_28 = ls_ret_28 + ls_44) {
      for (int index_36 = 0; index_36 < 8192; index_36++) lia_20[index_36] = 0;
      li_40 = InternetReadFile(li_16, lia_20, 32768, lia_24);
      if (lia_24[0] == FALSE) break;
      ls_44 = "";
      for (index_36 = 0; index_36 < 8192; index_36++) {
         ls_44 = ls_44 + CharToStr(lia_20[index_36] & 255);
         if (StringLen(ls_44) == lia_24[0]) break;
         ls_44 = ls_44 + CharToStr(lia_20[index_36] >> 8 & 255);
         if (StringLen(ls_44) == lia_24[0]) break;
         ls_44 = ls_44 + CharToStr(lia_20[index_36] >> 16 & 255);
         if (StringLen(ls_44) == lia_24[0]) break;
         ls_44 = ls_44 + CharToStr(lia_20[index_36] >> 24 & 255);
      }
   }
   InternetCloseHandle(li_12);
   return (ls_ret_28);
}

int f0_11(string as_0, string as_8, string &asa_16[], int ai_20 = 0) {
   int li_24;
   int li_28;
   int li_32;
   if (StringFind(as_0, as_8) < 0) {
      ArrayResize(asa_16, 1);
      asa_16[0] = as_0;
   } else {
      li_24 = 0;
      li_28 = 0;
      li_32 = 0;
      while (li_28 > -1) {
         li_32++;
         li_28 = StringFind(as_0, as_8, li_24);
         ArrayResize(asa_16, li_32);
         if (li_28 > -1) {
            if (li_28 - li_24 > 0) asa_16[li_32 - 1] = StringSubstr(as_0, li_24, li_28 - li_24);
         } else asa_16[li_32 - 1] = StringSubstr(as_0, li_24, 0);
         li_24 = li_28 + 1;
      }
   }
   if (ai_20 == 0 || ai_20 == ArraySize(asa_16)) return (1);
   return (0);
}*/

string f0_15(double ad_0, bool ai_8) {
   int lia_12[4];
   string lsa_20[4];
   string ls_ret_24 = "";
   lia_12[3] = MathMod(ad_0, 60);
   int li_16 = ad_0 / 60.0;
   lia_12[2] = MathMod(li_16, 60);
   li_16 /= 60;
   lia_12[1] = MathMod(li_16, 24);
   li_16 /= 24;
   lia_12[0] = li_16;
   for (int index_32 = 0; index_32 < 4; index_32++) {
      if (lia_12[index_32] < 10) lsa_20[index_32] = "0" + lia_12[index_32];
      else lsa_20[index_32] = lia_12[index_32];
   }
   if (ai_8) ls_ret_24 = lsa_20[0] + "d" + lsa_20[1] + "h" + lsa_20[2] + "m" + lsa_20[3] + "s";
   else {
      if (lia_12[0] > 0) ls_ret_24 = lsa_20[0] + "d" + lsa_20[1] + "h";
      else {
         if (lia_12[1] > 0) ls_ret_24 = lsa_20[1] + "h" + lsa_20[2] + "m";
         else ls_ret_24 = lsa_20[2] + "m" + lsa_20[3] + "s";
      }
   }
   return (ls_ret_24);
}

int f0_23(int a_magic_0, int a_cmd_4, bool ai_8) {
   int ticket_12;
   int order_total_20 = OrdersTotal();
   for (int pos_16 = 0; pos_16 < order_total_20; pos_16++) {
      if (OrderSelect(pos_16, SELECT_BY_POS)) {
         if (a_cmd_4 == OrderType()) {
            if (OrderMagicNumber() == a_magic_0) {
               ticket_12 = OrderTicket();
               if (ai_8) return (ticket_12);
            }
         }
      }
   }
   return (ticket_12);
}

double f0_6(int ai_0) {
   switch (ai_0) {
   case 2:
      return (0.01);
   case 3:
      return (0.01);
   case 4:
      return (0.0001);
   case 5:
      return (0.0001);
      return/*(WARN)*/;
   }
}

double f0_1(int a_magic_0, int a_cmd_4) {
   double ld_ret_24;
   double ld_32;
   double point_40;
   int order_total_20 = OrdersTotal();
   int ticket_16 = f0_23(a_magic_0, a_cmd_4, 0);
   if (OrderSelect(ticket_16, SELECT_BY_TICKET)) {
      ld_ret_24 = OrderOpenPrice();
      ld_32 = -1;
      point_40 = MarketInfo(OrderSymbol(), MODE_POINT);
      while (ld_32 < 0.0) {
         if (a_cmd_4 == OP_BUY) ld_ret_24 += point_40;
         else ld_ret_24 -= point_40;
         ld_32 = 0;
         for (int pos_12 = 0; pos_12 < order_total_20; pos_12++) {
            if (OrderSelect(pos_12, SELECT_BY_POS)) {
               if (a_cmd_4 == OrderType())
                  if (OrderMagicNumber() == a_magic_0) ld_32 += f0_9(OrderLots(), OrderOpenPrice(), ld_ret_24, a_cmd_4, OrderSymbol()) + OrderCommission() + OrderSwap();
            }
         }
      }
   }
   return (ld_ret_24);
}

double f0_9(double ad_0, double ad_8, double ad_16, int ai_24, string a_symbol_28) {
   double ld_36 = MarketInfo(a_symbol_28, MODE_TICKVALUE) / MarketInfo(a_symbol_28, MODE_TICKSIZE);
   if (ai_24 == 0) return (ld_36 * ad_0 * (ad_16 - ad_8));
   if (ai_24 == 1) return (ld_36 * ad_0 * (ad_8 - ad_16));
   return (0);
}

void init() {
   // FATP_GLOBAL //ApM
   if (GlobalVariableCheck("FEM_GFATP") && !FreezeAfterTPGlobal) GlobalVariableDel("FEM_GFATP");
   if (!GlobalVariableCheck("FEM_GFATP") && FreezeAfterTPGlobal) GlobalVariableSet("FEM_GFATP", TimeCurrent());
   if (GlobalVariableCheck("FEM_GFATPS") && !FreezeAfterTP_SWB) GlobalVariableDel("FEM_GFATPS");
   if (!GlobalVariableCheck("FEM_GFATPS") && FreezeAfterTP_SWB) GlobalVariableSet("FEM_GFATPS", TimeCurrent());   
   if (f0_22()) gs_424 = gs_424 + "d";
   IndicatorShortName(gs_424);
   SetIndexBuffer(0, g_ibuf_476);
   SetIndexStyle(0, DRAW_NONE);
   IndicatorDigits(0);
   SetIndexEmptyValue(0, 0.0);
   ArrayInitialize(gba_464, 0);
   ArrayInitialize(gia_452, -1);
   f0_19();
   int digits_0 = MarketInfo(Symbol(), MODE_DIGITS);
   if (digits_0 == 5 || digits_0 == 3) gi_524 = TRUE;
   gs_528 = AccountCurrency();
   TimeShift = 60 * (60 * TimeShift);
   if (BalanceMultiplier == 0.0) {
      Alert("BalanceMultiplier should be > 0");
      BalanceMultiplier = 1;
   }
   gsa_460[0] = Column1Title;
   gsa_460[1] = Column2Title;
   gsa_460[2] = Column3Title;
   gsa_460[3] = Column4Title;
   gsa_460[4] = Column5Title;
   gsa_460[5] = Column6Title;
   gsa_460[6] = Column7Title;
   gsa_460[7] = Column8Title;
   gsa_460[9] = Column9Title;
   gsa_460[10] = Column10Title;
   gsa_460[11] = Column11Title;
   gsa_460[12] = Column12Title;
   gsa_460[13] = Column13Title;
   gsa_460[14] = Column14Title;
   gsa_460[15] = Column15Title;
   gsa_460[17] = Column16Title;
   gsa_460[18] = Column17Title;
   gia_452[1] = MagicLongEURUSD;
   gia_452[2] = MagicLongGBPUSD;
   gia_452[3] = MagicLongEURJPY;
   gia_452[4] = MagicLongEURGBP;
   gia_452[5] = MagicLongUSDCAD;
   gia_452[6] = MagicLongAUDUSD;
   gia_452[7] = MagicLongNZDUSD;
   gia_452[8] = MagicLongUSDJPY;
   gia_452[9] = MagicLongAUDNZD;
   gia_452[11] = MagicShortEURUSD;
   gia_452[12] = MagicShortGBPUSD;
   gia_452[13] = MagicShortEURJPY;
   gia_452[14] = MagicShortUSDCAD;
   gia_452[15] = MagicShortUSDJPY;
   if (f0_22()) {
      HidePotentialProfitColumn = FALSE;
      HideAgeColumn = FALSE;
   }
   gba_464[0] = HideMagicNumberColumn;
   gba_464[2] = HideBuyLevelColumn;
   gba_464[3] = HideBuyLotsColumn;
   gba_464[4] = HideSellLevelColumn;
   gba_464[5] = HideSellLotsColumn;
   gba_464[6] = HideProfitColumn;
   gba_464[7] = HidePotentialProfitColumn;
   gba_464[8] = HidePotentialProfitColumn;
   gba_464[9] = HideBuyPipsColumn;
   gba_464[10] = HideBuyTPColumn;
   gba_464[11] = HideSellPipsColumn;
   gba_464[12] = HideSellTPColumn;
   gba_464[13] = HideSwapColumn;
   gba_464[14] = HideSpreadColumn;
   gba_464[15] = HideAgeColumn;
   gba_464[16] = HideAgeColumn;
   gba_464[17] = HideTodayProfitColumn;
   gba_464[18] = HideYesterdayProfitColumn;
   gia_536[0] = TimeMinute(f0_26());
   gia_536[1] = TimeHour(f0_26());
   gia_536[2] = TimeDay(f0_26());
   //f0_10();
   f0_4();
}

void f0_18() {
   int magic_4;
   if (gi_500 != TRUE) {
      gi_504++;
      if (OrdersHistoryTotal() > 0 || gi_504 >= gi_508) gi_500 = TRUE;
      for (int pos_0 = 0; pos_0 < OrdersHistoryTotal(); pos_0++) {
         OrderSelect(pos_0, SELECT_BY_POS, MODE_HISTORY);
         magic_4 = OrderMagicNumber();
         if (magic_4 > 0 && magic_4 < 21) gsa_432[magic_4] = OrderSymbol();
      }
   }
}

void deinit() {
   int li_0 = WindowFind(gs_424);
   if (li_0 > 0) ObjectsDeleteAll(li_0);
}

void start() {
   string name_0;
   string dbl2str_8;
   int count_24;
   int arr_size_32;
   int y_36;
   int x_40;
   int color_44;
   double ld_48;
   double ld_56;
   double ld_64;
   double ld_72;
   double ld_80;
   double ld_88;
   double ld_104;
   double ld_112;
   double ld_120;
   double ld_128;
   double ld_136;
   double ld_144;
   double ld_152;
   double ld_160;
   double ld_168;
   bool li_176;
   double ld_180;
   bool li_188;
   double ld_192;
   double ld_200;
   double ld_208;
   double ld_216;
   double ld_224;
   double ld_232;
   double ld_240;
   double ld_248;
   double ld_256;
   double ld_264;
   double ld_272;
   double ld_280;
   double ld_288;
   int li_296;
   double ld_300;
   bool li_308;
   double ld_312;
   double ld_320;
   bool li_328;
   int li_332;
   int window_28 = WindowFind(gs_424);
   double ld_96 = 0;
   if (window_28 >= 0) {
      if (!gi_500) f0_18();
      if (gi_520 == 0) f0_19();
      ld_104 = AccountBalance();
      ld_112 = AccountCredit();
      if (BonusIncludedInBalance) {
         ld_104 -= Bonuses;
         ld_112 += Bonuses;
      }
      ld_120 = ld_104 - Deposits + Withdrawals;
      ld_128 = ld_104 - Deposits;
      if (ResetMaxMarginUsed) {
         GlobalVariableSet("basketExposureMaxMarginUsed", 0);
         ResetMaxMarginUsed = FALSE;
      }
      ld_136 = GlobalVariableGet("basketExposureMaxMarginUsed");
      ld_144 = ld_104 + Bonuses;
      if (ReduceMarginBalanceByBonus) ld_144 -= Bonuses;
      if (ld_144 > 0.0) ld_152 = 100.0 * ((AccountMargin() - AccountProfit()) / ld_144);
      else ld_152 = 0;
      if (ld_152 > ld_136) {
         GlobalVariableSet("basketExposureMaxMarginUsed", ld_152);
         ld_136 = ld_152;
      }
      if (ResetMaxDD) {
         GlobalVariableSet("basketExposureMaxDD", 0);
         ResetMaxDD = FALSE;
      }
      ld_160 = 0;
      ld_168 = GlobalVariableGet("basketExposureMaxDD");
      if (ld_104 > 0.0) ld_160 = 100.0 * ((ld_104 - AccountEquity()) / ld_104);
      if (ld_160 > ld_168) {
         GlobalVariableSet("basketExposureMaxDD", ld_160);
         ld_168 = ld_160;
      }
      // Send EMail //ApM
      if (ld_160 > SendEmailOnDD && !email_is_send) {
         string mailbody="Dear FE_MOD user! Your account " + AccountNumber() + " in " + AccountCompany() + " has " +
         DoubleToStr(ld_160,1) + "% dropdown.";
         SendMail("FE_MOD Dropdown warning!", mailbody);
         email_is_send = TRUE;                       }
      // FATP on DD control
      if (ld_160 > FreezeAfterTP_DD) { //Установка флагов в случае просадки
         if (TimeCurrent() - gLastTimeDD > 7200) {
               if (!GlobalVariableCheck("FEM_GFATP")) GlobalVariableSet("FEM_GFATP", TimeCurrent());
               if (!GlobalVariableCheck("FEM_GFATPS")) GlobalVariableSet("FEM_GFATPS", TimeCurrent());
               gLastTimeDD = TimeCurrent();}} else { //Удаление флагов в случае выхода из просадки
         if (TimeCurrent() - gLastTimeDD > 7200) {
               if (GlobalVariableCheck("FEM_GFATP") && !FreezeAfterTPGlobal) GlobalVariableDel("FEM_GFATP");
               if (GlobalVariableCheck("FEM_GFATPS") && !FreezeAfterTP_SWB) GlobalVariableDel("FEM_GFATPS");
               gLastTimeDD = TimeCurrent();}}
         
      arr_size_32 = ArraySize(gsa_480);
      for (int index_20 = 0; index_20 < arr_size_32; index_20++) {
         if (!ShowRealDD && index_20 == 7) continue;
         name_0 = "Acc_" + index_20;
         if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
            ObjectSet(name_0, OBJPROP_XDISTANCE, gia_484[0]);
            ObjectSet(name_0, OBJPROP_YDISTANCE, gi_472 * index_20);
            f0_3(name_0, gsa_480[index_20], White);
         }
         name_0 = "AccVal_" + index_20;
         if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
            ObjectSet(name_0, OBJPROP_XDISTANCE, gia_484[1]);
            ObjectSet(name_0, OBJPROP_YDISTANCE, gi_472 * index_20);
            f0_3(name_0, "", CLR_NONE);
         }
      }
      f0_3("AccVal_0", AccountCompany(), DimColor);
      f0_3("AccVal_1", f0_16(ld_104, 0) + " (" + f0_2(ld_128, 0, "+") + ")", ExtColor);
      f0_3("AccVal_2", f0_16(ld_112, 0), ExtColor);
      f0_3("AccVal_3", f0_16(AccountEquity(), 0), ExtColor);
      f0_3("AccVal_4", f0_2(AccountProfit(), 0, "+"), ExtColor);
      f0_3("AccVal_5", f0_16(AccountMargin(), 0), ExtColor);
      f0_3("AccVal_6", f0_16(AccountMargin() - AccountProfit(), 0) + " (" + DoubleToStr(ld_152, 1) + "% in use)" + ", Free" + f0_16(ld_144 - AccountMargin() + AccountProfit(),
         0), ExtColor);
      if (ShowRealDD) f0_3("AccVal_7", " " + DoubleToStr(ld_160, 1) + "%", ExtColor);
      arr_size_32 = ArraySize(gsa_488);
      for (index_20 = 0; index_20 < arr_size_32; index_20++) {
         if (!ShowRealDD && index_20 == 7) continue;
         name_0 = "Info_" + index_20;
         if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
            ObjectSet(name_0, OBJPROP_XDISTANCE, gia_492[0]);
            ObjectSet(name_0, OBJPROP_YDISTANCE, gi_472 * index_20);
            if (index_20 == 0) color_44 = DimColor;
            else color_44 = White;
            f0_3(name_0, gsa_488[index_20], color_44);
         }
         name_0 = "InfoVal_" + index_20;
         if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
            ObjectSet(name_0, OBJPROP_XDISTANCE, gia_492[1]);
            ObjectSet(name_0, OBJPROP_YDISTANCE, gi_472 * index_20);
            f0_3(name_0, "", CLR_NONE);
         }
      }
      li_176 = FALSE;
      ld_180 = f0_12();
      if (ld_180 < 300.0) li_176 = TRUE;
      f0_3("Info_0", TimeToStr(f0_26(), TIME_DATE|TIME_SECONDS), ExtColor);
      f0_3("InfoVal_1", "1:" + DoubleToStr(gi_520, 0), ExtColor);
      f0_3("InfoVal_2", DoubleToStr(AccountStopoutLevel(), 0) + "%, Level " + DoubleToStr(ld_180, li_176) + "%", ExtColor);
      f0_3("InfoVal_3", DoubleToStr(AccountFreeMarginMode(), 0) + " (" + f0_8(AccountFreeMarginMode()) + ")", ExtColor);
      if (Deposits > 0.0) {
         f0_3("InfoVal_4", DoubleToStr(100.0 * (ld_128 / Deposits), 1) + "% (" + f0_16(ld_128, 1) + ")", ExtColor);
         f0_3("InfoVal_5", DoubleToStr(100.0 * (ld_120 / Deposits), 1) + "% (" + f0_16(ld_120, 1) + ")", ExtColor);
      } else f0_3("InfoVal_4", "Please set Deposits in settings", ExtColor);
      f0_3("InfoVal_6", DoubleToStr(ld_136, 1) + "%", ExtColor);
      if (ShowRealDD) f0_3("InfoVal_7", DoubleToStr(ld_168, 1) + "%", ExtColor);
      arr_size_32 = ArraySize(gsa_460);
      if (g_count_456 < 0) {
         if (ShowRealDD) gi_496++;
         x_40 = 10;
         for (index_20 = 0; index_20 < arr_size_32; index_20++) {
            name_0 = "Head_" + index_20;
            if (!gba_464[index_20]) {
               if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
                  ObjectSet(name_0, OBJPROP_XDISTANCE, x_40);
                  ObjectSet(name_0, OBJPROP_YDISTANCE, gi_472 * gi_496);
                  f0_3(name_0, gsa_460[index_20], DimColor);
               }
               x_40 += gia_468[index_20];
            }
         }
         g_count_456 = 0;
      }
      ArrayInitialize(gda_436, 0.0);
      f0_5();
      count_24 = 0;
      for (int li_16 = 1; li_16 < 21; li_16++) {
         if (StringLen(gsa_432[li_16]) != 0) {
            count_24++;
            if (count_24 > g_count_456) {
               x_40 = 10;
               for (index_20 = 0; index_20 < arr_size_32; index_20++) {
                  name_0 = "Line_" + count_24 + "_" + index_20;
                  if (!gba_464[index_20]) {
                     if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
                        y_36 = gi_472 * (count_24 + gi_496) + 1;
                        ObjectSet(name_0, OBJPROP_XDISTANCE, x_40);
                        ObjectSet(name_0, OBJPROP_YDISTANCE, y_36);
                        f0_3(name_0, "", CLR_NONE);
                     }
                     x_40 += gia_468[index_20];
                  }
               }
               g_count_456++;
            }
            li_188 = gda_436[li_16][7] > 0.0;
            ld_192 = gda_436[li_16][1];
            ld_200 = gda_436[li_16][0];
            ld_208 = gda_436[li_16][3];
            ld_216 = gda_436[li_16][2];
            ld_224 = gda_436[li_16][4];
            ld_232 = gda_436[li_16][10];
            ld_240 = gda_436[li_16][11];
            ld_248 = gda_436[li_16][8];
            ld_256 = gda_436[li_16][9];
            ld_264 = gda_436[li_16][12];
            ld_272 = gda_436[li_16][13];
            ld_280 = gda_440[li_16][0];
            ld_288 = gda_440[li_16][1];
            li_296 = MarketInfo(gsa_432[li_16], MODE_DIGITS);
            ld_300 = f0_6(li_296);
            name_0 = "Line_" + count_24 + "_0";
            if (li_188) color_44 = ExtColor;
            else color_44 = DimColor;
            f0_3(name_0, DoubleToStr(li_16, 0), color_44);
            name_0 = "Line_" + count_24 + "_1";
            if (li_188) color_44 = ExtColor;
            else color_44 = DimColor;
            f0_3(name_0, gsa_432[li_16], color_44);
            name_0 = "Line_" + count_24 + "_2";
            if (ld_192 >= AlertLevel) color_44 = AlertColor;
            else color_44 = NulColor;
            if (!li_188) color_44 = DimColor;
            f0_3(name_0, DoubleToStr(ld_192, 0), color_44);
            name_0 = "Line_" + count_24 + "_3";
            if (!li_188) color_44 = DimColor;
            else {
               if (ld_192 > 0.0) color_44 = PosColor;
               else color_44 = NulColor;
            }
            f0_3(name_0, DoubleToStr(ld_200, 2), color_44);
            name_0 = "Line_" + count_24 + "_4";
            if (ld_208 >= AlertLevel) color_44 = AlertColor;
            else color_44 = NulColor;
            if (!li_188) color_44 = DimColor;
            f0_3(name_0, DoubleToStr(ld_208, 0), color_44);
            name_0 = "Line_" + count_24 + "_5";
            if (!li_188) color_44 = DimColor;
            else {
               if (ld_208 > 0.0) color_44 = NegColor;
               else color_44 = NulColor;
            }
            f0_3(name_0, DoubleToStr(ld_216, 2), color_44);
            name_0 = "Line_" + count_24 + "_6";
            if (ld_224 > 0.0) color_44 = PosColor;
            else {
               if (ld_224 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            if (!li_188) color_44 = DimColor;
            f0_3(name_0, f0_16(ld_224, 0), color_44);
            name_0 = "Line_" + count_24 + "_7";
            if (ld_232 > 0.0) color_44 = PosColor;
            else {
               if (ld_232 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            if (!li_188) color_44 = DimColor;
            f0_3(name_0, f0_16(ld_232, 0), color_44);
            name_0 = "Line_" + count_24 + "_8";
            if (ld_240 > 0.0) color_44 = PosColor;
            else {
               if (ld_240 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            if (!li_188) color_44 = DimColor;
            f0_3(name_0, f0_16(ld_240, 0), color_44);
            name_0 = "Line_" + count_24 + "_9";
            if (ld_200 > 0.0 && gda_436[li_16][5] > 0.0) {
               ld_312 = (gda_436[li_16][5] - MarketInfo(gsa_432[li_16], MODE_BID)) / ld_300;
               if (ld_312 < 10.0 && gi_524) li_308 = TRUE;
               else li_308 = FALSE;
               dbl2str_8 = DoubleToStr(ld_312, li_308);
            } else dbl2str_8 = "";
            if (dbl2str_8 != "" && ld_312 < 10.0) color_44 = PosColor;
            else color_44 = NulColor;
            f0_3(name_0, dbl2str_8, color_44);
            name_0 = "Line_" + count_24 + "_10";
            if (ld_200 > 0.0) dbl2str_8 = DoubleToStr(gda_436[li_16][5], li_296);
            else dbl2str_8 = "";
            if (gda_436[li_16][5] == 0.0 && ld_200 > 0.0) color_44 = AlertColor;
            else color_44 = NulColor;
            f0_3(name_0, dbl2str_8, color_44);
            name_0 = "Line_" + count_24 + "_11";
            if (ld_216 > 0.0 && gda_436[li_16][6] > 0.0) {
               ld_320 = (MarketInfo(gsa_432[li_16], MODE_ASK) - gda_436[li_16][6]) / ld_300;
               if (ld_320 < 10.0 && gi_524) li_308 = TRUE;
               else li_308 = FALSE;
               dbl2str_8 = DoubleToStr(ld_320, li_308);
            } else dbl2str_8 = "";
            if (dbl2str_8 != "" && ld_320 < 10.0) color_44 = PosColor;
            else color_44 = NulColor;
            f0_3(name_0, dbl2str_8, color_44);
            name_0 = "Line_" + count_24 + "_12";
            if (ld_216 > 0.0) dbl2str_8 = DoubleToStr(gda_436[li_16][6], li_296);
            else dbl2str_8 = "";
            if (gda_436[li_16][6] == 0.0 && ld_216 > 0.0) color_44 = AlertColor;
            else color_44 = NulColor;
            f0_3(name_0, dbl2str_8, color_44);
            name_0 = "Line_" + count_24 + "_13";
            if (li_188) dbl2str_8 = f0_16(ld_248, 0);
            else dbl2str_8 = "";
            if (ld_248 > 0.0) color_44 = PosColor;
            else {
               if (ld_248 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            f0_3(name_0, dbl2str_8, color_44);
            name_0 = "Line_" + count_24 + "_14";
            li_328 = FALSE;
            if (gi_524) li_328 = TRUE;
            if (li_188) dbl2str_8 = DoubleToStr(ld_256, li_328);
            else dbl2str_8 = "";
            f0_3(name_0, dbl2str_8, NulColor);
            name_0 = "Line_" + count_24 + "_15";
            if (li_188 && ld_264 > 0.0) dbl2str_8 = f0_15(TimeCurrent() - ld_264, 0);
            else dbl2str_8 = "";
            f0_3(name_0, dbl2str_8, NulColor);
            name_0 = "Line_" + count_24 + "_16";
            if (li_188 && ld_272 > 0.0) dbl2str_8 = f0_15(TimeCurrent() - ld_272, 0);
            else dbl2str_8 = "";
            f0_3(name_0, dbl2str_8, NulColor);
            name_0 = "Line_" + count_24 + "_17";
            if (ld_280 > 0.0) color_44 = PosColor;
            else {
               if (ld_280 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            f0_3(name_0, f0_16(ld_280, 0), color_44);
            name_0 = "Line_" + count_24 + "_18";
            if (ld_288 > 0.0) color_44 = PosColor;
            else {
               if (ld_288 == 0.0) color_44 = NulColor;
               else color_44 = NegColor;
            }
            f0_3(name_0, f0_16(ld_288, 0), color_44);
            ld_48 += ld_192;
            ld_64 += ld_200;
            ld_56 += ld_208;
            ld_72 += ld_216;
            ld_80 += ld_224;
            ld_88 += ld_280;
            ld_96 += ld_288;
         }
      }
      f0_3("AccVal_5", f0_16(AccountMargin(), 0) + " (" + DoubleToStr(ld_48 + ld_56, 0) + " orders, " + DoubleToStr(ld_64 + ld_72, 2) + " lots)", ExtColor);
      count_24++;
      if (count_24 > g_count_456) {
         x_40 = 10;
         for (index_20 = 0; index_20 < arr_size_32; index_20++) {
            name_0 = "Line_" + count_24 + "_" + index_20;
            if (!gba_464[index_20]) {
               if (ObjectCreate(name_0, OBJ_LABEL, window_28, 0, 0)) {
                  y_36 = gi_472 * (count_24 + gi_496) + 1;
                  ObjectSet(name_0, OBJPROP_XDISTANCE, x_40);
                  ObjectSet(name_0, OBJPROP_YDISTANCE, y_36);
                  f0_3(name_0, "", CLR_NONE);
               }
               x_40 += gia_468[index_20];
            }
         }
         g_count_456++;
      }
      name_0 = "Line_" + count_24 + "_1";
      f0_3(name_0, "Totals", ExtColor);
      name_0 = "Line_" + count_24 + "_2";
      f0_3(name_0, DoubleToStr(ld_48, 0), ExtColor);
      name_0 = "Line_" + count_24 + "_3";
      f0_3(name_0, DoubleToStr(ld_64, 2), ExtColor);
      name_0 = "Line_" + count_24 + "_4";
      f0_3(name_0, DoubleToStr(ld_56, 0), ExtColor);
      name_0 = "Line_" + count_24 + "_5";
      f0_3(name_0, DoubleToStr(ld_72, 2), ExtColor);
      name_0 = "Line_" + count_24 + "_6";
      f0_3(name_0, f0_16(ld_80, 0), ExtColor);
      name_0 = "Line_" + count_24 + "_17";
      f0_3(name_0, f0_16(ld_88, 0), ExtColor);
      name_0 = "Line_" + count_24 + "_18";
      f0_3(name_0, f0_16(ld_96, 0), ExtColor);
      li_332 = count_24;
      if (li_332 < g_count_456) {
         for (count_24 = g_count_456; count_24 > li_332; count_24--) {
            for (index_20 = 0; index_20 < arr_size_32; index_20++) {
               name_0 = "Line_" + count_24 + "_" + index_20;
               f0_3(name_0, "", CLR_NONE);
            }
         }
      }
      f0_0();
      g_ibuf_476[Bars - 1] = -1;
      if (TimeMinute(f0_26()) != gia_536[0]) {
         gia_536[0] = TimeMinute(f0_26());
         f0_7();
      }
      if (TimeHour(f0_26()) != gia_536[1]) {
         gia_536[1] = TimeHour(f0_26());
         f0_17();
      }
      if (TimeDay(f0_26()) != gia_536[2]) {
         gia_536[2] = TimeDay(f0_26());
         f0_20();
      }
   }
}

int f0_5() {
   double ld_0;
   int li_12;
   int cmd_16;
   double order_takeprofit_24;
   int li_32;
   int li_36;
   int order_total_20 = OrdersTotal();
   for (int pos_8 = 0; pos_8 < order_total_20; pos_8++) {
      if (OrderSelect(pos_8, SELECT_BY_POS)) {
         cmd_16 = OrderType();
         if (cmd_16 != OP_BUY && cmd_16 != OP_SELL) continue;
         li_12 = f0_21(OrderMagicNumber(), pos_8, 0);
         if (li_12 < 1 || li_12 >= 21) continue;
         gsa_432[li_12] = OrderSymbol();
         gda_436[li_12][7]++;
         gda_436[li_12][8] += OrderSwap();
         gda_436[li_12][9] = MarketInfo(OrderSymbol(), MODE_SPREAD);
         if (gi_524) gda_436[li_12][9] = gda_436[li_12][9] / 10.0;
         ld_0 = OrderProfit() + OrderCommission() + OrderSwap();
         gda_436[li_12][4] += ld_0;
         if (cmd_16 == OP_BUY) {
            gda_436[li_12][1]++;
            gda_436[li_12][0] += OrderLots();
            if (gda_436[li_12][12] == 0.0 || gda_436[li_12][12] > OrderOpenTime()) gda_436[li_12][12] = OrderOpenTime();
            order_takeprofit_24 = OrderTakeProfit();
            if (order_takeprofit_24 == 0.0) order_takeprofit_24 = f0_14(li_12, 0);
            gda_436[li_12][5] = order_takeprofit_24;
         } else {
            gda_436[li_12][3]++;
            gda_436[li_12][2] += OrderLots();
            if (gda_436[li_12][13] == 0.0 || gda_436[li_12][13] > OrderOpenTime()) gda_436[li_12][13] = OrderOpenTime();
            order_takeprofit_24 = OrderTakeProfit();
            if (order_takeprofit_24 == 0.0) order_takeprofit_24 = f0_14(li_12, 1);
            gda_436[li_12][6] = order_takeprofit_24;
         }
         ld_0 = f0_9(OrderLots(), OrderOpenPrice(), order_takeprofit_24, cmd_16, OrderSymbol()) + OrderCommission() + OrderSwap();
         if (cmd_16 == OP_BUY) {
            gda_436[li_12][10] += ld_0;
            continue;
         }
         gda_436[li_12][11] += ld_0;
      }
   }
   if (g_day_of_week_516 != TimeDayOfWeek(f0_26())) {
      g_day_of_week_516 = TimeDayOfWeek(f0_26());
      g_hist_total_512 = -1;
   }
   if (gi_500 && g_hist_total_512 != OrdersHistoryTotal()) {
      f0_24("Year = " + TimeYear(f0_26()));
      f0_24("Day = " + TimeDayOfYear(f0_26()));
      li_32 = TimeYear(f0_26());
      li_36 = TimeDayOfYear(f0_26()) - 1;
      if (TimeDayOfWeek(f0_26()) == 1) {
         li_36 -= 2;
         f0_24("Monday, people.");
      }
      if (li_36 <= 0) {
         li_36 += 365;
         li_32--;
         f0_24("Happy New Year!");
      }
      f0_24("wantDay = " + li_36);
      f0_24("wantYear = " + li_32);
      g_hist_total_512 = OrdersHistoryTotal();
      ArrayInitialize(gda_440, 0.0);
      for (pos_8 = 0; pos_8 < g_hist_total_512; pos_8++) {
         OrderSelect(pos_8, SELECT_BY_POS, MODE_HISTORY);
         li_12 = f0_21(OrderMagicNumber(), pos_8, 1);
         gsa_432[li_12] = OrderSymbol();
         if (TimeYear(f0_26()) == TimeYear(OrderCloseTime() + TimeShift) && TimeDayOfYear(f0_26()) == TimeDayOfYear(OrderCloseTime() + TimeShift)) {
            ld_0 = OrderProfit() + OrderCommission() + OrderSwap();
            gda_440[li_12][0] += ld_0;
         } else {
            if (li_32 == TimeYear(OrderCloseTime() + TimeShift) && li_36 == TimeDayOfYear(OrderCloseTime() + TimeShift)) {
               ld_0 = OrderProfit() + OrderCommission() + OrderSwap();
               gda_440[li_12][1] += ld_0;
            }
         }
      }
   }
   return (0);
}

double f0_14(int ai_0, int ai_4) {
   string var_name_52;
   string ls_8 = "S4";
   string ls_16 = gsa_432[ai_0];
   string ls_24 = ls_16 + "type" + ls_8;
   string ls_32 = ls_16 + "ticket" + ls_8;
   string ls_40 = ls_16 + "takeprofit" + ls_8;
   for (int li_48 = 24; li_48 >= 0; li_48--) {
      var_name_52 = ls_32 + DoubleToStr(li_48, 0);
      if (GlobalVariableGet(var_name_52) > 0.0) {
         var_name_52 = ls_24 + DoubleToStr(li_48, 0);
         if (GlobalVariableGet(var_name_52) == ai_4) {
            var_name_52 = ls_40 + DoubleToStr(li_48, 0);
            return (GlobalVariableGet(var_name_52));
         }
      }
   }
   return (0);
}

void f0_3(string a_name_0, string as_8, color a_color_16) {
   if (StringLen(as_8) == 0) {
      ObjectSet(a_name_0, OBJPROP_TIMEFRAMES, EMPTY);
      return;
   }
   ObjectSet(a_name_0, OBJPROP_TIMEFRAMES, NULL);
   ObjectSetText(a_name_0, as_8, 9, "Arial", a_color_16);
}

string f0_8(int ai_0) {
   switch (ai_0) {
   case 0:
      return ("floating profit/loss NOT used");
   case 1:
      return ("floating profit+loss");
   case 2:
      return ("floating profit only");
   case 3:
      return ("floating loss only");
   }
   return ("unknown mode");
}

double f0_12() {
   if (AccountMargin() == 0.0) return (0);
   switch (AccountStopoutMode()) {
   case 0:
      return (100.0 * (AccountEquity() / AccountMargin()));
   case 1:
      return (100.0 * (AccountStopoutLevel() / AccountMargin() - 1.0));
   }
   return (-1);
}

string f0_16(double ad_0, bool ai_8) {
   string ls_12 = " ";
   if (ai_8) ls_12 = "";
   return (f0_2(ad_0, ai_8, ls_12));
}

string f0_2(double ad_0, bool ai_8, string as_12) {
   if (ad_0 < 0.0) as_12 = "";
   if (ai_8) return (gs_528 + " " + as_12 + DoubleToStr(ad_0 / BalanceMultiplier, 2));
   return (as_12 + DoubleToStr(ad_0 / BalanceMultiplier, 2));
}

void f0_19() {
   if (StringFind(AccountCompany(), "InstaForex") == 0) {
      gi_520 = AccountLeverage() * 2;
      return;
   }
   gi_520 = AccountLeverage();
}

void f0_0() {
   int li_0;
   for (int li_4 = 1; li_4 < 21; li_4++) {
      if (gda_436[li_4][0] > 0.0 && gda_436[li_4][10] < 0.0) {
         li_0 = gia_444[li_4][0];
         if (li_0 == 0) {
            f0_24("Negative basket detection; ts = " + li_0 + "; pair = " + li_4 + "; buy");
            gia_444[li_4][0] = TimeCurrent();
         } else {
            if (li_0 + NegativeBasketAlertDelay <= TimeCurrent()) {
               gia_444[li_4][0] = TimeCurrent();
               f0_13(li_4, 0);
            }
         }
      } else gia_444[li_4][0] = 0;
      if (gda_436[li_4][2] > 0.0 && gda_436[li_4][11] < 0.0) {
         li_0 = gia_444[li_4][1];
         if (li_0 == 0) {
            f0_24("Negative basket detection; ts = " + li_0 + "; pair = " + li_4 + "; sell");
            gia_444[li_4][1] = TimeCurrent();
            continue;
         }
         if (li_0 + NegativeBasketAlertDelay <= TimeCurrent()) {
            gia_444[li_4][1] = TimeCurrent();
            f0_13(li_4, 1);
         }
      } else gia_444[li_4][1] = 0;
   }
}

void f0_13(int ai_0, int ai_4) {
   int digits_12;
   double ld_16;
   int ticket_8 = f0_23(ai_0, ai_4, 0);
   if (gia_448[ai_0][ai_4] != ticket_8) {
      gia_448[ai_0][ai_4] = ticket_8;
      if (OrderSelect(ticket_8, SELECT_BY_TICKET)) {
         digits_12 = MarketInfo(OrderSymbol(), MODE_DIGITS);
         ld_16 = f0_1(ai_0, ai_4);
         if (ai_4 == 0) Alert("Negative basket formed on (buy) pair " + ai_0 + "! T/P for breakeven = " + DoubleToStr(ld_16, digits_12));
         else Alert("Negative basket formed on (sell) pair " + ai_0 + "! T/P for breakeven = " + DoubleToStr(ld_16, digits_12));
      }
   }
}

int f0_21(int ai_0, int a_pos_4, bool ai_8) {
   int ticket_16;
   for (int li_ret_12 = 1; li_ret_12 < 21; li_ret_12++)
      if (gia_452[li_ret_12] == ai_0) return (li_ret_12);
   if (ai_0 < 21) return (ai_0);
   if (!ai_8) {
      if (!OrderSelect(a_pos_4, SELECT_BY_POS, MODE_TRADES)) return (0);
      ticket_16 = f0_23(OrderMagicNumber(), OrderType(), 0);
      if (!OrderSelect(ticket_16, SELECT_BY_TICKET, MODE_TRADES)) return (0);
   } else
      if (!OrderSelect(a_pos_4, SELECT_BY_POS, MODE_HISTORY)) return (0);
   double order_takeprofit_20 = OrderTakeProfit();
   int digits_28 = MarketInfo(OrderSymbol(), MODE_DIGITS);
   double ld_32 = f0_6(digits_28);
   int li_40 = MathAbs((OrderOpenPrice() - order_takeprofit_20) / ld_32);
   string symbol_44 = OrderSymbol();
   int li_ret_52 = 0;
   if (li_40 > 30) {
      if (StringFind(symbol_44, "EURUSD") == 0) li_ret_52 = 1;
      if (StringFind(symbol_44, "GBPUSD") == 0) li_ret_52 = 2;
      if (StringFind(symbol_44, "EURJPY") == 0) li_ret_52 = 3;
      if (StringFind(symbol_44, "EURGBP") == 0) li_ret_52 = 4;
      if (StringFind(symbol_44, "USDCAD") == 0) li_ret_52 = 5;
      if (StringFind(symbol_44, "AUDUSD") == 0) li_ret_52 = 6;
      if (StringFind(symbol_44, "NZDUSD") == 0) li_ret_52 = 7;
      if (StringFind(symbol_44, "USDJPY") == 0) li_ret_52 = 8;
      if (StringFind(symbol_44, "AUDNZD") == 0) li_ret_52 = 9;
   } else {
      if (StringFind(symbol_44, "EURUSD") == 0) li_ret_52 = 11;
      if (StringFind(symbol_44, "GBPUSD") == 0) li_ret_52 = 12;
      if (StringFind(symbol_44, "EURJPY") == 0) li_ret_52 = 13;
      if (StringFind(symbol_44, "USDCAD") == 0) li_ret_52 = 14;
      if (StringFind(symbol_44, "USDJPY") == 0) li_ret_52 = 15;
      if (StringFind(symbol_44, "AUDUSD") == 0) li_ret_52 = 16;
      if (StringFind(symbol_44, "NZDUSD") == 0) li_ret_52 = 17;
      if (StringFind(symbol_44, "USDJPY") == 0) li_ret_52 = 18;
      if (StringFind(symbol_44, "AUDNZD") == 0) li_ret_52 = 19;         
      
   }
   if (li_ret_52 > 0) {
      if (gia_452[li_ret_52] > 0 && OrderMagicNumber() != gia_452[li_ret_52]) return (0);
      gsa_432[li_ret_52] = symbol_44;
      gia_452[li_ret_52] = OrderMagicNumber();
   }
   return (li_ret_52);
}

int f0_26() {
   return (TimeCurrent() + TimeShift);
}

bool f0_22() {
   return (false);
}

void f0_24(string as_0) {
   if (f0_22()) Print(as_0);
}

void f0_7() {
}

void f0_17() {
}

void f0_20() {
   //f0_10();
   if (TimeDayOfWeek(f0_26()) == 1) f0_4();
}

void f0_4() {
   int day_of_week_0;
   int li_4;
   int global_var_8;
   if (ResetMaxValuesEachWeek) {
      day_of_week_0 = TimeDayOfWeek(f0_26());
      if (day_of_week_0 == 0) day_of_week_0 = 7;
      li_4 = TimeDayOfYear(f0_26()) - day_of_week_0 + 1;
      global_var_8 = GlobalVariableGet("basketExposureWeekNo");
      f0_24("ResetMaxCounters");
      f0_24(day_of_week_0);
      f0_24(TimeDayOfYear(f0_26()));
      f0_24(li_4);
      if (global_var_8 != li_4) {
         GlobalVariableSet("basketExposureWeekNo", li_4);
         if (global_var_8 > 0) {
            f0_24("ResetMaxCounters");
            GlobalVariableSet("basketExposureMaxMarginUsed", 0);
            GlobalVariableSet("basketExposureMaxDD", 0);
         }
      }
   }
}

/*void f0_10() {
   string ls_0;
   string lsa_8[];
   string lsa_16[];
   int str2int_20;
   if (IsDllsAllowed()) {
      ls_0 = f0_25("http://umeku.com/fx/basketExposure/build.txt?ts=" + TimeLocal() + "&build=" + 51);
      f0_24("Version Check = " + ls_0);
      f0_11(ls_0, 
      "\n", lsa_8);
      for (int index_12 = 0; index_12 < ArraySize(lsa_8); index_12++) {
         f0_24("Version " + index_12 + " = " + lsa_8[index_12]);
         if (f0_11(lsa_8[index_12], ":", lsa_16, 3) && lsa_16[0] == "1") {
            f0_24("v1 = " + lsa_16[0]);
            f0_24("v2 = " + lsa_16[1]);
            f0_24("v3 = " + lsa_16[2]);
            str2int_20 = StrToInteger(lsa_16[1]);
            if (str2int_20 > 51) Alert("A new version of basketExposure is available (v" + lsa_16[2] + ")\nVisit http://umeku.com/fx/basketExposure/ for download.");
         }
      }
   }
}*/