/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2008,FXDB, LLC"
#property link      "http://www.ForexDealButler.com"

#property indicator_separate_window

//#include <FDB_File.mqh>

extern int RS_Lookback = 24;
extern color cBuy = Lime;
extern color cSell = Red;
extern color cWeakBuy = LightSeaGreen;
extern color cWeakSell = Orange;
extern color cFlat = Khaki;
extern color cInd = PaleGoldenrod;
extern color cTF = LightSteelBlue;
extern color cRS = Gold;
string gsa_112[] = {"M5:", "M15:", "M30:", "H1:", "H4:", "D1:"};
string gsa_116[] = {"FXT", "TMeter", "DynRS", "3BarRev", "TPLines"};
string gsa_120[] = {" ", "BaseRS:", "CtrRS:", "PairIndex:", "PipRange:"};
string gs_124 = "FXDB_Matrix_v3";
string gsa_132[19] = {"EURUSD", "GBPUSD", "AUDUSD", "USDJPY", "USDCHF", "USDCAD", "EURJPY", "EURGBP", "EURCHF", "EURAUD", "GBPJPY", "GBPCHF", "AUDJPY", "NZDUSD", "NZDJPY", "AUDNZD", "CHFJPY", "EURCAD", "AUDCAD"};
int g_fontsize_136 = 8;
int g_str2dbl_140 = EMPTY_VALUE;
int g_str2dbl_144 = EMPTY_VALUE;
int gia_148[] = {5, 15, 30, 60, 240, 1440};
int gi_152 = 120;
int gi_156 = 200;
int gi_160 = 20;
int gi_164 = 4;
int g_period_168 = 14;
int g_period_172 = 3;
int g_slowing_176 = 5;
double gd_180 = 0.0;
int gi_188 = 233;
int gi_192 = 234;
int gi_196 = 238;
int gi_200 = 236;
int gi_204 = 54;
int gi_208 = 104;
int gi_212 = 104;
int gi_216 = 0;
bool gi_220;
color g_color_224;
color g_color_228;
color g_color_232;
string gs_236;
string g_symbol_244;
string gs_252;
string g_dbl2str_260;
string g_dbl2str_268;
string g_dbl2str_276;
string g_dbl2str_284;
string g_dbl2str_292;
string gs_300;
string gs_308;
string gsa_316[19];
double g_point_320;
double gd_328;
double gd_336;
double gd_344;
double gd_352;
int gi_unused_360;
int gi_364;
int g_count_368;

int init() {
   IndicatorShortName(gs_124);
//   if (FDB_Open("FDB.rkey")) {
//      if (FDB_GetStatus(1) == 1) g_str2dbl_144 = StrToDouble(FDB_GetValue(1));
//      if (FDB_GetStatus(2) == 1) g_str2dbl_140 = StrToDouble(FDB_GetValue(2));
//      Print("Run_Key loaded from file.");
//   } else Print("Run_Key file not found.");
   gi_220 = TRUE;
   gs_300 = StringSubstr(Symbol(), 0, 3);
   gs_308 = StringSubstr(Symbol(), 3, 3);
   int l_arr_size_0 = ArraySize(gsa_132);
   g_count_368 = 0;
   string ls_4 = "";
   string l_symbol_12 = "";
   int li_20 = 0;
   for (int l_index_24 = 0; l_index_24 < l_arr_size_0; l_index_24++) {
      l_symbol_12 = gsa_132[l_index_24];
      if (iClose(l_symbol_12, 0, 0) > 0.0) {
         gsa_316[li_20] = l_symbol_12;
         g_count_368++;
         li_20++;
         ls_4 = ls_4 + "," + l_symbol_12;
      }
   }
   ArrayResize(gsa_316, li_20);
   Print("Pairs loaded: " + ls_4);
   return (0);
}

int deinit() {
   ObjectsDeleteAll(0, OBJ_LABEL);
   for (int l_count_0 = 0; l_count_0 < 6; l_count_0++) for (int l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[0] + l_count_0 + l_count_4);
   for (l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[1] + l_count_4);
   for (l_count_0 = 0; l_count_0 < 6; l_count_0++) for (l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[2] + l_count_0 + l_count_4);
   for (l_count_0 = 0; l_count_0 < 6; l_count_0++) for (l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[3] + l_count_0 + l_count_4);
   for (l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[4] + l_count_4);
   for (l_count_4 = 0; l_count_4 < 5; l_count_4++) ObjectDelete(gsa_116[4] + "1" + l_count_4);
   for (l_count_4 = 1; l_count_4 < 2; l_count_4++) ObjectDelete(gsa_116[4] + "2" + l_count_4);
   return (0);
}

