/*
   Generated by EX4-TO-MQ4 decompiler V4.0.220.2c []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2008, Dean Malone"
#property link      "www.compassfx.com"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 DimGray
#property indicator_color2 DimGray
#property indicator_color3 DimGray
#property indicator_color4 DimGray
#property indicator_color5 MediumOrchid
#property indicator_color6 DimGray
#property indicator_color7 DimGray
#property indicator_color8 DimGray
/*
#import "as2_updater.dll"
   int isExeRunning();
   int runAutoUpdater();
   int isInstallerRunning();
   int runAutoInstaller();
#import "Synergy.dll"
   string gGrab(string a0, string a1);
#import
*/
int gi_76 = -1;
double g_ibuf_80[];
double gda_84[10];
string gsa_88[10];
string gsa_92[10];
int g_file_96;
int g_time_100 = 0;
extern string Custom_Indicator = "Synergy Trade Targets";
extern string Copyright = "© 2008, Dean Malone";
extern string Web_Address = "www.compassfx.com";
extern string label = "--Login Information--";
extern string EMail = "";
extern string Password = "";
int g_str2int_152 = 80;
extern int MT4_Hour = 7;
extern int MT4_Minute = 0;
double g_ibuf_164[];
double g_ibuf_168[];
double g_ibuf_172[];
double g_ibuf_176[];
double g_ibuf_180[];
double g_ibuf_184[];
double g_ibuf_188[];
double g_ibuf_192[];
int g_file_196;
int g_datetime_200;
bool gi_204 = FALSE;
string gs_208;
string gs_216;
string gs_224;
string gs_232;
int g_str2int_240;
int g_global_var_244;
int g_datetime_248;
bool gi_252 = FALSE;
string gs_unused_256 = "High Point";
string gs_unused_264 = "H 1";
string gs_unused_272 = "H 2";
string gs_unused_280 = "H 3";
string gs_unused_288 = "H 4";
string gs_unused_296 = "H 5";
string gs_unused_304 = "H 6";
string gs_unused_312 = "H 7";
int gi_unused_320 = 10;
double g_high_324;
double gd_332;
double gd_340;
double gd_348;
double gd_356;
double gd_364;
double gd_372;
double gd_380;
double gd_388;
double gd_396;
double gd_404;
double gd_412;
double gd_420;
double gd_428;
double gd_436;
double gd_444;
double gd_452;
double gd_460;
double gd_468;
double gd_476;
double gd_484;
double gd_492;
double gd_500;
double gd_508;
double gd_516;
double gd_524;
double gd_532;
double gd_540;
double gd_548;
double gd_556;
double gd_564;
double gd_572;
double gd_580;
double gd_588;
double gd_596;
double g_timeframe_604;
double gd_612;
string gs_620 = "http://www.synergyforex.com/server/server2/";
string gs_628 = "http://www.compassfx.com/server/";
string gs_636;
int gi_644 = -1;
bool gi_648 = TRUE;

int doLoginCheck(string as_0) {
   double lda_16[10];
   string lsa_20[10];
   string ls_unused_24;
   bool li_8 = FALSE;
   int l_file_12 = FileOpen("indicators_debug.txt", FILE_CSV|FILE_READ, ",");
   if (l_file_12 != -1) {
      if (FileSize(l_file_12) > 100000) {
         FileClose(l_file_12);
         FileDelete("indicators_debug.txt");
      } else FileClose(l_file_12);
   }
   int l_index_44 = 0;
   bool li_48 = FALSE;
   ArrayInitialize(lda_16, 2.01);
   fillGlobalBuffers(as_0);
   int li_40 = openOutputFile();
   lda_16[0] = iCustom(NULL, 0, "Synergy_TradeSignal", "verInfo_AS", 0, 0);
   lsa_20[0] = "Synergy_TradeSignal";
   lda_16[1] = iCustom(NULL, 0, "Synergy_Continuation", "verInfo_AS", 0, 0);
   lsa_20[1] = "Synergy_Continuation";
   lda_16[2] = iCustom(NULL, 0, "Synergy_Volatility", "verInfo_AS", 0, 0);
   lsa_20[2] = "Synergy_Volatility";
   lda_16[3] = iCustom(NULL, 0, "Synergy_DSR", "verInfo_AS", 0, 0);
   lsa_20[3] = "Synergy_DSR";
   lda_16[4] = iCustom(NULL, 0, "Synergy_TDI", "verInfo_AS", 0, 0);
   lsa_20[4] = "Synergy_TDI";
   lda_16[5] = iCustom(NULL, 0, "Synergy_HeikenAshi", "verInfo_AS", 0, 0);
   lsa_20[5] = "Synergy_HeikenAshi";
   lda_16[6] = iCustom(NULL, 0, "Synergy_RangeFactor", "verInfo_AS", 0, 0);
   lsa_20[6] = "Synergy_RangeFactor";
   lda_16[7] = iCustom(NULL, 0, "Synergy_MTF", "verInfo_AS", 0, 0);
   lsa_20[7] = "Synergy_MTF";
   lda_16[8] = iCustom(NULL, 0, "Synergy_TradeTargets", "verInfo_AS", 0, 0);
   lsa_20[8] = "Synergy_TradeTargets";
   for (int l_index_32 = 0; l_index_32 < gi_76; l_index_32++) {
      for (int l_index_36 = 0; l_index_36 < 9; l_index_36++) {
         if (gsa_88[l_index_32] == lsa_20[l_index_36]) {
            li_8 = TRUE;
            Print("Indicator : ", lsa_20[l_index_36], " Value : ", lda_16[l_index_36], " Latest Version : ", gda_84[l_index_32]);
            if (lda_16[l_index_36] < gda_84[l_index_32]) {
               gsa_92[l_index_44] = gsa_88[l_index_32];
               l_index_44++;
               if (MathAbs(lda_16[l_index_36] - gda_84[l_index_32]) >= 0.05) {
                  li_48 = TRUE;
                  if (!GlobalVariableCheck("rA_synergy")) GlobalVariableSet("rA_synergy", 1);
               }
            }
         }
      }
      if (!li_8) {
         gsa_92[l_index_44] = gsa_88[l_index_32];
         l_index_44++;
      }
      li_8 = FALSE;
   }
   Print("-- Advanced Synergy Version Information --");
   Print("Files that need to be updated: ", l_index_44);
   if (l_index_44 > 0) Print("Executing AutoUpdater.exe now...");
   writeOutputFile(li_40, l_index_44);
   closeOutputFile(li_40, l_index_44);
   if (l_index_44 == 0) return (0);
   int li_52 = runAutoUpdater();
   if (li_48 == FALSE) return (0);
   return (1);
}

