Synergy_MTF





/*
   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_separate_window
/*
#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 gda_80[];
double gda_84[10];
string gsa_88[10];
string gsa_92[10];
int gi_96;
extern string Custom_Indicator = "Synergy MTF";
extern string Copyright = "© 2008, Dean Malone";
extern string Web_Address = "www.compassfx.com";
extern string label = "--Login Information--";
extern string EMail = "";
extern string Password = "";
extern color Label_Display_Color = White;
int gi_152;
int gi_156 = 30;
int gi_160 = 90;
int gi_164 = 15;
int gi_168 = 25;
int gi_172 = 90;
int gi_176 = 55;
double gd_180;
double gd_188;
double gd_196;
double gd_204;
double gd_212;
double gd_220;
double gd_228;
double gd_236;
double gd_244;
double gd_252;
double gd_260;
double gd_268;
double gd_276;
double gd_284;
double gd_292;
double gd_300;
double gd_308;
double gd_316;
double gd_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;
bool gi_516 = TRUE;
int gi_520;
int gi_524;
bool gi_528 = FALSE;
int gi_532;
string gs_536;
string gs_544;
string gs_552;
string gs_560;
int gi_568;
int gi_572;
int gi_576;
bool gi_580 = FALSE;
string gs_584 = "http://www.synergyforex.com/server/server2/";
string gs_592 = "http://www.compassfx.com/server/";
string gs_600;
int gi_608 = -1;

int doLoginCheck(string as_0) {
   double lda_16[10];
   string lsa_20[10];
   string ls_24;
   bool li_8 = FALSE;
   int li_12 = FileOpen("indicators_debug.txt", FILE_CSV|FILE_READ, ",");
   if (li_12 != -1) {
      if (FileSize(li_12) > 100000) {
         FileClose(li_12);
         FileDelete("indicators_debug.txt");
      } else FileClose(li_12);
   }
   int li_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 li_32 = 0; li_32 < gi_76; li_32++) {
      for (int li_36 = 0; li_36 < 9; li_36++) {
         if (gsa_88[li_32] == lsa_20[li_36]) {
            li_8 = TRUE;
            Print("Indicator : ", lsa_20[li_36], " Value : ", lda_16[li_36], " Latest Version : ", gda_84[li_32]);
            if (lda_16[li_36] < gda_84[li_32]) {
               gsa_92[li_44] = gsa_88[li_32];
               li_44++;
               if (MathAbs(lda_16[li_36] - gda_84[li_32]) >= 0.05) {
                  li_48 = TRUE;
                  if (!GlobalVariableCheck("rA_synergy")) GlobalVariableSet("rA_synergy", 1);
               }
            }
         }
      }
      if (!li_8) {
         gsa_92[li_44] = gsa_88[li_32];
         li_44++;
      }
      li_8 = FALSE;
   }
   Print("-- Advanced Synergy Version Information --");
   Print("Files that need to be updated: ", li_44);
   if (li_44 > 0) Print("Executing AutoUpdater.exe now...");
   writeOutputFile(li_40, li_44);
   closeOutputFile(li_40, li_44);
   if (li_44 == 0) return (0);
   int li_52 = runAutoUpdater();
   if (li_48 == FALSE) return (0);
   return (1);
}

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

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

void closeOutputFile(int ai_0, int ai_4) {
   FileClose(ai_0);
}

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

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

int init() {
   //if (Custom_Indicator == "verInfo_AS") {
      IndicatorBuffers(1);
      SetIndexBuffer(0, gda_80);
 /*     return (0);
   }
   gi_528 = FALSE;
   gi_520 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
   if (gi_520 < 1) {
      gi_580 = FALSE;
      if (isInstallerRunning() != 1) {
         gi_528 = TRUE;
         return (0);
      }
      runAutoInstaller();
      gi_528 = TRUE;
      return (0);
   }
   gs_536 = FileReadString(gi_520);
   gs_544 = FileReadString(gi_520);
   gi_568 = StrToInteger(FileReadString(gi_520));
   FileClose(gi_520);
   gi_580 = TRUE;
   gs_552 = gs_536;
   gs_560 = gs_544;
   if (GlobalVariableCheck("aSyn")) {
      gi_572 = GlobalVariableGet("aSyn");
      gi_576 = TimeLocal();
      if (gi_572 > gi_576) {
         gi_528 = mylogin(gs_536, gs_544);
         if (gi_528) return (0);
      }
      if (gi_576 - gi_572 >= 1800) {
         gi_528 = mylogin(gs_536, gs_544);
         if (gi_528) return (0);
      }
      if (gi_576 - gi_572 > gi_152) {
         gi_528 = mykeepalive();
         if (gi_608 == 1) {
            gi_528 = mykeepalive();
            gi_608 = -1;
         }
         if (gi_528) return (0);
      }
   }
   gi_528 = mylogin(gs_536, gs_544);
   return (0);*/
   IndicatorShortName("Synergy_MTF | www.compassfx.com");
   return (0);
}

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

