#property copyright "Copyright © 2014, TLP"
#property link      "http://www.google.com"

#property indicator_separate_window
#property indicator_minimum -110.0
#property indicator_maximum 110.0
#property indicator_levelcolor C'0x40,0x40,0x40'
#property indicator_buffers 8
#property indicator_color1 Fuchsia
#property indicator_color2 C'0x80,0x00,0xFF'
#property indicator_color3 Blue
#property indicator_color4 Lime
#property indicator_color5 Yellow
#property indicator_color6 C'0xFF,0x80,0x00'
#property indicator_color7 Red
#property indicator_color8 White
#property indicator_width1 1
#property indicator_level1 -100.0
#property indicator_width2 1
#property indicator_level2 -50.0
#property indicator_width3 1
#property indicator_width4 1
#property indicator_level4 50.0
#property indicator_width5 1
#property indicator_level5 100.0

int Gi_76;
bool Gi_80 = FALSE;
int G_datetime_84 = 0;
int G_datetime_88 = 0;
bool Gi_92 = FALSE;
double Gd_96 = 0.0;
int Gi_104 = 86400;
string Gs_108 = "update.html";
bool Gi_unused_116 = FALSE;
string Gs_dummy_120;
int Gi_unused_128 = 0;
int Gi_132 = 1;
string Gs_dummy_136;
bool Gi_144 = FALSE;
int Gi_148 = 0;
int G_count_152 = 0;
string Gs_156;
int Gia_164[1];
datetime G_time_188;
extern string e_mail = "";
extern string note_1 = "1-RSI; 2-WPR; 3-Stoch; 4-BB%B; 5-MACD";
extern int algo = 2;
extern bool use_default_periods = TRUE;
extern string my_period = "20";
int G_str2int_224;
int G_str2int_228 = 12;
int G_str2int_232 = 26;
int G_period_236 = 9;
extern int smoothing = 1;
extern bool show_all = FALSE;
extern bool show_aud = TRUE;
extern bool show_cad = TRUE;
extern bool show_chf = TRUE;
extern bool show_eur = TRUE;
extern bool show_gbp = TRUE;
extern bool show_jpy = TRUE;
extern bool show_nzd = TRUE;
extern bool show_usd = TRUE;
extern bool show_labels = TRUE;
extern color aud_color = Fuchsia;
extern color cad_color = C'0x80,0x00,0xFF';
extern color chf_color = Blue;
extern color eur_color = Lime;
extern color gbp_color = Yellow;
extern color jpy_color = C'0xFF,0x80,0x00';
extern color nzd_color = Red;
extern color usd_color = White;
extern bool show_entry_signals = TRUE;
extern int bars_for_signals = 100;
extern bool show_correlations = FALSE;
extern bool automatic_line_weigth = TRUE;
extern bool force_update = TRUE;
extern int text_size = 10;
extern string text_font = "Segoe UI";
double G_ibuf_348[];
double G_ibuf_352[];
double G_ibuf_356[];
double G_ibuf_360[];
double G_ibuf_364[];
double G_ibuf_368[];
double G_ibuf_372[];
double G_ibuf_376[];
double Gda_380[];
double Gda_384[];
int G_window_388;
string Gs_392;
string Gsa_400[8];
string Gsa_404[64];
double Gda_unused_408[64];
int Gi_412;
string Gs_416;
bool Gi_424 = FALSE;
bool Gi_428 = TRUE;
bool Gi_432 = FALSE;
bool Gi_436 = FALSE;
bool Gi_440 = FALSE;
bool Gi_444 = FALSE;
bool Gi_448 = FALSE;
bool Gi_452 = FALSE;
bool Gi_456 = FALSE;
bool Gi_460 = FALSE;
bool G_bool_464 = FALSE;
bool G_bool_468 = FALSE;
bool G_bool_472 = FALSE;
bool G_bool_476 = FALSE;
bool G_bool_480 = FALSE;
bool G_bool_484 = FALSE;
bool G_bool_488 = FALSE;
bool G_bool_492 = FALSE;

// 831729A4F56963E1CC71DB4161E91EE3
double f0_15(double Ad_0, double Ad_8) {
   return (Ad_0 + Ad_8);
}

// A22B4750F5F49F2101454F6CF9DEF4FF
double f0_18(double Ad_0, double Ad_8, double Ad_16) {
   return (Ad_0 + Ad_8 + Ad_16);
}

// F1F348EBF7E6886FC1E743A675246401
double f0_24(double Ad_0, double Ad_8) {
   return (Ad_0 - Ad_8);
}

// 96776285244E8BDFE045ED78CE27F9F8
double f0_17(double Ad_0, double Ad_8) {
   return (Ad_0 * Ad_8);
}

// 5595D7EADE87C6016BF6DC47201779C6
double f0_12(double Ad_0, double Ad_8) {
   return (Ad_0 / Ad_8);
}

// 4A6E6A34F9136FC848D2EC9AF79C2447
string f0_8(string As_0, string As_8) {
   return (StringConcatenate(As_0, As_8));
}