int openOutputFile() {
   bool li_ret_4;
   FileDelete("as2_update.txt");
   int l_file_0 = FileOpen("as2_update.txt", FILE_WRITE);
   if (l_file_0 < 1) {
      Alert("Can not open as2_update.txt for writing!");
      li_ret_4 = TRUE;
   } else li_ret_4 = FALSE;
   if (li_ret_4 == FALSE) return (l_file_0);
   else return (li_ret_4);
}

void writeOutputFile(int ai_0, int ai_4) {
   FileWrite(ai_0, ai_4);
   for (int l_index_12 = 0; l_index_12 < ai_4; l_index_12++) FileWrite(ai_0, gsa_92[l_index_12] + ".ex4");
}

void closeOutputFile(int a_file_0, int ai_unused_4) {
   FileClose(a_file_0);
}

void fillGlobalBuffers(string as_0) {
   string ls_8;
   string ls_16;
   string ls_24;
   int li_32 = -1;
   int l_index_40 = 0;
   string ls_44 = "";//gGrab(as_0 + "update.php", 0);
   FileDelete("temp.txt");
   int l_file_36 = FileOpen("temp.txt", FILE_WRITE|FILE_READ);
   if (l_file_36 < 1) {
      Alert("Can not open temp text file!");
      return;
   }
   Print(ls_44);
   FileWrite(l_file_36, ls_44);
   FileSeek(l_file_36, 0, SEEK_SET);
   gi_76 = StrToDouble(FileReadString(l_file_36));
   while (true) {
      ls_24 = FileReadString(l_file_36);
      if (StringFind(ls_24, "DONE") != -1) break;
      li_32 = StringFind(ls_24, ",", 0);
      ls_8 = StringSubstr(ls_24, 0, li_32);
      ls_16 = StringSubstr(ls_24, li_32 + 1, StringLen(ls_24) - li_32);
      gda_84[l_index_40] = StrToDouble(ls_16);
      gsa_88[l_index_40] = ls_8;
      l_index_40++;
      if (!(FileIsEnding(l_file_36))) continue;
      break;
   }
   FileClose(l_file_36);
}

void logResult(string as_0, int ai_8, string as_12) {
   int l_file_20 = FileOpen("indicators_debug.txt", FILE_CSV|FILE_WRITE|FILE_READ, ",");
   if (l_file_20 < 1) {
      Print("Cannot open indicators_debug.txt for appendage!");
      return;
   }
   if (FileSeek(l_file_20, 0, SEEK_END) == FALSE) {
      Print("Problem seeking to the end of the file! Aborting...");
      return;
   }
   FileWrite(l_file_20, as_0, TimeCurrent(), ai_8, as_12);
   FileClose(l_file_20);
}

int deinit() {
   EraseEverything();
   return (0);
}