int start() {
  // if (gi_528) return (0);
   if (Custom_Indicator == "verInfo_AS") {
      gda_80[0] = 2.02;
      return (0);
   }
/*   if (!gi_528) {
      if (GlobalVariableCheck("aSyn")) {
         gi_572 = GlobalVariableGet("aSyn");
         gi_576 = TimeLocal();
         if (gi_572 > gi_576) {
            gi_528 = mylogin(gs_536, gs_544);
            if (gi_528) return (0);
         }
         if (gi_576 - gi_572 >= 1800) {
            gi_528 = mylogin(gs_536, gs_544);
            if (gi_528) return (0);
         }
         if (gi_576 - gi_572 > gi_152) {
            gi_528 = mykeepalive();
            if (gi_608 == 1) {
               gi_528 = mykeepalive();
               gi_608 = -1;
            }
            if (gi_528) return (0);
         }
      } else {
         resetIndy();
         gi_528 = TRUE;
         return (0);
      }
   }*/
   if (gi_516) {
      gi_516 = FALSE;
      gi_532 = WindowFind("Synergy_MTF | www.compassfx.com");
      SetupLabels(gi_532);
   }
   gd_180 = iCustom(NULL, PERIOD_M5, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_212 = iCustom(NULL, PERIOD_M15, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_244 = iCustom(NULL, PERIOD_M30, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_276 = iCustom(NULL, PERIOD_H1, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_308 = iCustom(NULL, PERIOD_H4, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_340 = iCustom(NULL, PERIOD_D1, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_372 = iCustom(NULL, PERIOD_W1, "Synergy_TradeSignal", "", "987987987eee98797", 0, 0);
   gd_188 = iCustom(NULL, PERIOD_M5, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_220 = iCustom(NULL, PERIOD_M15, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_252 = iCustom(NULL, PERIOD_M30, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_284 = iCustom(NULL, PERIOD_H1, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_316 = iCustom(NULL, PERIOD_H4, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_348 = iCustom(NULL, PERIOD_D1, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_380 = iCustom(NULL, PERIOD_W1, "Synergy_TradeSignal", "", "987987987eee98797", 1, 0);
   gd_404 = iCustom(NULL, PERIOD_M5, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_420 = iCustom(NULL, PERIOD_M15, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_436 = iCustom(NULL, PERIOD_M30, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_452 = iCustom(NULL, PERIOD_H1, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_468 = iCustom(NULL, PERIOD_H4, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_484 = iCustom(NULL, PERIOD_D1, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_500 = iCustom(NULL, PERIOD_W1, "Synergy_TradeSignal", "", "987987987eee98797", 2, 0);
   gd_412 = iCustom(NULL, PERIOD_M5, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_428 = iCustom(NULL, PERIOD_M15, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_444 = iCustom(NULL, PERIOD_M30, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_460 = iCustom(NULL, PERIOD_H1, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_476 = iCustom(NULL, PERIOD_H4, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_492 = iCustom(NULL, PERIOD_D1, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_508 = iCustom(NULL, PERIOD_W1, "Synergy_TradeSignal", "", "987987987eee98797", 3, 0);
   gd_196 = iCustom(NULL, PERIOD_M5, "Synergy_Heikenashi", 2, 0);
   gd_228 = iCustom(NULL, PERIOD_M15, "Synergy_Heikenashi", 2, 0);
   gd_260 = iCustom(NULL, PERIOD_M30, "Synergy_Heikenashi", 2, 0);
   gd_292 = iCustom(NULL, PERIOD_H1, "Synergy_Heikenashi", 2, 0);
   gd_324 = iCustom(NULL, PERIOD_H4, "Synergy_Heikenashi", 2, 0);
   gd_356 = iCustom(NULL, PERIOD_D1, "Synergy_Heikenashi", 2, 0);
   gd_388 = iCustom(NULL, PERIOD_W1, "Synergy_Heikenashi", 2, 0);
   gd_204 = iCustom(NULL, PERIOD_M5, "Synergy_Heikenashi", 3, 0);
   gd_236 = iCustom(NULL, PERIOD_M15, "Synergy_Heikenashi", 3, 0);
   gd_268 = iCustom(NULL, PERIOD_M30, "Synergy_Heikenashi", 3, 0);
   gd_300 = iCustom(NULL, PERIOD_H1, "Synergy_Heikenashi", 3, 0);
   gd_332 = iCustom(NULL, PERIOD_H4, "Synergy_Heikenashi", 3, 0);
   gd_364 = iCustom(NULL, PERIOD_D1, "Synergy_Heikenashi", 3, 0);
   gd_396 = iCustom(NULL, PERIOD_W1, "Synergy_Heikenashi", 3, 0);
   if (gd_188 != EMPTY_VALUE) ObjectSetText("status_5m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_180 != EMPTY_VALUE) ObjectSetText("status_5m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_404 != EMPTY_VALUE) ObjectSetText("status_5m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_412 != EMPTY_VALUE) ObjectSetText("status_5m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_196 < gd_204) ObjectSetText("status_5m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_5m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_220 != EMPTY_VALUE) ObjectSetText("status_15m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_212 != EMPTY_VALUE) ObjectSetText("status_15m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_420 != EMPTY_VALUE) ObjectSetText("status_15m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_428 != EMPTY_VALUE) ObjectSetText("status_15m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_228 < gd_236) ObjectSetText("status_15m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_15m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_252 != EMPTY_VALUE) ObjectSetText("status_30m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_244 != EMPTY_VALUE) ObjectSetText("status_30m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_436 != EMPTY_VALUE) ObjectSetText("status_30m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_444 != EMPTY_VALUE) ObjectSetText("status_30m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_260 < gd_268) ObjectSetText("status_30m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_30m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_284 != EMPTY_VALUE) ObjectSetText("status_60m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_276 != EMPTY_VALUE) ObjectSetText("status_60m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_452 != EMPTY_VALUE) ObjectSetText("status_60m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_460 != EMPTY_VALUE) ObjectSetText("status_60m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_292 < gd_300) ObjectSetText("status_60m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_60m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_316 != EMPTY_VALUE) ObjectSetText("status_240m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_308 != EMPTY_VALUE) ObjectSetText("status_240m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_468 != EMPTY_VALUE) ObjectSetText("status_240m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_476 != EMPTY_VALUE) ObjectSetText("status_240m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_324 < gd_332) ObjectSetText("status_240m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_240m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_348 != EMPTY_VALUE) ObjectSetText("status_1440m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_340 != EMPTY_VALUE) ObjectSetText("status_1440m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_484 != EMPTY_VALUE) ObjectSetText("status_1440m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_492 != EMPTY_VALUE) ObjectSetText("status_1440m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_356 < gd_364) ObjectSetText("status_1440m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_1440m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   if (gd_380 != EMPTY_VALUE) ObjectSetText("status_10080m", "ê", 22, "Wingdings", Red);
   else {
      if (gd_372 != EMPTY_VALUE) ObjectSetText("status_10080m", "é", 22, "Wingdings", LimeGreen);
      else {
         if (gd_500 != EMPTY_VALUE) ObjectSetText("status_10080m", "é", 22, "Wingdings", Yellow);
         else {
            if (gd_508 != EMPTY_VALUE) ObjectSetText("status_10080m", "ê", 22, "Wingdings", Yellow);
            else {
               if (gd_388 < gd_396) ObjectSetText("status_10080m", "n", 32, "Wingdings", DodgerBlue);
               else ObjectSetText("status_10080m", "n", 32, "Wingdings", Red);
            }
         }
      }
   }
   return (0);
}

void SetupLabels(int ai_0) {
   ObjectCreate("status_5m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_5m", OBJPROP_CORNER, 0);
   ObjectSet("status_5m", OBJPROP_XDISTANCE, gi_156);
   ObjectSet("status_5m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l5", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l5", OBJPROP_CORNER, 0);
   ObjectSet("status_l5", OBJPROP_XDISTANCE, gi_168);
   ObjectSet("status_l5", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l5", "5 Minute", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_15m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_15m", OBJPROP_CORNER, 0);
   ObjectSet("status_15m", OBJPROP_XDISTANCE, gi_156 + gi_160);
   ObjectSet("status_15m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l15", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l15", OBJPROP_CORNER, 0);
   ObjectSet("status_l15", OBJPROP_XDISTANCE, gi_168 + gi_172);
   ObjectSet("status_l15", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l15", "15 Minute", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_30m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_30m", OBJPROP_CORNER, 0);
   ObjectSet("status_30m", OBJPROP_XDISTANCE, gi_156 + gi_160 << 1);
   ObjectSet("status_30m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l30", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l30", OBJPROP_CORNER, 0);
   ObjectSet("status_l30", OBJPROP_XDISTANCE, gi_168 + gi_172 << 1);
   ObjectSet("status_l30", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l30", "30 Minute", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_60m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_60m", OBJPROP_CORNER, 0);
   ObjectSet("status_60m", OBJPROP_XDISTANCE, gi_156 + 3 * gi_160);
   ObjectSet("status_60m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l60", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l60", OBJPROP_CORNER, 0);
   ObjectSet("status_l60", OBJPROP_XDISTANCE, gi_168 + 3 * gi_172);
   ObjectSet("status_l60", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l60", "1 Hour", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_240m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_240m", OBJPROP_CORNER, 0);
   ObjectSet("status_240m", OBJPROP_XDISTANCE, gi_156 + gi_160 << 2);
   ObjectSet("status_240m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l240", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l240", OBJPROP_CORNER, 0);
   ObjectSet("status_l240", OBJPROP_XDISTANCE, gi_168 + gi_172 << 2);
   ObjectSet("status_l240", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l240", "4 Hour", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_1440m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_1440m", OBJPROP_CORNER, 0);
   ObjectSet("status_1440m", OBJPROP_XDISTANCE, gi_156 + 4.91 * gi_160);
   ObjectSet("status_1440m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l1440", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l1440", OBJPROP_CORNER, 0);
   ObjectSet("status_l1440", OBJPROP_XDISTANCE, gi_168 + 5 * gi_172);
   ObjectSet("status_l1440", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l1440", "Daily", 9, "Tahoma", Label_Display_Color);
   ObjectCreate("status_10080m", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_10080m", OBJPROP_CORNER, 0);
   ObjectSet("status_10080m", OBJPROP_XDISTANCE, gi_156 + 5.91 * gi_160);
   ObjectSet("status_10080m", OBJPROP_YDISTANCE, gi_164);
   ObjectCreate("status_l10080", OBJ_LABEL, ai_0, 0, 0);
   ObjectSet("status_l10080", OBJPROP_CORNER, 0);
   ObjectSet("status_l10080", OBJPROP_XDISTANCE, gi_168 + 6 * gi_172);
   ObjectSet("status_l10080", OBJPROP_YDISTANCE, gi_176);
   ObjectSetText("status_l10080", "Weekly", 9, "Tahoma", Label_Display_Color);
}

void EraseLabels() {
   ObjectsDeleteAll(gi_532);
}

int mylogin(string as_0, string as_8) {
   string ls_16;
   int li_24;
   int li_28;
   int li_40;
   if (GlobalVariableCheck("rA_synergy")) {
      if (isExeRunning() != 1) {
         gi_528 = TRUE;
         return (1);
      }
      GlobalVariableDel("rA_synergy");
   }
   int li_32 = -1;
   string ls_44 = StringConcatenate(gs_584, "login_test.php");
   string ls_52 = StringConcatenate("user=", as_0, "&pass=", as_8, "&ver=2%2E1");
   string ls_60 = "";//gGrab(ls_44, ls_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("MTF", li_32, " LOGIN");
   switch (li_32) {
   case 0:
      gi_528 = doLoginCheck(gs_584);
      if (gi_528) 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_600 = "x";
      else {
         if (li_28 == -1) gs_600 = "x";
         gs_600 = StringSubstr(ls_60, li_24 + 4, li_28 - li_24 - 4);
      }
      gi_152 = StrToInteger(StringSubstr(ls_60, 4, li_40 - 4));
      if (gi_152 <= 0) gi_152 = 180;
      if (gi_152 >= 600) gi_152 = 600;
      gi_524 = TimeLocal();
      gs_552 = as_0;
      gs_560 = as_8;
      GlobalVariableSet("aSyn", TimeLocal());
      gi_520 = FileOpen("advsynergy.bin", FILE_WRITE, 8);
      if (gi_520 < 1) {
         Print("Cannot open password cache!");
         return (0);
      }
      FileWrite(gi_520, gs_536);
      FileWrite(gi_520, gs_544);
      FileWrite(gi_520, TimeLocal());
      FileWrite(gi_520, gs_600);
      FileClose(gi_520);
      return (0);
   case 7:
      Alert(StringSubstr(ls_60, 4, StringLen(ls_60)));
      gi_524 = TimeLocal();
      gs_552 = gs_536;
      GlobalVariableSet("aSyn", TimeLocal());
      gi_520 = FileOpen("advsynergy.bin", FILE_WRITE, 8);
      if (gi_520 < 1) {
         Print("Cannot open password cache!");
         return (0);
      }
      FileWrite(gi_520, gs_536);
      FileWrite(gi_520, gs_544);
      FileWrite(gi_520, TimeLocal());
      FileClose(gi_520);
      return (0);
   case 6:
      Alert(StringSubstr(ls_60, 4, StringLen(ls_60)));
      if (gi_580) FileDelete("advsynergy.bin");
      return (1);
   case 2:
      Alert("Incorrect EMail -- Please check your EMail address spelling.");
      if (gi_580) 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_580) FileDelete("advsynergy.bin");
      return (1);
   case 4:
      Alert("Your account has been disabled!\n Please contact support@compassfx.com");
      if (gi_580) FileDelete("advsynergy.bin");
      return (1);
   case -1:
      if (gs_600 != "x" && gs_600 != "" && gs_592 != gs_600) gs_592 = gs_600;
      if (gs_584 == gs_592) {
         if (IsConnected()) {
            Alert("Connection Error!\n An error connecting to the Internet has occurred.\n Please close MetaTrader and re-open.");
            resetIndy();
            return (1);
         }
         gi_96 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
         if (gi_96 < 1) return (1);
         FileClose(gi_96);
         gs_552 = as_0;
         gs_560 = as_8;
         GlobalVariableSet("aSyn", TimeLocal());
         return (0);
      }
      gs_584 = gs_592;
      gi_608 = 1;
      return (1);
   }
   return (0);
}

int mykeepalive() {
   int li_0 = -1;
   string ls_4 = StringConcatenate(gs_584, "keepalive_new.php");
   string ls_12 = StringConcatenate("user=", gs_552, "&pass=", gs_560);
   string ls_20 = "";//gGrab(ls_4, ls_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("MTF", li_0, DoubleToStr(GlobalVariableCheck("advSynSW"), 0) + " -- KEEPALIVE");
   switch (li_0) {
   case 1:
      gi_528 = mylogin(gs_552, gs_560);
      if (gi_608 == 1) {
         gi_528 = mylogin(gs_552, gs_560);
         gi_608 = -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_600 != "x" && gs_600 != "" && gs_600 != gs_592) gs_592 = gs_600;
      if (gs_584 == gs_592) {
         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);
            }
            gi_96 = FileOpen("advsynergy.bin", FILE_CSV|FILE_READ);
            if (gi_96 < 1) return (1);
            FileClose(gi_96);
            return (0);
         }
         GlobalVariableSet("advSynSW", TimeLocal());
      } else {
         gs_584 = gs_592;
         gi_608 = 1;
         return (1);
      }
      break;
   }
   GlobalVariableSet("aSyn", TimeLocal());
   return (0);
}

void resetIndy() {
   EraseLabels();
   GlobalVariableDel("aSyn");
}

int isInstallerRunning(){
return(0);
}
void runAutoInstaller(){
}
int runAutoUpdater(){return(0);}
int isExeRunning(){return(0);}



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:




Custom Indicators Used:
as2_updater
Synergy
Synergy_TradeSignal
Synergy_Continuation
Synergy_Volatility
Synergy_DSR
Synergy_TDI
Synergy_HeikenAshi
Synergy_RangeFactor
Synergy_MTF
Synergy_TradeTargets

Order Management characteristics:

Other Features:

Uses files from the file system

It issuies visual alerts to the screen
It writes information to file
It reads information from a file