// A5571371E32305BA5A353918A2CE2EBB
string f0_19(string As_0, string As_8, string As_16) {
   return (StringConcatenate(As_0, As_8, As_16));
}

// 546AF10B3A7B14C3ED3654C2CDDDF80D
string f0_10(string As_0, string As_8, string As_16, string As_24) {
   return (StringConcatenate(As_0, As_8, As_16, As_24));
}

// C55F233C1991A7FA05479098FC827EEC
int f0_20(string As_0, string As_8, string &Asa_16[], int Ai_20 = 0) {
   int Li_24;
   int Li_28;
   int Li_32;
   if (StringFind(As_0, As_8) < 0) {
      ArrayResize(Asa_16, 1);
      Asa_16[0] = As_0;
   } else {
      Li_24 = 0;
      Li_28 = 0;
      Li_32 = 0;
      while (Li_28 > -1) {
         Li_32++;
         Li_28 = StringFind(As_0, As_8, Li_24);
         ArrayResize(Asa_16, Li_32);
         if (Li_28 > -1) {
            if (Li_28 - Li_24 > 0) Asa_16[Li_32 - 1] = StringSubstr(As_0, Li_24, Li_28 - Li_24);
         } else Asa_16[Li_32 - 1] = StringSubstr(As_0, Li_24, 0);
         Li_24 = Li_28 + 1;
      }
   }
   if (Ai_20 == 0 || Ai_20 == ArraySize(Asa_16)) return (1);
   return (0);
}

// 16299D7A8EEA25FE62FC48C14B3643B5
int f0_1() {
   if (G_time_188 == Time[0]) return (0);
   G_time_188 = Time[0];
   return (1);
}

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   Print("PotenzaFX_Powerlines v1.05");
   f0_2();
   Gi_92 = TRUE;
   return (0);
}