int init() {
   if (Custom_Indicator == "verInfo_AS") {
      IndicatorBuffers(1);
      SetIndexBuffer(0, g_ibuf_80);
      return (0);
   }
   EraseEverything();
   gi_204 = FALSE;
   g_file_196 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
   if (g_file_196 < 1) {
      gi_252 = FALSE;
      if (isInstallerRunning() != 1) {
         gi_204 = TRUE;
         return (0);
      }
      runAutoInstaller();
      gi_204 = TRUE;
      return (0);
   }
   gs_208 = FileReadString(g_file_196);
   gs_216 = FileReadString(g_file_196);
   g_str2int_240 = StrToInteger(FileReadString(g_file_196));
   gs_636 = FileReadString(g_file_196);
   if (gs_636 == "") gs_636 = "x";
   FileClose(g_file_196);
   gi_252 = TRUE;
   gs_224 = gs_208;
   gs_232 = gs_216;
   gs_224 = gs_208;
   gs_232 = gs_216;
   if (GlobalVariableCheck("aSyn")) {
      g_global_var_244 = GlobalVariableGet("aSyn");
      g_datetime_248 = TimeLocal();
      if (g_global_var_244 > g_datetime_248) {
         gi_204 = mylogin(gs_208, gs_216);
         if (gi_644 == 1) {
            gi_204 = mylogin(gs_208, gs_216);
            gi_644 = -1;
         }
         if (gi_204) return (0);
      }
      if (g_datetime_248 - g_global_var_244 >= 900) {
         gi_204 = mylogin(gs_208, gs_216);
         if (gi_644 == 1) {
            gi_204 = mylogin(gs_208, gs_216);
            gi_644 = -1;
         }
         if (gi_204) return (0);
      }
      if (g_datetime_248 - g_global_var_244 > g_str2int_152) {
         gi_204 = mykeepalive();
         if (gi_644 == 1) {
            gi_204 = mykeepalive();
            gi_644 = -1;
         }
         if (gi_204) return (0);
      }
   } else {
      gi_204 = mylogin(gs_208, gs_216);
      if (gi_644 == 1) {
         gi_204 = mylogin(gs_208, gs_216);
         gi_644 = -1;
      }
      return (0);
   }
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_NONE, STYLE_SOLID, 1, DimGray);
   SetIndexStyle(1, DRAW_NONE, STYLE_DOT, 1, DimGray);
   SetIndexStyle(2, DRAW_NONE, STYLE_SOLID, 1, DimGray);
   SetIndexStyle(3, DRAW_NONE, STYLE_DOT, 1, DimGray);
   SetIndexStyle(4, DRAW_NONE, STYLE_SOLID, 2, MediumOrchid);
   SetIndexStyle(5, DRAW_NONE, STYLE_DOT, 1, DimGray);
   SetIndexStyle(6, DRAW_NONE, STYLE_SOLID, 1, DimGray);
   SetIndexStyle(7, DRAW_NONE, STYLE_DOT, 1, DimGray);
   SetIndexBuffer(0, g_ibuf_164);
   SetIndexBuffer(1, g_ibuf_168);
   SetIndexBuffer(2, g_ibuf_172);
   SetIndexBuffer(3, g_ibuf_176);
   SetIndexBuffer(4, g_ibuf_180);
   SetIndexBuffer(5, g_ibuf_184);
   SetIndexBuffer(6, g_ibuf_188);
   SetIndexBuffer(7, g_ibuf_192);
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   SetIndexLabel(3, NULL);
   SetIndexLabel(4, NULL);
   SetIndexLabel(5, NULL);
   SetIndexLabel(6, NULL);
   SetIndexLabel(7, NULL);
   string ls_0 = "Highs";
   IndicatorShortName(ls_0);
   SetIndexLabel(0, NULL);
   SetIndexDrawBegin(0, 1);
   return (0);
}