int start() {
   double l_istochastic_0;
   double l_istochastic_8;
   double lda_16[19];
   double lda_20[19];
   double lda_24[19];
   double lda_28[19];
   double lda_32[19];
   double lda_36[19];
   double lda_40[19];
   double lda_44[19];
   double lda_48[19];
   double lda_52[19];
   double l_icustom_56;
   double l_icustom_64;
   double l_icustom_72;
   double l_icustom_80;
   double l_icustom_88;
   if (!IsConnected()) {
      if (gi_216 > 1) Print("No login Connection.");
      gi_216++;
   }
//   if (CheckKey() == 0 && AccountNumber() != 0) {
      for (int l_count_96 = 0; l_count_96 < 6; l_count_96++) {
//         if (CheckKey() == 1) break;
//         if (l_count_96 == 5 && CheckKey() == 0) {
//            Print("Registration Key Failed for Account#: " + AccountNumber());
//            deinit();
//            return (0);
//         }
//      }
   }
   for (int l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      for (int l_index_104 = 0; l_index_104 < 5; l_index_104++) {
         ObjectCreate(gsa_116[0] + l_index_100 + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
         ObjectSetText(gsa_116[0] + l_index_100 + l_index_104, gsa_112[l_index_100], g_fontsize_136, "Arial Bold", cInd);
         ObjectSet(gsa_116[0] + l_index_100 + l_index_104, OBJPROP_CORNER, 0);
         ObjectSet(gsa_116[0] + l_index_100 + l_index_104, OBJPROP_XDISTANCE, l_index_100 * gi_152 + gi_156);
         ObjectSet(gsa_116[0] + l_index_100 + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
      }
   }
   for (l_index_104 = 0; l_index_104 < 5; l_index_104++) {
      ObjectCreate(gsa_116[1] + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
      ObjectSetText(gsa_116[1] + l_index_104, gsa_116[l_index_104], g_fontsize_136, "Arial Bold", cTF);
      ObjectSet(gsa_116[1] + l_index_104, OBJPROP_CORNER, 0);
      ObjectSet(gsa_116[1] + l_index_104, OBJPROP_XDISTANCE, gi_156 - 55);
      ObjectSet(gsa_116[1] + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      for (l_index_104 = 0; l_index_104 < 5; l_index_104++) {
         ObjectCreate(gsa_116[2] + l_index_100 + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
         ObjectSetText(gsa_116[2] + l_index_100 + l_index_104, " ", 10, "Wingdings", Goldenrod);
         ObjectSet(gsa_116[2] + l_index_100 + l_index_104, OBJPROP_CORNER, 0);
         ObjectSet(gsa_116[2] + l_index_100 + l_index_104, OBJPROP_XDISTANCE, l_index_100 * gi_152 + (gi_156 + 80));
         ObjectSet(gsa_116[2] + l_index_100 + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
      }
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      for (l_index_104 = 0; l_index_104 < 5; l_index_104++) {
         ObjectCreate(gsa_116[3] + l_index_100 + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
         ObjectSetText(gsa_116[3] + l_index_100 + l_index_104, "    ", 9, "Arial Bold", Goldenrod);
         ObjectSet(gsa_116[3] + l_index_100 + l_index_104, OBJPROP_CORNER, 0);
         ObjectSet(gsa_116[3] + l_index_100 + l_index_104, OBJPROP_XDISTANCE, l_index_100 * gi_152 + (gi_156 + 45));
         ObjectSet(gsa_116[3] + l_index_100 + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
      }
   }
   for (l_index_104 = 1; l_index_104 < 5; l_index_104++) {
      ObjectCreate(gsa_116[4] + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
      ObjectSetText(gsa_116[4] + l_index_104, gsa_120[l_index_104], g_fontsize_136, "Arial Bold", cRS);
      ObjectSet(gsa_116[4] + l_index_104, OBJPROP_CORNER, 0);
      ObjectSet(gsa_116[4] + l_index_104, OBJPROP_XDISTANCE, gi_156 - 185);
      ObjectSet(gsa_116[4] + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
   }
   for (l_index_104 = 1; l_index_104 < 5; l_index_104++) {
      l_index_100 = 1;
      ObjectCreate(gsa_116[4] + l_index_100 + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
      ObjectSetText(gsa_116[4] + l_index_100 + l_index_104, "    ", 9, "Arial Bold", Goldenrod);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_CORNER, 0);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_XDISTANCE, gi_156 - 125);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_YDISTANCE, l_index_104 * gi_160 + gi_164);
   }
   for (l_index_104 = 1; l_index_104 < 2; l_index_104++) {
      l_index_100 = 2;
      ObjectCreate(gsa_116[4] + l_index_100 + l_index_104, OBJ_LABEL, WindowFind(gs_124), 0, 0);
      ObjectSetText(gsa_116[4] + l_index_100 + l_index_104, " ", 10, "Wingdings", Goldenrod);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_CORNER, 0);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_XDISTANCE, gi_156 - 95);
      ObjectSet(gsa_116[4] + l_index_100 + l_index_104, OBJPROP_YDISTANCE, 1.8 * l_index_104 * gi_160 + gi_164);
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      l_istochastic_8 = iStochastic(NULL, gia_148[l_index_100], g_period_168, g_period_172, g_slowing_176, MODE_SMA, 0, MODE_MAIN, 0);
      l_istochastic_0 = iStochastic(NULL, gia_148[l_index_100], g_period_168, g_period_172, g_slowing_176, MODE_SMA, 0, MODE_SIGNAL, 0);
      if (l_istochastic_0 < l_istochastic_8 && l_istochastic_8 > 20.0) {
         ObjectSetText(gsa_116[2] + l_index_100 + "0", CharToStr(gi_188), g_fontsize_136, "Wingdings", cBuy);
         ObjectSetText(gsa_116[3] + l_index_100 + "0", " BUY", 9, "Arial Bold", cBuy);
      } else {
         if (l_istochastic_0 > l_istochastic_8 && l_istochastic_8 >= 80.0) {
            ObjectSetText(gsa_116[2] + l_index_100 + "0", CharToStr(gi_196), g_fontsize_136, "Wingdings", cWeakBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "0", " BUY", 9, "Arial Bold", cWeakBuy);
         } else {
            if (l_istochastic_0 > l_istochastic_8 && l_istochastic_8 < 80.0) {
               ObjectSetText(gsa_116[2] + l_index_100 + "0", CharToStr(gi_192), g_fontsize_136, "Wingdings", cSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "0", "SELL", 9, "Arial Bold", cSell);
            } else {
               if (l_istochastic_0 < l_istochastic_8 && l_istochastic_8 <= 20.0) {
                  ObjectSetText(gsa_116[2] + l_index_100 + "0", CharToStr(gi_200), g_fontsize_136, "Wingdings", cWeakSell);
                  ObjectSetText(gsa_116[3] + l_index_100 + "0", "SELL", 9, "Arial Bold", cWeakSell);
               } else {
                  ObjectSetText(gsa_116[2] + l_index_100 + "0", CharToStr(gi_204), 10, "Wingdings", cFlat);
                  ObjectSetText(gsa_116[3] + l_index_100 + "0", "FLAT", 9, "Arial Bold", cFlat);
               }
            }
         }
      }
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      switch (gia_148[l_index_100]) {
      case 1:
         gd_180 = 0.01;
         break;
      case 5:
         gd_180 = 0.05;
         break;
      case 15:
         gd_180 = 0.06;
         break;
      case 30:
         gd_180 = 0.08;
         break;
      case 60:
         gd_180 = 0.1;
         break;
      case 240:
         gd_180 = 0.14;
         break;
      case 1440:
         gd_180 = 0.4;
         break;
      case 10080:
         gd_180 = 0.5;
         break;
      case 43200:
         gd_180 = 0.6;
      }
      if (iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 0) > gd_180) {
         if (iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 0) > iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 2)) {
            ObjectSetText(gsa_116[2] + l_index_100 + "1", CharToStr(gi_188), g_fontsize_136, "Wingdings", cBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "1", " BUY", 9, "Arial Bold", cBuy);
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "1", CharToStr(gi_196), g_fontsize_136, "Wingdings", cWeakBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "1", " BUY", 9, "Arial Bold", cWeakBuy);
         }
      } else {
         if (iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 0) < -gd_180) {
            if (iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 0) < iCustom(Symbol(), gia_148[l_index_100], "FDB_TMeter", 3, 36, 0.0, 100, 1, 0, 2)) {
               ObjectSetText(gsa_116[2] + l_index_100 + "1", CharToStr(gi_192), g_fontsize_136, "Wingdings", cSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "1", "SELL", 9, "Arial Bold", cSell);
            } else {
               ObjectSetText(gsa_116[2] + l_index_100 + "1", CharToStr(gi_200), g_fontsize_136, "Wingdings", cWeakSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "1", "SELL", 9, "Arial Bold", cWeakSell);
            }
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "1", CharToStr(gi_204), g_fontsize_136, "Wingdings", cFlat);
            ObjectSetText(gsa_116[3] + l_index_100 + "1", "FLAT", 9, "Arial Bold", cFlat);
         }
      }
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      if (Bid > iCustom(Symbol(), gia_148[l_index_100], "FDB_DynamicRS", RS_Lookback, 500, 0, 0)) {
         if (Bid > iCustom(Symbol(), gia_148[l_index_100], "FDB_DynamicRS", RS_Lookback, 500, 1, 0)) {
            ObjectSetText(gsa_116[2] + l_index_100 + "2", CharToStr(gi_188), g_fontsize_136, "Wingdings", cBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "2", " BUY", 9, "Arial Bold", cBuy);
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "2", CharToStr(gi_208), g_fontsize_136, "Wingdings", cWeakBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "2", " BUY", 9, "Arial Bold", cWeakBuy);
         }
      } else {
         if (Ask < iCustom(Symbol(), gia_148[l_index_100], "FDB_DynamicRS", RS_Lookback, 500, 0, 0)) {
            if (Ask < iCustom(Symbol(), gia_148[l_index_100], "FDB_DynamicRS", RS_Lookback, 500, 2, 0)) {
               ObjectSetText(gsa_116[2] + l_index_100 + "2", CharToStr(gi_192), g_fontsize_136, "Wingdings", cSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "2", "SELL", 9, "Arial Bold", cSell);
            } else {
               ObjectSetText(gsa_116[2] + l_index_100 + "2", CharToStr(gi_212), g_fontsize_136, "Wingdings", cWeakSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "2", "SELL", 9, "Arial Bold", cWeakSell);
            }
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "2", CharToStr(gi_204), 10, "Wingdings", cFlat);
            ObjectSetText(gsa_116[3] + l_index_100 + "2", "FLAT", 9, "Arial Bold", cFlat);
         }
      }
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      if (iCustom(Symbol(), gia_148[l_index_100], "FDB_3BarReversal_v2", 3, 0, 1, 0) != 0.0) {
         ObjectSetText(gsa_116[2] + l_index_100 + "3", CharToStr(gi_188), g_fontsize_136, "Wingdings", cBuy);
         ObjectSetText(gsa_116[3] + l_index_100 + "3", " BUY", 9, "Arial Bold", cBuy);
      } else {
         if (iCustom(Symbol(), gia_148[l_index_100], "FDB_3BarReversal_v2", 3, 0, 0, 0) != 0.0) {
            ObjectSetText(gsa_116[2] + l_index_100 + "3", CharToStr(gi_192), g_fontsize_136, "Wingdings", cSell);
            ObjectSetText(gsa_116[3] + l_index_100 + "3", "SELL", 9, "Arial Bold", cSell);
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "3", CharToStr(gi_204), 10, "Wingdings", cFlat);
            ObjectSetText(gsa_116[3] + l_index_100 + "3", "FLAT", 9, "Arial Bold", cFlat);
         }
      }
   }
   for (l_index_100 = 0; l_index_100 < 6; l_index_100++) {
      l_icustom_56 = iCustom(Symbol(), gia_148[l_index_100], "FXDB_TPDots", 500, 1, 0, 0, 0);
      l_icustom_64 = iCustom(Symbol(), gia_148[l_index_100], "FXDB_TPDots", 500, 1, 0, 1, 0);
      l_icustom_72 = iCustom(Symbol(), gia_148[l_index_100], "FXDB_TPDots", 500, 1, 0, 2, 0);
      l_icustom_80 = iCustom(Symbol(), gia_148[l_index_100], "FXDB_TPDots", 500, 0, 1, 3, 0);
      l_icustom_88 = iCustom(Symbol(), gia_148[l_index_100], "FXDB_TPDots", 500, 0, 1, 4, 0);
      if (l_icustom_64 > l_icustom_72 && l_icustom_56 > l_icustom_64) {
         if (l_icustom_88 < l_icustom_64) {
            ObjectSetText(gsa_116[2] + l_index_100 + "4", CharToStr(gi_196), g_fontsize_136, "Wingdings", cWeakBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "4", " BUY", 9, "Arial Bold", cWeakBuy);
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "4", CharToStr(gi_188), g_fontsize_136, "Wingdings", cBuy);
            ObjectSetText(gsa_116[3] + l_index_100 + "4", " BUY", 9, "Arial Bold", cBuy);
         }
      } else {
         if (l_icustom_72 > l_icustom_64 && l_icustom_56 < l_icustom_72) {
            if (l_icustom_80 > l_icustom_72) {
               ObjectSetText(gsa_116[2] + l_index_100 + "4", CharToStr(gi_200), g_fontsize_136, "Wingdings", cWeakSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "4", "SELL", 9, "Arial Bold", cWeakSell);
            } else {
               ObjectSetText(gsa_116[2] + l_index_100 + "4", CharToStr(gi_192), g_fontsize_136, "Wingdings", cSell);
               ObjectSetText(gsa_116[3] + l_index_100 + "4", "SELL", 9, "Arial Bold", cSell);
            }
         } else {
            ObjectSetText(gsa_116[2] + l_index_100 + "4", CharToStr(gi_204), 10, "Wingdings", cFlat);
            ObjectSetText(gsa_116[3] + l_index_100 + "4", "FLAT", 9, "Arial Bold", cFlat);
         }
      }
   }
   for (int l_index_112 = 0; l_index_112 < g_count_368; l_index_112++) {
      RefreshRates();
      g_symbol_244 = gsa_316[l_index_112];
      gs_236 = StringSubstr(Symbol(), 6, 1);
      if (StringFind(AccountCompany(), "Interbank") == 0 && gs_236 == "m") g_symbol_244 = g_symbol_244 + "m";
      lda_16[l_index_112] = iHigh(g_symbol_244, PERIOD_H1, iHighest(g_symbol_244, PERIOD_H1, MODE_HIGH, 24, 0));
      lda_20[l_index_112] = iLow(g_symbol_244, PERIOD_H1, iLowest(g_symbol_244, PERIOD_H1, MODE_LOW, 24, 0));
      g_point_320 = MarketInfo(g_symbol_244, MODE_POINT);
      lda_24[l_index_112] = MarketInfo(g_symbol_244, MODE_BID);
      lda_28[l_index_112] = MarketInfo(g_symbol_244, MODE_ASK);
      lda_32[l_index_112] = MarketInfo(g_symbol_244, MODE_DIGITS);
      lda_36[l_index_112] = MathMax((lda_16[l_index_112] - lda_20[l_index_112]) / g_point_320, 1);
      lda_40[l_index_112] = (lda_24[l_index_112] - lda_20[l_index_112]) / lda_36[l_index_112] / g_point_320;
      lda_44[l_index_112] = iLookup(100.0 * lda_40[l_index_112]);
      lda_48[l_index_112] = 9 - lda_44[l_index_112];
   }
   lda_52[0] = NormalizeDouble((lda_44[3] + lda_44[4] + lda_44[5] + lda_48[0] + lda_48[1] + lda_48[2] + lda_48[13]) / 7.0, 1);
   lda_52[1] = NormalizeDouble((lda_44[17] + lda_44[0] + lda_44[6] + lda_44[7] + lda_44[8] + lda_44[9]) / 6.0, 1);
   lda_52[2] = NormalizeDouble((lda_44[1] + lda_44[10] + lda_44[11] + lda_48[7]) / 4.0, 1);
   lda_52[3] = NormalizeDouble((lda_44[16] + lda_48[4] + lda_48[8] + lda_48[11]) / 4.0, 1);
   lda_52[4] = NormalizeDouble((lda_48[18] + lda_48[5] + lda_48[17]) / 3.0, 1);
   lda_52[5] = NormalizeDouble(0.2 * (lda_44[2] + lda_44[15] + lda_44[18] + lda_44[12] + lda_48[9]), 1);
   lda_52[6] = NormalizeDouble((lda_48[3] + lda_48[6] + lda_48[10] + lda_48[12] + lda_48[14] + lda_48[16]) / 6.0, 1);
   lda_52[7] = NormalizeDouble((lda_44[13] + lda_44[14] + lda_48[15]) / 3.0, 1);
   gs_300 = StringSubstr(Symbol(), 0, 3);
   gs_308 = StringSubstr(Symbol(), 3, 3);
   gsa_120[1] = gs_300 + " RS:";
   gsa_120[2] = gs_308 + " RS:";
   gs_252 = StringSubstr(Symbol(), 0, 6);
   if (gs_252 == "EURUSD") {
      gi_unused_360 = 0;
      gd_328 = lda_52[1];
      gd_336 = lda_52[0];
   } else {
      if (gs_252 == "GBPUSD") {
         gi_unused_360 = 1;
         gd_328 = lda_52[2];
         gd_336 = lda_52[0];
      } else {
         if (gs_252 == "AUDUSD") {
            gi_unused_360 = 2;
            gd_328 = lda_52[5];
            gd_336 = lda_52[0];
         } else {
            if (gs_252 == "USDJPY") {
               gi_unused_360 = 3;
               gd_328 = lda_52[0];
               gd_336 = lda_52[6];
            } else {
               if (gs_252 == "USDCHF") {
                  gi_unused_360 = 4;
                  gd_328 = lda_52[0];
                  gd_336 = lda_52[3];
               } else {
                  if (gs_252 == "USDCAD") {
                     gi_unused_360 = 5;
                     gd_328 = lda_52[0];
                     gd_336 = lda_52[4];
                  } else {
                     if (gs_252 == "EURJPY") {
                        gi_unused_360 = 6;
                        gd_328 = lda_52[1];
                        gd_336 = lda_52[6];
                     } else {
                        if (gs_252 == "EURGBP") {
                           gi_unused_360 = 7;
                           gd_328 = lda_52[1];
                           gd_336 = lda_52[2];
                        } else {
                           if (gs_252 == "EURCHF") {
                              gi_unused_360 = 8;
                              gd_328 = lda_52[1];
                              gd_336 = lda_52[3];
                           } else {
                              if (gs_252 == "EURAUD") {
                                 gi_unused_360 = 9;
                                 gd_328 = lda_52[1];
                                 gd_336 = lda_52[5];
                              } else {
                                 if (gs_252 == "GBPJPY") {
                                    gi_unused_360 = 10;
                                    gd_328 = lda_52[2];
                                    gd_336 = lda_52[6];
                                 } else {
                                    if (gs_252 == "GBPCHF") {
                                       gi_unused_360 = 11;
                                       gd_328 = lda_52[2];
                                       gd_336 = lda_52[3];
                                    } else {
                                       if (gs_252 == "AUDJPY") {
                                          gi_unused_360 = 12;
                                          gd_328 = lda_52[5];
                                          gd_336 = lda_52[6];
                                       } else {
                                          if (gs_252 == "NZDUSD") {
                                             gi_unused_360 = 13;
                                             gd_328 = lda_52[7];
                                             gd_336 = lda_52[0];
                                          } else {
                                             if (gs_252 == "NZDJPY") {
                                                gi_unused_360 = 14;
                                                gd_328 = lda_52[7];
                                                gd_336 = lda_52[6];
                                             } else {
                                                if (gs_252 == "AUDNZD") {
                                                   gi_unused_360 = 15;
                                                   gd_328 = lda_52[5];
                                                   gd_336 = lda_52[7];
                                                } else {
                                                   if (gs_252 == "CHFJPY") {
                                                      gi_unused_360 = 16;
                                                      gd_328 = lda_52[3];
                                                      gd_336 = lda_52[6];
                                                   } else {
                                                      if (gs_252 == "EURCAD") {
                                                         gi_unused_360 = 17;
                                                         gd_328 = lda_52[1];
                                                         gd_336 = lda_52[4];
                                                      } else {
                                                         if (gs_252 == "AUDCAD") {
                                                            gi_unused_360 = 18;
                                                            gd_328 = lda_52[5];
                                                            gd_336 = lda_52[4];
                                                         }
                                                      }
                                                   }
                                                }
                                             }
                                          }
                                       }
                                    }
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
   gd_344 = MathAbs(gd_328 - gd_336);
   if (gd_344 < 3.0) ObjectSetText(gsa_116[4] + "21", CharToStr(243), 1.5 * g_fontsize_136, "Wingdings", Khaki);
   if (gd_344 >= 3.0 && gd_328 > gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(200), 1.5 * g_fontsize_136, "Wingdings", Yellow);
   if (gd_344 >= 4.5 && gd_328 > gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(gi_200), 1.5 * g_fontsize_136, "Wingdings", Lime);
   if (gd_344 >= 6.5 && gd_328 > gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(gi_188), 1.5 * g_fontsize_136, "Wingdings", Green);
   if (gd_344 >= 3.0 && gd_328 < gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(202), 1.5 * g_fontsize_136, "Wingdings", Yellow);
   if (gd_344 >= 4.5 && gd_328 < gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(gi_196), 1.5 * g_fontsize_136, "Wingdings", DarkOrange);
   if (gd_344 >= 6.5 && gd_328 < gd_336) ObjectSetText(gsa_116[4] + "21", CharToStr(gi_192), 1.5 * g_fontsize_136, "Wingdings", Red);
   if (gd_328 <= 2.5) g_color_224 = Red;
   if (gd_328 > 2.5 && gd_328 < 4.5) g_color_224 = DarkOrange;
   if (gd_328 >= 4.5 && gd_328 < 6.5) g_color_224 = Yellow;
   if (gd_328 >= 6.5) g_color_224 = Lime;
   if (gd_336 <= 2.5) g_color_228 = Red;
   if (gd_336 > 2.5 && gd_336 < 4.5) g_color_228 = DarkOrange;
   if (gd_336 >= 4.5 && gd_336 < 6.5) g_color_228 = Yellow;
   if (gd_336 >= 6.5) g_color_228 = Lime;
   ObjectSetText(gsa_116[4] + "11", DoubleToStr(gd_328, 1), 12, "Arial Bold", g_color_224);
   ObjectSetText(gsa_116[4] + "12", DoubleToStr(gd_336, 1), 12, "Arial Bold", g_color_228);
   string l_symbol_116 = Symbol();
   double ld_124 = (iATR(l_symbol_116, PERIOD_D1, 20, 0) + iATR(l_symbol_116, PERIOD_D1, 10, 0) + iATR(l_symbol_116, PERIOD_D1, 5, 0)) / 3.0;
   g_dbl2str_260 = DoubleToStr(iHigh(l_symbol_116, PERIOD_H1, iHighest(l_symbol_116, PERIOD_H1, MODE_HIGH, RS_Lookback, 0)), Digits);
   g_dbl2str_276 = DoubleToStr(MarketInfo(l_symbol_116, MODE_BID), Digits);
   g_dbl2str_268 = DoubleToStr(iLow(l_symbol_116, PERIOD_H1, iLowest(l_symbol_116, PERIOD_H1, MODE_LOW, RS_Lookback, 0)), Digits);
   g_dbl2str_284 = DoubleToStr((StrToDouble(g_dbl2str_260) - StrToDouble(g_dbl2str_268)) / Point, 1);
   if (StrToDouble(g_dbl2str_284) <= 0.0) g_dbl2str_284 = 1;
   g_dbl2str_292 = DoubleToStr(100.0 * ((StrToDouble(g_dbl2str_276) - StrToDouble(g_dbl2str_268)) / StrToDouble(g_dbl2str_284)) / Point, 2);
   gd_352 = Lookup(StrToDouble(g_dbl2str_292));
   if (gd_352 < 6.0 && gd_352 > 3.0) gi_364 = 0;
   if (gd_352 >= 6.0) gi_364 = 1;
   if (gd_352 >= 7.0) gi_364 = 2;
   if (gd_352 >= 8.0) gi_364 = 3;
   if (gd_352 <= 3.0) gi_364 = -1;
   if (gd_352 <= 2.0) gi_364 = -2;
   if (gd_352 <= 1.0) gi_364 = -3;
   if (gd_352 <= 2.0) g_color_232 = Red;
   if (gd_352 > 2.0 && gd_352 < 5.0) g_color_232 = DarkOrange;
   if (gd_352 >= 5.0 && gd_352 < 7.0) g_color_232 = Yellow;
   if (gd_352 >= 7.0) g_color_232 = LimeGreen;
   double l_str2dbl_132 = StrToDouble(g_dbl2str_284);
   g_color_228 = SkyBlue;
   if (l_str2dbl_132 > ld_124 / 3.0) g_color_228 = DarkOrange;
   if (l_str2dbl_132 > 2.0 * (ld_124 / 3.0)) g_color_228 = Yellow;
   if (l_str2dbl_132 > ld_124) g_color_228 = Green;
   if (l_str2dbl_132 > 1.5 * ld_124) g_color_228 = LimeGreen;
   ObjectSetText(gsa_116[4] + "13", DoubleToStr(gi_364, 0), 12, "Arial Bold", g_color_232);
   if (Digits == 3 || Digits == 5) g_dbl2str_284 = DoubleToStr((StrToDouble(g_dbl2str_260) - StrToDouble(g_dbl2str_268)) / (10.0 * Point), 1);
   ObjectSetText(gsa_116[4] + "14", g_dbl2str_284, 10, "Arial Bold", g_color_228);
   watermark();
   return (0);
}

/*int CheckKey() {
   double ld_0;
   double ld_8;
   double ld_16;
   int l_month_24 = TimeMonth(TimeCurrent());
   if (IsDemo() == TRUE) {
      ld_0 = NormalizeDouble(MathAbs(AccountNumber() << 2 - 3912671 * l_month_24), 0);
      ld_16 = NormalizeDouble(MathAbs(g_str2dbl_140), 0);
   } else {
      ld_0 = NormalizeDouble(MathAbs(AccountNumber() << 2 + 10110110 - 5382974 * l_month_24), 0);
      ld_16 = NormalizeDouble(MathAbs(g_str2dbl_144), 0);
   }
   if (TimeMonth(TimeCurrent() - 259200) == l_month_24 - 1 && ld_16 > 0.0) {
      if (IsDemo() == TRUE) ld_8 = NormalizeDouble(MathAbs(AccountNumber() << 2 - 3912671 * (l_month_24 - 1)), 0);
      else ld_8 = NormalizeDouble(MathAbs(AccountNumber() << 2 + 10110110 - 5382974 * (l_month_24 - 1)), 0);
   }
   if (gi_220 == TRUE && ld_16 == ld_8) {
      Print("Registration Key expires on the 3rd at Midnite.  Login and generate a new key.");
      gi_220 = FALSE;
   }
   if (ld_16 == ld_0 || ld_16 == ld_8 && ld_16 > 0.0) return (1);
   return (0);
} */

void watermark() {
   ObjectCreate(gs_124, OBJ_LABEL, WindowFind(gs_124), 0, 0);
   ObjectSetText(gs_124, "Forex Deal Butler", 9, "Lucida Handwriting", RoyalBlue);
   ObjectSet(gs_124, OBJPROP_CORNER, 3);
   ObjectSet(gs_124, OBJPROP_XDISTANCE, 5);
   ObjectSet(gs_124, OBJPROP_YDISTANCE, 10);
}

int Lookup(double ad_0) {
   int li_ret_8;
   int lia_12[10] = {0, 3, 10, 25, 40, 50, 60, 75, 90, 97};
   if (ad_0 <= lia_12[0]) li_ret_8 = 0;
   else {
      if (ad_0 < lia_12[1]) li_ret_8 = 0;
      else {
         if (ad_0 < lia_12[2]) li_ret_8 = 1;
         else {
            if (ad_0 < lia_12[3]) li_ret_8 = 2;
            else {
               if (ad_0 < lia_12[4]) li_ret_8 = 3;
               else {
                  if (ad_0 < lia_12[5]) li_ret_8 = 4;
                  else {
                     if (ad_0 < lia_12[6]) li_ret_8 = 5;
                     else {
                        if (ad_0 < lia_12[7]) li_ret_8 = 6;
                        else {
                           if (ad_0 < lia_12[8]) li_ret_8 = 7;
                           else {
                              if (ad_0 < lia_12[9]) li_ret_8 = 8;
                              else li_ret_8 = 9;
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
   return (li_ret_8);
}

int iLookup(double ad_0) {
   int li_ret_8;
   int lia_12[10] = {0, 3, 10, 25, 40, 50, 60, 75, 90, 97};
   if (ad_0 <= lia_12[0]) li_ret_8 = 0;
   else {
      if (ad_0 < lia_12[1]) li_ret_8 = 0;
      else {
         if (ad_0 < lia_12[2]) li_ret_8 = 1;
         else {
            if (ad_0 < lia_12[3]) li_ret_8 = 2;
            else {
               if (ad_0 < lia_12[4]) li_ret_8 = 3;
               else {
                  if (ad_0 < lia_12[5]) li_ret_8 = 4;
                  else {
                     if (ad_0 < lia_12[6]) li_ret_8 = 5;
                     else {
                        if (ad_0 < lia_12[7]) li_ret_8 = 6;
                        else {
                           if (ad_0 < lia_12[8]) li_ret_8 = 7;
                           else {
                              if (ad_0 < lia_12[9]) li_ret_8 = 8;
                              else li_ret_8 = 9;
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
   return (li_ret_8);
}