// 1C86E8D4535299BB79FDC73CA04439CC
int f0_2() {
   string Lsa_0[];
   string symbol_4;
   Comment("");
   if (smoothing < 1) smoothing = 1;
   G_period_236 = smoothing;
   if (algo < 5) G_str2int_224 = StrToInteger(my_period);
   if (algo == 5) {
      if (f0_20(my_period, ";", Lsa_0, 2)) {
         G_str2int_228 = StrToInteger(Lsa_0[0]);
         G_str2int_232 = StrToInteger(Lsa_0[1]);
      }
   }
   if (smoothing > 1 && algo < 5) Gi_424 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "AUD") Gi_432 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "AUD") Gi_432 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "CAD") Gi_436 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "CAD") Gi_436 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "CHF") Gi_440 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "CHF") Gi_440 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "EUR") Gi_444 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "EUR") Gi_444 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "GBP") Gi_448 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "GBP") Gi_448 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "JPY") Gi_452 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "JPY") Gi_452 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "NZD") Gi_456 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "NZD") Gi_456 = TRUE;
   if (StringSubstr(Symbol(), 0, 3) == "USD") Gi_460 = TRUE;
   if (StringSubstr(Symbol(), 3, 3) == "USD") Gi_460 = TRUE;
   G_bool_464 = (show_all == FALSE && Gi_432) || (show_all && show_aud) || show_correlations;
   G_bool_468 = (show_all == FALSE && Gi_436) || (show_all && show_aud) || show_correlations;
   G_bool_472 = (show_all == FALSE && Gi_440) || (show_all && show_aud) || show_correlations;
   G_bool_476 = (show_all == FALSE && Gi_444) || (show_all && show_aud) || show_correlations;
   G_bool_480 = (show_all == FALSE && Gi_448) || (show_all && show_aud) || show_correlations;
   G_bool_484 = (show_all == FALSE && Gi_452) || (show_all && show_aud) || show_correlations;
   G_bool_488 = (show_all == FALSE && Gi_456) || (show_all && show_aud) || show_correlations;
   G_bool_492 = (show_all == FALSE && Gi_460) || (show_all && show_aud) || show_correlations;
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexStyle(5, DRAW_LINE);
   SetIndexStyle(6, DRAW_LINE);
   SetIndexStyle(7, DRAW_LINE);
   SetIndexBuffer(0, G_ibuf_348);
   SetIndexBuffer(1, G_ibuf_352);
   SetIndexBuffer(2, G_ibuf_356);
   SetIndexBuffer(3, G_ibuf_360);
   SetIndexBuffer(4, G_ibuf_364);
   SetIndexBuffer(5, G_ibuf_368);
   SetIndexBuffer(6, G_ibuf_372);
   SetIndexBuffer(7, G_ibuf_376);
   SetIndexLabel(0, "Powerline(AUD)");
   SetIndexLabel(1, "Powerline(CAD)");
   SetIndexLabel(2, "Powerline(CHF)");
   SetIndexLabel(3, "Powerline(EUR)");
   SetIndexLabel(4, "Powerline(GBP)");
   SetIndexLabel(5, "Powerline(JPY)");
   SetIndexLabel(6, "Powerline(NZD)");
   SetIndexLabel(7, "Powerline(USD)");
   Gs_416 = f0_10("PotenzaFX Powerlines", " (Algo: ", algo, ")");
   IndicatorShortName(Gs_416);
   IndicatorDigits(2);
   Gs_392 = StringSubstr(Symbol(), 6, 0);
   Gsa_400[0] = "AUD";
   Gsa_400[1] = "CAD";
   Gsa_400[2] = "CHF";
   Gsa_400[3] = "EUR";
   Gsa_400[4] = "GBP";
   Gsa_400[5] = "JPY";
   Gsa_400[6] = "NZD";
   Gsa_400[7] = "USD";
   for (int index_12 = 0; index_12 < 8; index_12++) {
      for (int index_16 = 0; index_16 < 8; index_16++) {
         if (index_12 != index_16) {
            symbol_4 = f0_19(Gsa_400[index_12], Gsa_400[index_16], Gs_392);
            if (MarketInfo(symbol_4, MODE_TRADEALLOWED) == 1.0) {
               Gsa_404[Gi_412] = symbol_4;
               Gi_412++;
            }
         }
      }
   }
   if (use_default_periods) {
      if (Period() == PERIOD_M1) {
         G_str2int_224 = 30;
         G_str2int_228 = 14;
         G_str2int_232 = 30;
      }
      if (Period() == PERIOD_M5) {
         G_str2int_224 = 24;
         G_str2int_228 = 11;
         G_str2int_232 = 24;
      }
      if (Period() == PERIOD_M15) {
         G_str2int_224 = 24;
         G_str2int_228 = 11;
         G_str2int_232 = 24;
      }
      if (Period() == PERIOD_M30) {
         G_str2int_224 = 24;
         G_str2int_228 = 11;
         G_str2int_232 = 24;
      }
      if (Period() == PERIOD_H1) {
         G_str2int_224 = 24;
         G_str2int_228 = 11;
         G_str2int_232 = 24;
      }
      if (Period() == PERIOD_H4) {
         G_str2int_224 = 30;
         G_str2int_228 = 14;
         G_str2int_232 = 30;
      }
      if (Period() == PERIOD_D1) {
         G_str2int_224 = 20;
         G_str2int_228 = 9;
         G_str2int_232 = 20;
      }
      if (Period() == PERIOD_W1) {
         G_str2int_224 = 27;
         G_str2int_228 = 12;
         G_str2int_232 = 27;
      }
      if (Period() == PERIOD_MN1) {
         G_str2int_224 = 24;
         G_str2int_228 = 11;
         G_str2int_232 = 24;
      }
   }
   if (algo == 5) {
      Print("macd_fast_period = ", G_str2int_228);
      Print("macd_slow_period = ", G_str2int_232);
      Print("macd_signal_period = ", G_period_236);
   }
   if (algo < 5 && G_str2int_224 <= 1) Gi_428 = FALSE;
   if (algo == 5) {
      if (G_str2int_228 <= 1) Gi_428 = FALSE;
      if (G_str2int_228 > G_str2int_232) Gi_428 = FALSE;
   }
   if (Gi_428 == FALSE) Alert("PotenzaFX_Powerlines: Period settings are NOT ok, please check them.");
   Comment("");
   for (int Li_20 = Bars; Li_20 >= 0; Li_20--) {
      ObjectDelete(f0_19(Symbol(), "_BUY_", Time[Li_20]));
      ObjectDelete(f0_19(Symbol(), "_SELL_", Time[Li_20]));
   }
   for (int Li_24 = 1; Li_24 <= 4; Li_24++) {
      ObjectDelete(f0_8("AUD", Li_24));
      ObjectDelete(f0_8("CAD", Li_24));
      ObjectDelete(f0_8("CHF", Li_24));
      ObjectDelete(f0_8("EUR", Li_24));
      ObjectDelete(f0_8("GBP", Li_24));
      ObjectDelete(f0_8("JPY", Li_24));
      ObjectDelete(f0_8("NZD", Li_24));
      ObjectDelete(f0_8("USD", Li_24));
   }
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   Comment("");
   for (int Li_0 = Bars; Li_0 >= 0; Li_0--) {
      ObjectDelete(f0_19(Symbol(), "_BUY_", Time[Li_0]));
      ObjectDelete(f0_19(Symbol(), "_SELL_", Time[Li_0]));
   }
   for (int Li_4 = 1; Li_4 <= 4; Li_4++) {
      ObjectDelete(f0_8("AUD", Li_4));
      ObjectDelete(f0_8("CAD", Li_4));
      ObjectDelete(f0_8("CHF", Li_4));
      ObjectDelete(f0_8("EUR", Li_4));
      ObjectDelete(f0_8("GBP", Li_4));
      ObjectDelete(f0_8("JPY", Li_4));
      ObjectDelete(f0_8("NZD", Li_4));
      ObjectDelete(f0_8("USD", Li_4));
   }
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   if (!Gi_92) {
      f0_2();
      Gi_92 = TRUE;
   }
   f0_21();
   return (0);
}