int start() {
   //if (gi_204) return (0);
   if (Custom_Indicator == "verInfo_AS") {
      g_ibuf_80[0] = 2.02;
      return (0);
   }
   if (!gi_204) {
      if (GlobalVariableCheck("aSyn")) {
         g_global_var_244 = GlobalVariableGet("aSyn");
         g_datetime_248 = TimeLocal();
         if (g_global_var_244 > g_datetime_248) {
            gi_204 = mylogin(gs_208, gs_216);
            if (gi_644 == 1) {
               gi_204 = mylogin(gs_208, gs_216);
               gi_644 = -1;
            }
            if (gi_204) return (0);
         }
         if (g_datetime_248 - g_global_var_244 >= 1800) {
            gi_204 = mylogin(gs_208, gs_216);
            if (gi_644 == 1) {
               gi_204 = mylogin(gs_208, gs_216);
               gi_644 = -1;
            }
            if (gi_204) return (0);
         }
         if (g_datetime_248 - g_global_var_244 > g_str2int_152) {
            gi_204 = mykeepalive();
            if (gi_644 == 1) {
               gi_204 = mykeepalive();
               gi_644 = -1;
            }
            if (gi_204) return (0);
         }
      } else {
         resetIndy();
         gi_204 = TRUE;
         return (0);
      }
   }
   int l_ind_counted_4 = IndicatorCounted();
   if (l_ind_counted_4 < 0) return (-1);
   int li_8 = Bars - l_ind_counted_4;
   if (li_8 > 0) li_8--;
   int li_16 = (60 * MT4_Hour + MT4_Minute) / Period();
   for (int li_12 = li_8; li_12 >= 0; li_12--) {
      if (High[li_12 + 1] > gd_588) gd_588 = High[li_12 + 1];
      if (Low[li_12 + 1] < gd_596) gd_596 = Low[li_12 + 1];
      g_ibuf_188[li_12] = gd_588;
      g_ibuf_192[li_12] = gd_596;
      if (TimeDay(Time[li_12 + li_16]) != TimeDay(Time[li_12 + li_16 + 1])) {
         if (gi_648) {
            gd_612 = (gd_588 - gd_596) / 8.0;
            g_high_324 = gd_588;
            gd_356 = g_high_324 - 4.0 * gd_612;
            gd_332 = g_high_324 - gd_612;
            gd_340 = g_high_324 - 2.0 * gd_612;
            gd_348 = g_high_324 - 3.0 * gd_612;
            gd_364 = g_high_324 + gd_612;
            gd_372 = g_high_324 + 2.0 * gd_612;
            gd_380 = g_high_324 + 3.0 * gd_612;
            gd_388 = g_high_324 + 4.0 * gd_612;
            gd_396 = g_high_324 + 5.0 * gd_612;
            gd_404 = g_high_324 + 6.0 * gd_612;
            gd_412 = g_high_324 + 7.0 * gd_612;
            gd_420 = g_high_324 + 8.0 * gd_612;
            gd_428 = g_high_324 + 9.0 * gd_612;
            gd_436 = g_high_324 + 10.0 * gd_612;
            gd_444 = g_high_324 + 11.0 * gd_612;
            gd_452 = g_high_324 + 12.0 * gd_612;
            gd_460 = gd_356 - gd_612;
            gd_468 = gd_356 - 2.0 * gd_612;
            gd_476 = gd_356 - 3.0 * gd_612;
            gd_484 = gd_356 - 4.0 * gd_612;
            gd_492 = gd_356 - 5.0 * gd_612;
            gd_500 = gd_356 - 6.0 * gd_612;
            gd_508 = gd_356 - 7.0 * gd_612;
            gd_516 = gd_356 - 8.0 * gd_612;
            gd_524 = gd_356 - 9.0 * gd_612;
            gd_532 = gd_356 - 10.0 * gd_612;
            gd_540 = gd_356 - 11.0 * gd_612;
            gd_548 = gd_356 - 12.0 * gd_612;
            gd_556 = gd_356 - 13.0 * gd_612;
            gd_564 = gd_356 - 14.0 * gd_612;
            gd_572 = gd_356 - 15.0 * gd_612;
            gd_580 = gd_356 - 16.0 * gd_612;
            gd_596 = Open[li_12];
            gd_588 = Open[li_12];
            ObjectMove("High", 0, Time[0], g_high_324);
            ObjectMove("Hi1", 0, Time[0], gd_332);
            ObjectMove("Hi2", 0, Time[0], gd_340);
            ObjectMove("Hi3", 0, Time[0], gd_348);
            ObjectMove("Hi4", 0, Time[0], gd_356);
            ObjectMove("Hi5", 0, Time[0], gd_364);
            ObjectMove("Hi6", 0, Time[0], gd_372);
            ObjectMove("Hi7", 0, Time[0], gd_380);
            ObjectMove("Hi8", 0, Time[0], gd_388);
            ObjectMove("Hi9", 0, Time[0], gd_396);
            ObjectMove("Hi10", 0, Time[0], gd_404);
            ObjectMove("Hi11", 0, Time[0], gd_412);
            ObjectMove("Hi12", 0, Time[0], gd_420);
            ObjectMove("Hi13", 0, Time[0], gd_428);
            ObjectMove("Hi14", 0, Time[0], gd_436);
            ObjectMove("Hi15", 0, Time[0], gd_444);
            ObjectMove("Hi15", 0, Time[0], gd_452);
            ObjectMove("li1", 0, Time[0], gd_460);
            ObjectMove("li2", 0, Time[0], gd_468);
            ObjectMove("li3", 0, Time[0], gd_476);
            ObjectMove("i4", 0, Time[0], gd_484);
            ObjectMove("li5", 0, Time[0], gd_492);
            ObjectMove("li6", 0, Time[0], gd_500);
            ObjectMove("li7", 0, Time[0], gd_508);
            ObjectMove("li8", 0, Time[0], gd_516);
            ObjectMove("li9", 0, Time[0], gd_524);
            ObjectMove("li10", 0, Time[0], gd_532);
            ObjectMove("li11", 0, Time[0], gd_540);
            ObjectMove("li12", 0, Time[0], gd_548);
            ObjectMove("li13", 0, Time[0], gd_556);
            ObjectMove("li14", 0, Time[0], gd_564);
            ObjectMove("li15", 0, Time[0], gd_572);
            ObjectMove("li15", 0, Time[0], gd_580);
            ObjectCreateX(g_high_324 - 4.0 * gd_612, gd_612, Time[li_12], Time[li_12 + 1]);
            g_time_100 = Time[li_12];
            ObjectSetText("High", "                              " + DoubleToStr(g_high_324, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi1", "                               " + DoubleToStr(gd_332, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi2", "                               " + DoubleToStr(gd_340, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi3", "                               " + DoubleToStr(gd_348, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi4", "                               " + DoubleToStr(gd_356, 4), 9, "Arial", MediumOrchid);
            ObjectSetText("Hi5", "                               " + DoubleToStr(gd_364, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi6", "                               " + DoubleToStr(gd_372, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi7", "                               " + DoubleToStr(gd_380, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi8", "                               " + DoubleToStr(gd_388, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi9", "                               " + DoubleToStr(gd_396, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi10", "                               " + DoubleToStr(gd_404, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi11", "                               " + DoubleToStr(gd_412, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi12", "                               " + DoubleToStr(gd_420, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi13", "                               " + DoubleToStr(gd_428, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi14", "                               " + DoubleToStr(gd_436, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi15", "                               " + DoubleToStr(gd_444, 4), 9, "Arial", DimGray);
            ObjectSetText("Hi16", "                               " + DoubleToStr(gd_452, 4), 9, "Arial", DimGray);
            ObjectSetText("li1", "                               " + DoubleToStr(gd_460, 4), 9, "Arial", DimGray);
            ObjectSetText("li2", "                               " + DoubleToStr(gd_468, 4), 9, "Arial", DimGray);
            ObjectSetText("li3", "                               " + DoubleToStr(gd_476, 4), 9, "Arial", DimGray);
            ObjectSetText("li4", "                               " + DoubleToStr(gd_484, 4), 9, "Arial", DimGray);
            ObjectSetText("li5", "                               " + DoubleToStr(gd_492, 4), 9, "Arial", DimGray);
            ObjectSetText("li6", "                               " + DoubleToStr(gd_500, 4), 9, "Arial", DimGray);
            ObjectSetText("li7", "                               " + DoubleToStr(gd_508, 4), 9, "Arial", DimGray);
            ObjectSetText("li8", "                               " + DoubleToStr(gd_516, 4), 9, "Arial", DimGray);
            ObjectSetText("li9", "                               " + DoubleToStr(gd_524, 4), 9, "Arial", DimGray);
            ObjectSetText("li10", "                               " + DoubleToStr(gd_532, 4), 9, "Arial", DimGray);
            ObjectSetText("li11", "                               " + DoubleToStr(gd_540, 4), 9, "Arial", DimGray);
            ObjectSetText("li12", "                               " + DoubleToStr(gd_548, 4), 9, "Arial", DimGray);
            ObjectSetText("li13", "                               " + DoubleToStr(gd_556, 4), 9, "Arial", DimGray);
            ObjectSetText("li14", "                               " + DoubleToStr(gd_564, 4), 9, "Arial", DimGray);
            ObjectSetText("li15", "                               " + DoubleToStr(gd_572, 4), 9, "Arial", DimGray);
            ObjectSetText("li16", "                               " + DoubleToStr(gd_580, 4), 9, "Arial", DimGray);
            gi_648 = FALSE;
         }
      } else {
         ObjectsMoveForward(g_time_100, Time[li_12]);
         gi_648 = TRUE;
      }
   }
   if (l_ind_counted_4 == 0) {
      g_timeframe_604 = Period();
      if (g_timeframe_604 > 240.0) return (-1);
      ObjectCreate("High", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("High", "                              " + DoubleToStr(g_high_324, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi1", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi1", "                               " + DoubleToStr(gd_332, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi2", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi2", "                               " + DoubleToStr(gd_340, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi3", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi3", "                               " + DoubleToStr(gd_348, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi4", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi4", "                               " + DoubleToStr(gd_356, 4), 9, "Arial", MediumOrchid);
      ObjectCreate("Hi5", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi5", "                               " + DoubleToStr(gd_364, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi6", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi6", "                               " + DoubleToStr(gd_372, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi7", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi7", "                               " + DoubleToStr(gd_380, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi8", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi8", "                               " + DoubleToStr(gd_388, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi9", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi9", "                               " + DoubleToStr(gd_396, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi10", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi10", "                               " + DoubleToStr(gd_404, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi11", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi11", "                               " + DoubleToStr(gd_412, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi12", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi12", "                               " + DoubleToStr(gd_420, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi13", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi13", "                               " + DoubleToStr(gd_428, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi14", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi14", "                               " + DoubleToStr(gd_436, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi15", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi15", "                               " + DoubleToStr(gd_444, 4), 9, "Arial", DimGray);
      ObjectCreate("Hi16", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("Hi16", "                               " + DoubleToStr(gd_452, 4), 9, "Arial", DimGray);
      ObjectCreate("li1", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li1", "                               " + DoubleToStr(gd_460, 4), 9, "Arial", DimGray);
      ObjectCreate("li2", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li2", "                               " + DoubleToStr(gd_468, 4), 9, "Arial", DimGray);
      ObjectCreate("li3", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li3", "                               " + DoubleToStr(gd_476, 4), 9, "Arial", DimGray);
      ObjectCreate("li4", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li4", "                               " + DoubleToStr(gd_484, 4), 9, "Arial", DimGray);
      ObjectCreate("li5", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li5", "                               " + DoubleToStr(gd_492, 4), 9, "Arial", DimGray);
      ObjectCreate("li6", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li6", "                               " + DoubleToStr(gd_500, 4), 9, "Arial", DimGray);
      ObjectCreate("li7", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li7", "                               " + DoubleToStr(gd_508, 4), 9, "Arial", DimGray);
      ObjectCreate("li8", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li8", "                               " + DoubleToStr(gd_516, 4), 9, "Arial", DimGray);
      ObjectCreate("li9", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li9", "                               " + DoubleToStr(gd_524, 4), 9, "Arial", DimGray);
      ObjectCreate("li10", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li10", "                               " + DoubleToStr(gd_532, 4), 9, "Arial", DimGray);
      ObjectCreate("li11", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li11", "                               " + DoubleToStr(gd_540, 4), 9, "Arial", DimGray);
      ObjectCreate("li12", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li12", "                               " + DoubleToStr(gd_548, 4), 9, "Arial", DimGray);
      ObjectCreate("li13", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li13", "                               " + DoubleToStr(gd_556, 4), 9, "Arial", DimGray);
      ObjectCreate("li14", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li14", "                               " + DoubleToStr(gd_564, 4), 9, "Arial", DimGray);
      ObjectCreate("li15", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li15", "                               " + DoubleToStr(gd_572, 4), 9, "Arial", DimGray);
      ObjectCreate("li16", OBJ_TEXT, 0, Time[0], 0);
      ObjectSetText("li16", "                               " + DoubleToStr(gd_580, 4), 9, "Arial", DimGray);
   }
   ObjectMove("High", 0, Time[0], g_high_324);
   ObjectMove("Hi1", 0, Time[0], gd_332);
   ObjectMove("Hi2", 0, Time[0], gd_340);
   ObjectMove("Hi3", 0, Time[0], gd_348);
   ObjectMove("Hi4", 0, Time[0], gd_356);
   ObjectMove("Hi5", 0, Time[0], gd_364);
   ObjectMove("Hi6", 0, Time[0], gd_372);
   ObjectMove("Hi7", 0, Time[0], gd_380);
   ObjectMove("Hi8", 0, Time[0], gd_388);
   ObjectMove("Hi9", 0, Time[0], gd_396);
   ObjectMove("Hi10", 0, Time[0], gd_404);
   ObjectMove("Hi11", 0, Time[0], gd_412);
   ObjectMove("Hi12", 0, Time[0], gd_420);
   ObjectMove("Hi13", 0, Time[0], gd_428);
   ObjectMove("Hi14", 0, Time[0], gd_436);
   ObjectMove("Hi15", 0, Time[0], gd_444);
   ObjectMove("Hi16", 0, Time[0], gd_452);
   ObjectMove("li1", 0, Time[0], gd_460);
   ObjectMove("li2", 0, Time[0], gd_468);
   ObjectMove("li3", 0, Time[0], gd_476);
   ObjectMove("li4", 0, Time[0], gd_484);
   ObjectMove("li5", 0, Time[0], gd_492);
   ObjectMove("li6", 0, Time[0], gd_500);
   ObjectMove("li7", 0, Time[0], gd_508);
   ObjectMove("li8", 0, Time[0], gd_516);
   ObjectMove("li9", 0, Time[0], gd_524);
   ObjectMove("li10", 0, Time[0], gd_532);
   ObjectMove("li11", 0, Time[0], gd_540);
   ObjectMove("li12", 0, Time[0], gd_548);
   ObjectMove("li13", 0, Time[0], gd_556);
   ObjectMove("li14", 0, Time[0], gd_564);
   ObjectMove("li15", 0, Time[0], gd_572);
   ObjectMove("li16", 0, Time[0], gd_580);
   return (0);
}

void ObjectCreateX(double a_price_0, double ad_8, int a_datetime_16, int a_datetime_20) {
   int l_count_24 = 0;
   int li_unused_28 = 0;
   double ld_32 = ad_8;
   bool li_40 = FALSE;
   ObjectCreate("pline_" + a_datetime_16, OBJ_TREND, 0, a_datetime_20, a_price_0, a_datetime_16, a_price_0);
   ObjectSet("pline_" + a_datetime_16, OBJPROP_RAY, FALSE);
   ObjectSet("pline_" + a_datetime_16, OBJPROP_COLOR, MediumOrchid);
   ObjectSet("pline_" + a_datetime_16, OBJPROP_WIDTH, 2);
   double l_price_44 = a_price_0;
   double l_price_52 = a_price_0;
   for (l_count_24 = 0; l_count_24 < 16; l_count_24++) {
      l_price_44 += ld_32;
      l_price_52 -= ld_32;
      if (li_40) li_40 = FALSE;
      else li_40 = TRUE;
      ObjectCreate("hline_" + a_datetime_16 + "_" + l_count_24, OBJ_TREND, 0, a_datetime_20, l_price_44, a_datetime_16, l_price_44);
      ObjectSet("hline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_RAY, FALSE);
      ObjectSet("hline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_COLOR, DimGray);
      ObjectSet("hline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_WIDTH, 1);
      if (li_40) ObjectSet("hline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_STYLE, STYLE_DOT);
      else ObjectSet("hline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_STYLE, STYLE_SOLID);
      ObjectCreate("sline_" + a_datetime_16 + "_" + l_count_24, OBJ_TREND, 0, a_datetime_20, l_price_52, a_datetime_16, l_price_52);
      ObjectSet("sline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_RAY, FALSE);
      ObjectSet("sline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_COLOR, DimGray);
      ObjectSet("sline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_WIDTH, 1);
      if (li_40) ObjectSet("sline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_STYLE, STYLE_DOT);
      else ObjectSet("sline_" + a_datetime_16 + "_" + l_count_24, OBJPROP_STYLE, STYLE_SOLID);
   }
}

void ObjectsMoveForward(int ai_0, int a_datetime_4) {
   ObjectSet("pline_" + ai_0, OBJPROP_TIME2, a_datetime_4);
   for (int l_count_8 = 0; l_count_8 < 16; l_count_8++) {
      ObjectSet("hline_" + ai_0 + "_" + l_count_8, OBJPROP_TIME2, a_datetime_4);
      ObjectSet("sline_" + ai_0 + "_" + l_count_8, OBJPROP_TIME2, a_datetime_4);
   }
}

void EraseEverything() {
   string l_name_4;
   int l_objs_total_0 = ObjectsTotal();
   for (int l_objs_total_12 = l_objs_total_0; l_objs_total_12 > 0; l_objs_total_12--) {
      l_name_4 = ObjectName(l_objs_total_12);
      if (StringFind(l_name_4, "pline_") != -1) ObjectDelete(l_name_4);
      if (StringFind(l_name_4, "sline_") != -1) ObjectDelete(l_name_4);
      if (StringFind(l_name_4, "hline_") != -1) ObjectDelete(l_name_4);
   }
   ObjectDelete("High");
   ObjectDelete("Hi1");
   ObjectDelete("Hi2");
   ObjectDelete("Hi3");
   ObjectDelete("Hi4");
   ObjectDelete("Hi5");
   ObjectDelete("Hi6");
   ObjectDelete("Hi7");
   ObjectDelete("Hi8");
   ObjectDelete("Hi9");
   ObjectDelete("Hi10");
   ObjectDelete("Hi11");
   ObjectDelete("Hi12");
   ObjectDelete("Hi13");
   ObjectDelete("Hi14");
   ObjectDelete("Hi15");
   ObjectDelete("Hi16");
   ObjectDelete("li1");
   ObjectDelete("li2");
   ObjectDelete("li3");
   ObjectDelete("li4");
   ObjectDelete("li5");
   ObjectDelete("li6");
   ObjectDelete("li7");
   ObjectDelete("li8");
   ObjectDelete("li9");
   ObjectDelete("li10");
   ObjectDelete("li11");
   ObjectDelete("li12");
   ObjectDelete("li13");
   ObjectDelete("li14");
   ObjectDelete("li15");
   ObjectDelete("li16");
}

int mylogin(string as_0, string as_8) {
   string ls_unused_16;
   int li_24;
   int li_28;
   int li_40;
   if (GlobalVariableCheck("rA_synergy")) {
      if (isExeRunning() != 1) {
         gi_204 = TRUE;
         return (1);
      }
      GlobalVariableDel("rA_synergy");
   }
   int li_32 = -1;
   string l_str_concat_44 = StringConcatenate(gs_620, "login_test.php");
   string l_str_concat_52 = StringConcatenate("user=", as_0, "&pass=", as_8, "&ver=2%2E1");
   string ls_60 = "";//gGrab(l_str_concat_44, l_str_concat_52);
   if (StringSubstr(ls_60, 0, 1) == "0") li_32 = 0;
   if (StringSubstr(ls_60, 0, 1) == "2") li_32 = 2;
   if (StringSubstr(ls_60, 0, 1) == "3") li_32 = 3;
   if (StringSubstr(ls_60, 0, 1) == "4") li_32 = 4;
   if (StringSubstr(ls_60, 0, 1) == "6") li_32 = 6;
   if (StringSubstr(ls_60, 0, 1) == "7") li_32 = 7;
   GlobalVariableDel("advSynSW");
   logResult("TradeTargets", li_32, " LOGIN");
   switch (li_32) {
   case 0:
      gi_204 = doLoginCheck(gs_620);
      if (gi_204) return (1);
      li_24 = StringFind(ls_60, "SVR=");
      li_28 = StringFind(ls_60, "DONE");
      li_40 = StringFind(ls_60, "zZD1");
      if (li_24 == -1) gs_636 = "x";
      else {
         if (li_28 == -1) gs_636 = "x";
         gs_636 = StringSubstr(ls_60, li_24 + 4, li_28 - li_24 - 4);
      }
      g_str2int_152 = StrToInteger(StringSubstr(ls_60, 4, li_40 - 4));
      if (g_str2int_152 <= 0) g_str2int_152 = 180;
      if (g_str2int_152 >= 600) g_str2int_152 = 600;
      g_datetime_200 = TimeLocal();
      gs_224 = as_0;
      gs_232 = as_8;
      GlobalVariableSet("aSyn", TimeLocal());
      g_file_196 = FileOpen("advsynergy.bin", FILE_WRITE, 8);
      if (g_file_196 < 1) {
         Print("Cannot open password cache!");
         return (0);
      }
      FileWrite(g_file_196, gs_208);
      FileWrite(g_file_196, gs_216);
      FileWrite(g_file_196, TimeLocal());
      FileWrite(g_file_196, gs_636);
      FileClose(g_file_196);
      return (0);
   case 7:
      Alert(StringSubstr(ls_60, 4, StringLen(ls_60)));
      g_datetime_200 = TimeLocal();
      gs_224 = gs_208;
      GlobalVariableSet("aSyn", TimeLocal());
      g_file_196 = FileOpen("advsynergy.bin", FILE_WRITE, 8);
      if (g_file_196 < 1) {
         Print("Cannot open password cache!");
         return (0);
      }
      FileWrite(g_file_196, gs_208);
      FileWrite(g_file_196, gs_216);
      FileWrite(g_file_196, TimeLocal());
      FileClose(g_file_196);
      return (0);
   case 6:
      Alert(StringSubstr(ls_60, 4, StringLen(ls_60)));
      if (gi_252) FileDelete("advsynergy.bin");
      return (1);
   case 2:
      Alert("Incorrect EMail -- Please check your EMail address spelling.");
      if (gi_252) FileDelete("advsynergy.bin");
      return (1);
   case 3:
      Alert("Email OK -- Incorrect Password!\n Please check your password spelling\n and make sure Caps Lock is NOT on.");
      if (gi_252) FileDelete("advsynergy.bin");
      return (1);
   case 4:
      Alert("Your account has been disabled!\n Please contact support@compassfx.com");
      if (gi_252) FileDelete("advsynergy.bin");
      return (1);
   case -1:
      if (gs_636 != "x" && gs_636 != "" && gs_628 != gs_636) gs_628 = gs_636;
      if (gs_620 == gs_628) {
         if (IsConnected()) {
            Alert("Connection Error!\n An error connecting to the Internet has occurred.\n Please close MetaTrader and re-open.");
            resetIndy();
            return (1);
         }
         g_file_96 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
         if (g_file_96 < 1) return (1);
         FileClose(g_file_96);
         gs_224 = as_0;
         gs_232 = as_8;
         GlobalVariableSet("aSyn", TimeLocal());
         return (0);
      }
      gs_620 = gs_628;
      gi_644 = 1;
      return (1);
   }
   return (0);
}

int mykeepalive() {
   int li_0 = -1;
   string l_str_concat_4 = StringConcatenate(gs_620, "keepalive_new.php");
   string l_str_concat_12 = StringConcatenate("user=", gs_224, "&pass=", gs_232);
   string ls_20 = "";//gGrab(l_str_concat_4, l_str_concat_12);
   if (StringSubstr(ls_20, 0, 1) == "0") li_0 = 0;
   if (StringSubstr(ls_20, 0, 1) == "1") li_0 = 1;
   if (StringSubstr(ls_20, 0, 1) == "2") li_0 = 2;
   if (StringSubstr(ls_20, 0, 1) == "3") li_0 = 3;
   if (StringSubstr(ls_20, 0, 1) == "4") li_0 = 4;
   if (StringSubstr(ls_20, 0, 1) == "5") li_0 = 5;
   if (li_0 != -1)
      if (GlobalVariableCheck("advSynSW")) GlobalVariableDel("advSynSW");
   logResult("TradeTargets", li_0, DoubleToStr(GlobalVariableCheck("advSynSW"), 0) + " -- KEEPALIVE");
   switch (li_0) {
   case 1:
      gi_204 = mylogin(gs_224, gs_232);
      if (gi_644 == 1) {
         gi_204 = mylogin(gs_224, gs_232);
         gi_644 = -1;
      }
      return (0);
   case 2:
      Alert("Your account has been logged into from a different computer.\n  This connection has been terminated.");
      resetIndy();
      return (1);
   case 3:
      Alert("Your username was not found in our database of logged in users.\n Please close indicators and re-open\n them to re-login.");
      resetIndy();
      return (1);
   case 4:
      Alert(StringSubstr(ls_20, 4, StringLen(ls_20)));
      GlobalVariableSet("aSyn", TimeLocal());
      break;
   case 5:
      Alert(StringSubstr(ls_20, 4, StringLen(ls_20)));
      resetIndy();
      return (1);
   case -1:
      if (gs_636 != "x" && gs_636 != "" && gs_636 != gs_628) gs_628 = gs_636;
      if (gs_620 == gs_628) {
         if (GlobalVariableCheck("advSynSW")) {
            if (TimeLocal() - GlobalVariableGet("advSynSW") <= 1200.0) break;
            if (IsConnected()) {
               Alert("Connection Error!\n An error connecting to the Internet has occurred.\n Please close MetaTrader and re-open.");
               resetIndy();
               return (1);
            }
            g_file_96 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
            if (g_file_96 < 1) return (1);
            FileClose(g_file_96);
            return (0);
         }
         GlobalVariableSet("advSynSW", TimeLocal());
      } else {
         gs_620 = gs_628;
         gi_644 = 1;
         return (1);
      }
      break;
   }
   GlobalVariableSet("aSyn", TimeLocal());
   return (0);
}

void resetIndy() {
   EraseEverything();
   GlobalVariableDel("aSyn");
   GlobalVariableDel("advSynSW");
}
int isInstallerRunning(){
return(0);
}
void runAutoInstaller(){
}
int runAutoUpdater(){return(0);}
int isExeRunning(){return(0);}