// CE950C824EB925C8055E76804B523700
int f0_21() {
   double Ld_16;
   double Ld_24;
   double Ld_32;
   double Ld_40;
   double Ld_48;
   double Ld_56;
   double Ld_64;
   double Ld_72;
   string name_80;
   string name_88;
   double Ld_96;
   double Ld_104;
   double Ld_112;
   double Ld_120;
   double Ld_128;
   double Ld_136;
   double Ld_144;
   double Ld_152;
   double Ld_160;
   double Ld_168;
   double Ld_176;
   double Ld_184;
   double Ld_192;
   double Ld_200;
   double Ld_208;
   double Ld_216;
   double Ld_224;
   double Ld_232;
   double Ld_240;
   double Ld_248;
   double Ld_256;
   double Ld_264;
   double Ld_272;
   double Ld_280;
   double Ld_288;
   double Ld_296;
   double Ld_304;
   double Ld_312;
   string Ls_320;
   G_window_388 = WindowFind(Gs_416);
   int ind_counted_4 = IndicatorCounted();
   ArrayResize(Gda_380, Bars);
   ArrayResize(Gda_384, Bars);
   if (Gi_428 == FALSE) return (0);
   if (Bars <= G_str2int_224) return (0);
   int Li_8 = Bars - ind_counted_4;
   if (ind_counted_4 > 0) Li_8++;
   if (f0_1() && force_update) Li_8 = Bars;
   for (int index_0 = 0; index_0 < Li_8; index_0++) {
      if (G_bool_464) {
         if (Gi_424) {
            Ld_16 = 0;
            for (int count_12 = 0; count_12 < smoothing; count_12++) Ld_16 = f0_15(Ld_16, f0_0("AUD", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_348[index_0] = f0_12(Ld_16, smoothing);
         } else G_ibuf_348[index_0] = f0_0("AUD", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_348[index_0] = f0_17(f0_24(G_ibuf_348[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("AUD", algo));
            ObjectCreate(f0_8("AUD", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_348[0] + MathAbs(G_ibuf_348[0] / 10.0));
            ObjectSetText(f0_8("AUD", algo), "                       AUD: " + DoubleToStr(G_ibuf_348[0], 2), text_size, text_font, aud_color);
            if (automatic_line_weigth) SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_348[0], 20)), 0), aud_color);
         }
      }
      if (G_bool_468) {
         if (Gi_424) {
            Ld_24 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_24 = f0_15(Ld_24, f0_0("CAD", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_352[index_0] = f0_12(Ld_24, smoothing);
         } else G_ibuf_352[index_0] = f0_0("CAD", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_352[index_0] = f0_17(f0_24(G_ibuf_352[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("CAD", algo));
            ObjectCreate(f0_8("CAD", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_352[0] + MathAbs(G_ibuf_352[0] / 10.0));
            ObjectSetText(f0_8("CAD", algo), "                       CAD: " + DoubleToStr(G_ibuf_352[0], 2), text_size, text_font, cad_color);
            if (automatic_line_weigth) SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_352[0], 20)), 0), cad_color);
         }
      }
      if (G_bool_472) {
         if (Gi_424) {
            Ld_32 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_32 = f0_15(Ld_32, f0_0("CHF", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_356[index_0] = f0_12(Ld_32, smoothing);
         } else G_ibuf_356[index_0] = f0_0("CHF", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_356[index_0] = f0_17(f0_24(G_ibuf_356[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("CHF", algo));
            ObjectCreate(f0_8("CHF", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_356[0] + MathAbs(G_ibuf_356[0] / 10.0));
            ObjectSetText(f0_8("CHF", algo), "                       CHF: " + DoubleToStr(G_ibuf_356[0], 2), text_size, text_font, chf_color);
            if (automatic_line_weigth) SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_356[0], 20)), 0), chf_color);
         }
      }
      if (G_bool_476) {
         if (Gi_424) {
            Ld_40 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_40 = f0_15(Ld_40, f0_0("EUR", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_360[index_0] = f0_12(Ld_40, smoothing);
         } else G_ibuf_360[index_0] = f0_0("EUR", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_360[index_0] = f0_17(f0_24(G_ibuf_360[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("EUR", algo));
            ObjectCreate(f0_8("EUR", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_360[0] + MathAbs(G_ibuf_360[0] / 10.0));
            ObjectSetText(f0_8("EUR", algo), "                       EUR: " + DoubleToStr(G_ibuf_360[0], 2), text_size, text_font, eur_color);
            if (automatic_line_weigth) SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_360[0], 20)), 0), eur_color);
         }
      }
      if (G_bool_480) {
         if (Gi_424) {
            Ld_48 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_48 = f0_15(Ld_48, f0_0("GBP", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_364[index_0] = f0_12(Ld_48, smoothing);
         } else G_ibuf_364[index_0] = f0_0("GBP", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_364[index_0] = f0_17(f0_24(G_ibuf_364[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("GBP", algo));
            ObjectCreate(f0_8("GBP", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_364[0] + MathAbs(G_ibuf_364[0] / 10.0));
            ObjectSetText(f0_8("GBP", algo), "                       GBP: " + DoubleToStr(G_ibuf_364[0], 2), text_size, text_font, gbp_color);
            if (automatic_line_weigth) SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_364[0], 20)), 0), gbp_color);
         }
      }
      if (G_bool_484) {
         if (Gi_424) {
            Ld_56 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_56 = f0_15(Ld_56, f0_0("JPY", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_368[index_0] = f0_12(Ld_56, smoothing);
         } else G_ibuf_368[index_0] = f0_0("JPY", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_368[index_0] = f0_17(f0_24(G_ibuf_368[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("JPY", algo));
            ObjectCreate(f0_8("JPY", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_368[0] + MathAbs(G_ibuf_368[0] / 10.0));
            ObjectSetText(f0_8("JPY", algo), "                       JPY: " + DoubleToStr(G_ibuf_368[0], 2), text_size, text_font, jpy_color);
            if (automatic_line_weigth) SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_368[0], 20)), 0), jpy_color);
         }
      }
      if (G_bool_488) {
         if (Gi_424) {
            Ld_64 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_64 = f0_15(Ld_64, f0_0("NZD", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_372[index_0] = f0_12(Ld_64, smoothing);
         } else G_ibuf_372[index_0] = f0_0("NZD", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_372[index_0] = f0_17(f0_24(G_ibuf_372[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("NZD", algo));
            ObjectCreate(f0_8("NZD", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_372[0] + MathAbs(G_ibuf_372[0] / 10.0));
            ObjectSetText(f0_8("NZD", algo), "                       NZD: " + DoubleToStr(G_ibuf_372[0], 2), text_size, text_font, nzd_color);
            if (automatic_line_weigth) SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_372[0], 20)), 0), nzd_color);
         }
      }
      if (G_bool_492) {
         if (Gi_424) {
            Ld_72 = 0;
            for (count_12 = 0; count_12 < smoothing; count_12++) Ld_72 = f0_15(Ld_72, f0_0("USD", G_str2int_224, f0_15(index_0, count_12)));
            G_ibuf_376[index_0] = f0_12(Ld_72, smoothing);
         } else G_ibuf_376[index_0] = f0_0("USD", G_str2int_224, index_0);
         if (algo < 5) G_ibuf_376[index_0] = f0_17(f0_24(G_ibuf_376[index_0], 50), 2);
         if (show_labels) {
            ObjectDelete(f0_8("USD", algo));
            ObjectCreate(f0_8("USD", algo), OBJ_TEXT, G_window_388, TimeCurrent(), G_ibuf_376[0] + MathAbs(G_ibuf_376[0] / 10.0));
            ObjectSetText(f0_8("USD", algo), "                       USD: " + DoubleToStr(G_ibuf_376[0], 2), text_size, text_font, usd_color);
            if (automatic_line_weigth) SetIndexStyle(7, DRAW_LINE, STYLE_SOLID, NormalizeDouble(MathAbs(f0_12(G_ibuf_376[0], 20)), 0), usd_color);
         }
      }
   }
   if (show_entry_signals == TRUE && show_all == FALSE && show_correlations == FALSE) {
      for (index_0 = bars_for_signals; index_0 > 0; index_0--) {
         name_80 = f0_19(Symbol(), "_BUY_", Time[index_0]);
         name_88 = f0_19(Symbol(), "_SELL_", Time[index_0]);
         ObjectDelete(name_80);
         ObjectDelete(name_88);
         if (StringSubstr(Symbol(), 0, 3) == "AUD") Gda_380[index_0] = G_ibuf_348[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "CAD") Gda_380[index_0] = G_ibuf_352[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "CHF") Gda_380[index_0] = G_ibuf_356[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "EUR") Gda_380[index_0] = G_ibuf_360[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "GBP") Gda_380[index_0] = G_ibuf_364[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "NZD") Gda_380[index_0] = G_ibuf_372[index_0];
         if (StringSubstr(Symbol(), 0, 3) == "USD") Gda_380[index_0] = G_ibuf_376[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "AUD") Gda_384[index_0] = G_ibuf_348[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "CAD") Gda_384[index_0] = G_ibuf_352[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "CHF") Gda_384[index_0] = G_ibuf_356[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "GBP") Gda_384[index_0] = G_ibuf_364[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "JPY") Gda_384[index_0] = G_ibuf_368[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "NZD") Gda_384[index_0] = G_ibuf_372[index_0];
         if (StringSubstr(Symbol(), 3, 3) == "USD") Gda_384[index_0] = G_ibuf_376[index_0];
         if (Gda_380[index_0 + 1] < Gda_384[index_0 + 1] && Gda_380[index_0] > Gda_384[index_0]) {
            ObjectCreate(name_80, OBJ_VLINE, 0, Time[index_0], 0);
            ObjectSet(name_80, OBJPROP_BACK, TRUE);
            ObjectSet(name_80, OBJPROP_TIME1, Time[index_0]);
            ObjectSet(name_80, OBJPROP_COLOR, Green);
            ObjectSet(name_80, OBJPROP_STYLE, STYLE_DOT);
         }
         if (Gda_380[index_0 + 1] > Gda_384[index_0 + 1] && Gda_380[index_0] < Gda_384[index_0]) {
            ObjectCreate(name_88, OBJ_VLINE, 0, Time[index_0], 0);
            ObjectSet(name_88, OBJPROP_BACK, TRUE);
            ObjectSet(name_88, OBJPROP_TIME1, Time[index_0]);
            ObjectSet(name_88, OBJPROP_COLOR, Maroon);
            ObjectSet(name_88, OBJPROP_STYLE, STYLE_DOT);
         }
      }
   }
   if (show_correlations) {
      Ld_96 = f0_5(G_ibuf_348, G_ibuf_352, G_str2int_224);
      Ld_104 = f0_5(G_ibuf_348, G_ibuf_356, G_str2int_224);
      Ld_112 = f0_5(G_ibuf_348, G_ibuf_360, G_str2int_224);
      Ld_120 = f0_5(G_ibuf_348, G_ibuf_364, G_str2int_224);
      Ld_128 = f0_5(G_ibuf_348, G_ibuf_368, G_str2int_224);
      Ld_136 = f0_5(G_ibuf_348, G_ibuf_372, G_str2int_224);
      Ld_144 = f0_5(G_ibuf_348, G_ibuf_376, G_str2int_224);
      Ld_152 = f0_5(G_ibuf_352, G_ibuf_356, G_str2int_224);
      Ld_160 = f0_5(G_ibuf_352, G_ibuf_360, G_str2int_224);
      Ld_168 = f0_5(G_ibuf_352, G_ibuf_364, G_str2int_224);
      Ld_176 = f0_5(G_ibuf_352, G_ibuf_368, G_str2int_224);
      Ld_184 = f0_5(G_ibuf_352, G_ibuf_372, G_str2int_224);
      Ld_192 = f0_5(G_ibuf_352, G_ibuf_376, G_str2int_224);
      Ld_200 = f0_5(G_ibuf_356, G_ibuf_360, G_str2int_224);
      Ld_208 = f0_5(G_ibuf_356, G_ibuf_364, G_str2int_224);
      Ld_216 = f0_5(G_ibuf_356, G_ibuf_368, G_str2int_224);
      Ld_224 = f0_5(G_ibuf_356, G_ibuf_372, G_str2int_224);
      Ld_232 = f0_5(G_ibuf_356, G_ibuf_376, G_str2int_224);
      Ld_240 = f0_5(G_ibuf_360, G_ibuf_364, G_str2int_224);
      Ld_248 = f0_5(G_ibuf_360, G_ibuf_368, G_str2int_224);
      Ld_256 = f0_5(G_ibuf_360, G_ibuf_372, G_str2int_224);
      Ld_264 = f0_5(G_ibuf_360, G_ibuf_376, G_str2int_224);
      Ld_272 = f0_5(G_ibuf_364, G_ibuf_368, G_str2int_224);
      Ld_280 = f0_5(G_ibuf_364, G_ibuf_372, G_str2int_224);
      Ld_288 = f0_5(G_ibuf_364, G_ibuf_376, G_str2int_224);
      Ld_296 = f0_5(G_ibuf_368, G_ibuf_372, G_str2int_224);
      Ld_304 = f0_5(G_ibuf_368, G_ibuf_376, G_str2int_224);
      Ld_312 = f0_5(G_ibuf_372, G_ibuf_376, G_str2int_224);
      Ls_320 = Ls_320 + "AUD/CAD: " + DoubleToStr(Ld_96, 0);
      Ls_320 = Ls_320 + "   AUD/CHF: " + DoubleToStr(Ld_104, 0);
      Ls_320 = Ls_320 + "   AUD/EUR: " + DoubleToStr(Ld_112, 0);
      Ls_320 = Ls_320 + "   AUD/GBP: " + DoubleToStr(Ld_120, 0);
      Ls_320 = Ls_320 + "   AUD/JPY: " + DoubleToStr(Ld_128, 0);
      Ls_320 = Ls_320 + "   AUD/NZD: " + DoubleToStr(Ld_136, 0);
      Ls_320 = Ls_320 + "   AUD/USD: " + DoubleToStr(Ld_144, 0);
      Ls_320 = Ls_320 
      + "\nCAD/AUD: " + DoubleToStr(Ld_96, 0);
      Ls_320 = Ls_320 + "   CAD/CHF: " + DoubleToStr(Ld_152, 0);
      Ls_320 = Ls_320 + "   CAD/EUR: " + DoubleToStr(Ld_160, 0);
      Ls_320 = Ls_320 + "   CAD/GBP: " + DoubleToStr(Ld_168, 0);
      Ls_320 = Ls_320 + "   CAD/JPY: " + DoubleToStr(Ld_176, 0);
      Ls_320 = Ls_320 + "   CAD/NZD: " + DoubleToStr(Ld_184, 0);
      Ls_320 = Ls_320 + "   CAD/USD: " + DoubleToStr(Ld_192, 0);
      Ls_320 = Ls_320 
      + "\nCHF/AUD: " + DoubleToStr(Ld_104, 0);
      Ls_320 = Ls_320 + "   CHF/CAD: " + DoubleToStr(Ld_152, 0);
      Ls_320 = Ls_320 + "   CHF/EUR: " + DoubleToStr(Ld_200, 0);
      Ls_320 = Ls_320 + "   CHF/GBP: " + DoubleToStr(Ld_208, 0);
      Ls_320 = Ls_320 + "   CHF/JPY: " + DoubleToStr(Ld_216, 0);
      Ls_320 = Ls_320 + "   CHF/NZD: " + DoubleToStr(Ld_224, 0);
      Ls_320 = Ls_320 + "   CHF/USD: " + DoubleToStr(Ld_232, 0);
      Ls_320 = Ls_320 
      + "\nEUR/AUD: " + DoubleToStr(Ld_112, 0);
      Ls_320 = Ls_320 + "   EUR/CAD: " + DoubleToStr(Ld_160, 0);
      Ls_320 = Ls_320 + "   EUR/CHF: " + DoubleToStr(Ld_200, 0);
      Ls_320 = Ls_320 + "   EUR/GBP: " + DoubleToStr(Ld_240, 0);
      Ls_320 = Ls_320 + "   EUR/JPY: " + DoubleToStr(Ld_248, 0);
      Ls_320 = Ls_320 + "   EUR/NZD: " + DoubleToStr(Ld_256, 0);
      Ls_320 = Ls_320 + "   EUR/USD: " + DoubleToStr(Ld_264, 0);
      Ls_320 = Ls_320 
      + "\nGBP/AUD: " + DoubleToStr(Ld_120, 0);
      Ls_320 = Ls_320 + "   GBP/CAD: " + DoubleToStr(Ld_168, 0);
      Ls_320 = Ls_320 + "   GBP/CHF: " + DoubleToStr(Ld_208, 0);
      Ls_320 = Ls_320 + "   GBP/EUR: " + DoubleToStr(Ld_240, 0);
      Ls_320 = Ls_320 + "   GBP/JPY: " + DoubleToStr(Ld_272, 0);
      Ls_320 = Ls_320 + "   GBP/NZD: " + DoubleToStr(Ld_280, 0);
      Ls_320 = Ls_320 + "   GBP/USD: " + DoubleToStr(Ld_288, 0);
      Ls_320 = Ls_320 
      + "\nJPY/AUD: " + DoubleToStr(Ld_128, 0);
      Ls_320 = Ls_320 + "   JPY/CAD: " + DoubleToStr(Ld_176, 0);
      Ls_320 = Ls_320 + "   JPY/CHF: " + DoubleToStr(Ld_216, 0);
      Ls_320 = Ls_320 + "   JPY/EUR: " + DoubleToStr(Ld_248, 0);
      Ls_320 = Ls_320 + "   JPY/GBP: " + DoubleToStr(Ld_272, 0);
      Ls_320 = Ls_320 + "   JPY/NZD: " + DoubleToStr(Ld_296, 0);
      Ls_320 = Ls_320 + "   JPY/USD: " + DoubleToStr(Ld_304, 0);
      Ls_320 = Ls_320 
      + "\nNZD/AUD: " + DoubleToStr(Ld_136, 0);
      Ls_320 = Ls_320 + "   NZD/CAD: " + DoubleToStr(Ld_184, 0);
      Ls_320 = Ls_320 + "   NZD/CHF: " + DoubleToStr(Ld_224, 0);
      Ls_320 = Ls_320 + "   NZD/EUR: " + DoubleToStr(Ld_256, 0);
      Ls_320 = Ls_320 + "   NZD/GBP: " + DoubleToStr(Ld_280, 0);
      Ls_320 = Ls_320 + "   NZD/JPY: " + DoubleToStr(Ld_296, 0);
      Ls_320 = Ls_320 + "   NZD/USD: " + DoubleToStr(Ld_312, 0);
      Ls_320 = Ls_320 
      + "\nUSD/AUD: " + DoubleToStr(Ld_144, 0);
      Ls_320 = Ls_320 + "   USD/CAD: " + DoubleToStr(Ld_192, 0);
      Ls_320 = Ls_320 + "   USD/CHF: " + DoubleToStr(Ld_232, 0);
      Ls_320 = Ls_320 + "   USD/EUR: " + DoubleToStr(Ld_264, 0);
      Ls_320 = Ls_320 + "   USD/GBP: " + DoubleToStr(Ld_288, 0);
      Ls_320 = Ls_320 + "   USD/JPY: " + DoubleToStr(Ld_304, 0);
      Ls_320 = Ls_320 + "   USD/NZD: " + DoubleToStr(Ld_312, 0);
      Comment(Ls_320);
   }
   return (0);
}

// 93400DC344D31D62D24D5CEFE516D523
double f0_16(string A_symbol_0, int A_timeframe_8, int A_period_12, double Ad_16, int A_shift_24) {
   double ibands_28 = iBands(A_symbol_0, A_timeframe_8, A_period_12, Ad_16, 0, PRICE_CLOSE, MODE_UPPER, A_shift_24);
   double ibands_36 = iBands(A_symbol_0, A_timeframe_8, A_period_12, Ad_16, 0, PRICE_CLOSE, MODE_LOWER, A_shift_24);
   double Ld_44 = ibands_28 - ibands_36;
   if (Ld_44 == 0.0) return (0);
   double Ld_52 = (iClose(A_symbol_0, A_timeframe_8, A_shift_24) - ibands_36) / Ld_44;
   return (100.0 * Ld_52);
}

// 12E1976D0BC8C1AEA8CF9F2653CF1FF2
double f0_0(string As_0, int A_period_8, int Ai_12) {
   double Ld_16;
   int Li_24;
   double Ld_28;
   for (int index_36 = 0; index_36 < Gi_412; index_36++) {
      Ld_28 = 0.0001;
      if (StringSubstr(Gsa_404[index_36], 3, 3) == "JPY") Ld_28 = 0.01;
      if (StringSubstr(Gsa_404[index_36], 0, 3) == As_0) {
         if (algo == 1) Ld_16 = f0_15(Ld_16, iRSI(Gsa_404[index_36], 0, A_period_8, PRICE_CLOSE, Ai_12));
         if (algo == 2) Ld_16 = f0_15(Ld_16, iWPR(Gsa_404[index_36], 0, A_period_8, Ai_12) + 100.0);
         if (algo == 3) Ld_16 = f0_15(Ld_16, iStochastic(Gsa_404[index_36], 0, A_period_8, 3, 3, MODE_SMA, 0, MODE_MAIN, Ai_12));
         if (algo == 4) Ld_16 = f0_15(Ld_16, f0_16(Gsa_404[index_36], 0, A_period_8, 2, Ai_12));
         if (algo == 5) Ld_16 = f0_15(Ld_16, iMACD(Gsa_404[index_36], 0, G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_28);
         if (algo == 6) {
            Ld_16 = f0_18(Ld_16, iMACD(Gsa_404[index_36], 0, G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_MAIN, Ai_12) / Ld_28, (-iMACD(Gsa_404[index_36], 0,
               G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_SIGNAL, Ai_12)) / Ld_28);
         }
         Li_24++;
      }
      if (StringSubstr(Gsa_404[index_36], 3, 3) == As_0) {
         if (algo == 1) Ld_16 = f0_18(Ld_16, 100, -iRSI(Gsa_404[index_36], 0, A_period_8, PRICE_CLOSE, Ai_12));
         if (algo == 2) Ld_16 = f0_18(Ld_16, 100, -(iWPR(Gsa_404[index_36], 0, A_period_8, Ai_12) + 100.0));
         if (algo == 3) Ld_16 = f0_18(Ld_16, 100, -iStochastic(Gsa_404[index_36], 0, A_period_8, 3, 3, MODE_SMA, 0, MODE_MAIN, Ai_12));
         if (algo == 4) Ld_16 = f0_18(Ld_16, 100, -f0_16(Gsa_404[index_36], 0, A_period_8, 2, Ai_12));
         if (algo == 5) Ld_16 = f0_15(Ld_16, (-iMACD(Gsa_404[index_36], 0, G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_SIGNAL, Ai_12)) / Ld_28);
         if (algo == 6) {
            Ld_16 = f0_18(Ld_16, iMACD(Gsa_404[index_36], 0, G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_28, (-iMACD(Gsa_404[index_36],
               0, G_str2int_228, G_str2int_232, G_period_236, PRICE_CLOSE, MODE_MAIN, Ai_12)) / Ld_28);
         }
         Li_24++;
      }
   }
   return (f0_12(Ld_16, Li_24));
}

// 3AD312362DE2D7AF9D21F6211605A64F
double f0_5(double Ada_0[], double Ada_4[], int Ai_8) {
   double Ld_12;
   double Ld_20;
   double Ld_28;
   double Ld_36;
   double Ld_44;
   double Ld_52;
   for (int index_60 = 0; index_60 < Ai_8; index_60++) {
      Ld_20 = f0_15(Ld_20, Ada_0[index_60]);
      Ld_28 = f0_15(Ld_28, Ada_4[index_60]);
      Ld_36 = f0_15(Ld_36, f0_17(Ada_0[index_60], Ada_4[index_60]));
      Ld_44 = f0_15(Ld_44, f0_17(Ada_0[index_60], Ada_0[index_60]));
      Ld_52 = f0_15(Ld_52, f0_17(Ada_4[index_60], Ada_4[index_60]));
   }
   double Ld_64 = Ai_8 * Ld_36 - Ld_20 * Ld_28;
   double Ld_72 = MathSqrt((Ai_8 * Ld_44 - MathPow(Ld_20, 2)) * (Ai_8 * Ld_52 - MathPow(Ld_28, 2)));
   if (Ld_72 != 0.0) Ld_12 = Ld_64 / Ld_72;
   return (f0_17(Ld_12, 100));
}