#property copyright "Copyright © 2014, Andrea Salvatore"
#property link      "http://www.pimpmyea.com"

//#include <stdlib.mqh>
#import "stdlib.ex4"
   string ErrorDescription(int a0); // DA69CBAFF4D38B87377667EEC549DE5A
#import

string Gsa_76[12];
int Gia_80[12];
string Gsa_108[100];
int Gia_112[100];
int Gi_116 = 0;
int Gi_120 = 2000;
int Gi_124 = 60000;
int Gi_128 = 0;
int Gi_132 = 0;
int Gi_136 = 0;
bool Gi_140 = FALSE;
bool Gi_144 = FALSE;
bool Gi_148 = TRUE;
int G_color_152 = Blue;
int G_color_156 = Red;
bool Gi_160 = FALSE;
int G_datetime_164 = 0;
int G_datetime_168 = 0;
bool Gi_172 = FALSE;
double Gd_176 = 0.0;
int Gi_184 = 86400;

int Gi_212 = 1;
bool Gi_224 = FALSE;
int Gi_228 = 0;
int G_count_232 = 0;
string Gs_236;
int Gia_244[1];
//string Gs_252 = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
//int Gia_260[64] = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
int Gia_unused_264[1];
int G_datetime_272;
int G_datetime_276;
bool Gi_280;
color G_color_284 = Blue;
int Gi_unused_288 = 16711935;
int Gi_unused_292 = 8421504;
int Gi_unused_296 = 0;
int Gi_unused_300 = 1;
int Gi_unused_304 = 1;
int Gi_unused_308 = 1;
bool Gi_unused_312 = TRUE;
extern string e_mail = "";
extern string note1 = "STRATEGY SETTINGS";
extern string BUY_enabled = "true";
extern string SELL_enabled = "true";
bool Gi_348 = TRUE;
bool Gi_352 = TRUE;
double Gd_356 = 0.0;
double Gd_364 = 0.0;
double Gd_372 = 0.0;
double Gd_380 = 0.0;
extern string note1a = "0 - Each Tick; 1 - M1; 5 - M5; etc.";
extern int trading_timeframe = 1;
extern int order_step = 10;
extern double growing_order_step = 0.25;
extern int atr_period_step = 24;
extern int atr_timeframe_step = 60;
extern double atr_multiplier_step = 1.0;
bool Gi_428 = FALSE;
extern double target_profit = 1.0;
extern int atr_period_tp = 24;
extern int atr_timeframe_tp = 60;
extern double atr_multiplier_tp = 1.0;
bool Gi_456 = FALSE;
extern int trend_threshold = 1;
extern string note2 = "POWERBARSFX SETTINGS";
extern int pb_algo = 2;
extern string pb_timeframes = "1;5;15;30;60";
int Gia_484[5];
int Gia_488[5];
extern int pb_autotimeframe = 3;
extern int pb_bar = 1;
int Gi_500 = 15;
extern string additional_entries_thresholds = "3";
string Gsa_512[];
int Gia_516[];
int G_arr_size_520 = 0;
extern int max_open_orders = 12;
extern string note3 = "MONEY MANAGEMENT";
extern double lot_size = 0.01;
extern bool balanced_lot_size = TRUE;
extern double drawdown_threshold = 0.0;
extern bool halt_after_max_dd = TRUE;
bool Gi_560 = FALSE;
extern int slippage = 5;
extern string note4 = "MARTINGALE SETTINGS";
extern string note4a = "0 - None; 1 - Lin; 2 - Exp";
extern int martingale = 2;
bool Gi_588 = FALSE;
bool Gi_592 = FALSE;
extern double exponential_factor = 1.5;
extern string note5 = "EA SETTINGS";
extern int Magic_Number = 22052014;
string G_str_concat_616;
int G_str_len_624;
extern string comment = "FortissimoFX";
extern int EA_interface = 1;
bool Gi_640 = FALSE;
bool Gi_644 = FALSE;
extern bool restore_trades_from_file = FALSE;
extern bool debug_print = FALSE;
int G_digits_656;
double Gd_660;
double Gd_unused_668;
double Gd_732;
double Gd_740;
string Gs_dummy_748;
double Gd_756;
double Gd_772;
double G_global_var_780;
string G_str_concat_788;
string Gs_796;
string G_str_concat_804;
int Gi_812;
double G_point_816 = 0.0;
double Gd_824 = 1.0;
string Gs_832;
int Gi_840 = 0;
int Gi_844;
int Gi_848;
double Gd_852;
double Gd_860;
double Gd_868 = 0.0;
double Gd_876 = 0.0;
int Gi_884 = 0;
int Gi_888 = 0;
int Gi_892 = 0;
int Gi_896 = 0;
string Gs_900;
string Gs_908;
string Gs_916;
string Gs_924;
string Gs_932;
string Gsa_940[64];
int G_index_944;
int Gia_948[5];
int Gia_952[5];
int Gia_956[5];
int Gia_960[5];
int Gia_964[5];
int Gia_968[5];
int Gia_972[5];
int Gia_976[5];
string Gs_980 = "";
string Gs_988 = "";
int Gi_996 = 0;
int G_datetime_1000;

// DD3DB597DF009D42822D6E053AFA76B8
void f0_83(int Ai_0) {
   Gi_148 = Ai_0;
}

// 890E0EC4DD2253F2CDC4F67B8D9E1BCA
void f0_48() {
   if (Gi_144 == FALSE) {
      for (int index_0 = 0; index_0 < 12; index_0++) {
         Gsa_76[index_0] = "";
         Gia_80[index_0] = 0;
      }
      for (index_0 = 0; index_0 < 100; index_0++) {
         Gsa_108[index_0] = "";
         Gia_112[index_0] = 0;
      }
      Gi_144 = TRUE;
   }
}

// CA90F199FAD943ECA9B31C7C06A2D1FB
void f0_74(string As_0, string As_8 = "", string As_16 = "", string As_24 = "", string As_32 = "", string As_40 = "", string As_48 = "", string As_56 = "", string As_64 = "", string As_72 = "", string As_80 = "", string As_88 = "", string As_96 = "", string As_104 = "", string As_112 = "", string As_120 = "", string As_128 = "", string As_136 = "", string As_144 = "", string As_152 = "", string As_160 = "", string As_168 = "", string As_176 = "", string As_184 = "", string As_192 = "", string As_200 = "", string As_208 = "", string As_216 = "", string As_224 = "", string As_232 = "", string As_240 = "", string As_248 = "", string As_256 = "", string As_264 = "", string As_272 = "", string As_280 = "", string As_288 = "", string As_296 = "", string As_304 = "", string As_312 = "", string As_320 = "", string As_328 = "", string As_336 = "", string As_344 = "", string As_352 = "", string As_360 = "", string As_368 = "", string As_376 = "", string As_384 = "", string As_392 = "", string As_400 = "", string As_408 = "", string As_416 = "", string As_424 = "", string As_432 = "", string As_440 = "", string As_448 = "", string As_456 = "", string As_464 = "", string As_472 = "", string As_480 = "", string As_488 = "") {
   int Li_496;
   string Ls_500;
   int Li_508;
   bool bool_512;
   int Li_516;
   bool bool_520;
   if (Gi_148 != FALSE) {
      f0_48();
      Li_496 = GetTickCount();
      if (Gi_140) Gi_132++;
      Ls_500 = As_0 + As_8 + As_16 + As_24 + As_32 + As_40 + As_48 + As_56 + As_64 + As_72 + As_80 + As_88 + As_96 + As_104 + As_112 + As_120 + As_128 + As_136 + As_144 +
         As_152 + As_160 + As_168 + As_176 + As_184 + As_192 + As_200 + As_208 + As_216 + As_224 + As_232 + As_240 + As_248 + As_256 + As_264 + As_272 + As_280 + As_288 + As_296 +
         As_304 + As_312 + As_320 + As_328 + As_336 + As_344 + As_352 + As_360 + As_368 + As_376 + As_384 + As_392 + As_400 + As_408 + As_416 + As_424 + As_432 + As_440 + As_448 +
         As_456 + As_464 + As_472 + As_480 + As_488;
      Li_508 = f0_31(Ls_500);
      bool_512 = Li_508 == -1 || Li_496 >= Li_508 + Gi_120;
      Li_516 = f0_19();
      bool_520 = Li_516 == 0 || Li_496 >= Li_516 + Gi_124;
      if (bool_512 == FALSE && Li_496 >= Gi_128) {
         Gi_128 = Li_496 + Gi_120;
         if (Gi_140) Print("########## Filter1: UPDATED SP_time_next = ", TimeToStr(Gi_128 / 1000, TIME_SECONDS), "; counter = ", Gi_132);
      }
      if (bool_520 == FALSE && Li_496 >= Gi_128) {
         Gi_128 = Li_496 + Gi_124;
         if (Gi_140) Print("########## Filter2: UPDATED SP_time_next = ", TimeToStr(Gi_128 / 1000, TIME_SECONDS), "; counter = ", Gi_132);
      }
      if (Li_496 >= Gi_128) {
         if (Gi_140) {
            Gi_136++;
            Print("SP_time_now = ", TimeToStr(Li_496 / 1000, TIME_SECONDS), "; SP_time_next = ", TimeToStr(Gi_128 / 1000, TIME_SECONDS), "; counter = ", Gi_132, "; counter2 = ",
               Gi_136);
         }
         Gi_116 = (Gi_116 + 1) % 100;
         Gsa_108[Gi_116] = Ls_500;
         Gia_112[Gi_116] = Li_496;
         Print(Ls_500);
      }
   }
}

// 57ED0000B9C8B25915AEA86CEFE80A52
int f0_31(string As_0) {
   int Li_12;
   int Li_ret_8 = -1;
   for (int count_16 = 0; count_16 < 100; count_16++) {
      Li_12 = (Gi_116 + 100 - count_16) % 100;
      if (As_0 == Gsa_108[Li_12]) return (Gia_112[Li_12]);
   }
   return (Li_ret_8);
}

// 42B02693A1A7707B7E33810EB75E1ECD
int f0_19() {
   return (Gia_112[(Gi_116 + 1) % 100]);
}

// CC7BCB519C24D9B518E44B9452589DB0
int f0_76(string A_symbol_0, int A_cmd_8, double A_lots_12, double A_price_20, int A_slippage_28, double Ad_32, double Ad_40, string A_comment_48 = "", int A_magic_56 = 0, int A_datetime_60 = 0, color A_color_64 = -1) {
   int ticket_68;
   int error_72;
   f0_74("orderSendReliable(" + A_symbol_0 + "," + f0_40(A_cmd_8) + "," + f0_89(A_lots_12, 2) + "," + f0_89(A_price_20, 5) + "," + f0_40(A_slippage_28) + "," + f0_89(Ad_32,
      5) + "," + f0_89(Ad_40, 5) + "," + A_comment_48 + "," + f0_40(A_magic_56) + "," + f0_10(A_datetime_60) + "," + f0_40(A_color_64) + ")");
   while (true) {
      if (IsStopped()) {
         f0_74("orderSendReliable(): Trading is stopped!");
         return (-1);
      }
      RefreshRates();
      if (A_cmd_8 == OP_BUY) A_price_20 = Ask;
      if (A_cmd_8 == OP_SELL) A_price_20 = Bid;
      if (!IsTradeContextBusy()) {
         ticket_68 = OrderSend(A_symbol_0, A_cmd_8, A_lots_12, NormalizeDouble(A_price_20, MarketInfo(A_symbol_0, MODE_DIGITS)), A_slippage_28, NormalizeDouble(Ad_32, MarketInfo(A_symbol_0,
            MODE_DIGITS)), NormalizeDouble(Ad_40, MarketInfo(A_symbol_0, MODE_DIGITS)), A_comment_48, A_magic_56, A_datetime_60, A_color_64);
         if (ticket_68 > 0) {
            f0_74("orderSendReliable(): Success! Ticket: " + f0_40(ticket_68));
            return (ticket_68);
         }
         error_72 = GetLastError();
         if (f0_67(error_72)) f0_74("orderSendReliable(): Temporary Error: " + f0_40(error_72) + " " + ErrorDescription(error_72) + ". waiting.");
         else {
            f0_74("orderSendReliable(): Permanent Error: " + f0_40(error_72) + " " + ErrorDescription(error_72) + ". giving up.");
            return (-1);
         }
      } else f0_74("orderSendReliable(): Must wait for trade context");
      Sleep(MathRand() / 10);
   }
   return /*(WARN)*/;
}

// 7F9D690F5900BF2302A8515E54A2A5E6
int f0_43(int A_ticket_0, double A_lots_4, double A_price_12, int A_slippage_20, color A_color_24 = -1) {
   bool is_closed_28;
   int error_32;
   string Ls_36 = "orderCloseReliable(" + f0_40(A_ticket_0) + "; " + DoubleToStr(A_lots_4, 2) + ")";
   f0_74(Ls_36);
   if (OrderSelect(A_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) {
      while (true) {
         if (IsStopped()) {
            f0_74(Ls_36 + ": Trading is stopped!");
            return (0);
         }
         RefreshRates();
         if (OrderType() == OP_BUY) A_price_12 = Bid;
         if (OrderType() == OP_SELL) A_price_12 = Ask;
         if (!IsTradeContextBusy()) {
            is_closed_28 = OrderClose(A_ticket_0, A_lots_4, NormalizeDouble(A_price_12, MarketInfo(OrderSymbol(), MODE_DIGITS)), A_slippage_20, A_color_24);
            if (is_closed_28) {
               f0_74(Ls_36 + ": Success!");
               return (1);
            }
            error_32 = GetLastError();
            if (f0_67(error_32)) f0_74(Ls_36 + ": Temporary Error: " + f0_40(error_32) + " " + ErrorDescription(error_32) + ". waiting.");
            else {
               f0_74(Ls_36 + ": Permanent Error: " + f0_40(error_32) + " " + ErrorDescription(error_32) + ". giving up.");
               return (0);
            }
         } else f0_74(Ls_36 + ": Must wait for trade context");
         Sleep(MathRand() / 10);
      }
   }
   return (0);
}

// 6D102BFA4D0541C929A10570A4C4302C
int f0_33(int A_ticket_0) {
   int error_8;
   bool is_deleted_4 = FALSE;
   f0_74("orderDeleteReliable(" + f0_40(A_ticket_0) + ")");
   while (true) {
      while (IsTradeContextBusy()) {
         f0_74("OrderDeleteReliable(" + f0_40(A_ticket_0) + "): Waiting for trade context.");
         Sleep(MathRand() / 10);
      }
      is_deleted_4 = OrderDelete(A_ticket_0);
      if (is_deleted_4) {
         f0_74("orderDeleteReliable(" + f0_40(A_ticket_0) + "): success.");
         return (1);
      }
      error_8 = GetLastError();
      if (f0_67(error_8)) f0_74("orderDeleteReliable(" + f0_40(A_ticket_0) + "): Temporary Error: " + f0_40(error_8) + " " + ErrorDescription(error_8) + ". waiting.");
      else {
         f0_74("orderDeleteReliable(" + f0_40(A_ticket_0) + "): Permanent Error: " + f0_40(error_8) + " " + ErrorDescription(error_8) + ". giving up.");
         return (0);
      }
      Sleep(MathRand() / 10);
   }
   return /*(WARN)*/;
}

// B805B6CC986BBED9EDB59296A5C8F329
int f0_67(int Ai_0) {
   return (Ai_0 == 0 || Ai_0 == 2 || Ai_0 == 4 || Ai_0 == 6 || Ai_0 == 132 || Ai_0 == 135 || Ai_0 == 129 || Ai_0 == 136 || Ai_0 == 137 || Ai_0 == 138 || Ai_0 == 128 ||
      Ai_0 == 146);
}

// 7CC746F1237FA4F35D032E6834289CBE
string f0_40(int Ai_0) {
   return (DoubleToStr(Ai_0, 0));
}

// EC44391640BA424907048CBE6150B7FF
string f0_89(double Ad_0, int Ai_8) {
   return (DoubleToStr(Ad_0, Ai_8));
}

// 3EFE3596697FC244CFD7AF3CEB960A74
int f0_18(string As_0) {
   return (StrToInteger(As_0));
}

// 49E2A229066D9192B62FBBFE22B62CF4
double f0_22(string As_0) {
   return (StrToDouble(As_0));
}

// 1F3272F63CFFE4358AB8E05967359FED
string f0_10(int Ai_0) {
   return (TimeToStr(Ai_0));
}

// DBC53651ED5164E55A83349D2C249A4C
double f0_81(string A_symbol_0, int A_magic_8) {
   double Ld_ret_12 = 0;
   int order_total_24 = OrdersTotal();
   for (int pos_20 = 0; pos_20 < order_total_24; pos_20++) {
      if (OrderSelect(pos_20, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderMagicNumber() == A_magic_8 || OrderComment() == DoubleToStr(A_magic_8, 0) && OrderSymbol() == A_symbol_0) {
            if (OrderType() == OP_BUY) Ld_ret_12 += OrderLots();
            if (OrderType() == OP_SELL) Ld_ret_12 -= OrderLots();
         }
      }
   }
   return (Ld_ret_12);
}

// 4A6ABD64D2481AE3539300FFEA9B2A7C
void f0_23(string As_0, int Ai_8, int Ai_12) {
   int order_total_24;
   double price_28;
   int color_36;
   int cmd_40;
   int Lia_52[];
   int ticket_60;
   int count_16 = 0;
   int Li_20 = 10000;
   string Ls_44 = "closeOpenOrdersBySymbol(" + f0_40(Ai_8) + "," + f0_40(Ai_12) + ")";
   f0_74(Ls_44);
   while (f0_59(As_0, Ai_8, Ai_12) > 0) {
      count_16++;
      if (count_16 == Li_20) {
         count_16 = 0;
         f0_74(Ls_44, ": LOOP_COUNTER(", f0_40(Li_20), ")");
      }
      while (IsTradeContextBusy()) {
         f0_74(Ls_44, ": waiting for trade context.");
         Sleep(MathRand() / 10);
      }
      order_total_24 = OrdersTotal();
      RefreshRates();
      if (Ai_8 == 0) {
         price_28 = Bid;
         color_36 = G_color_156;
      } else {
         price_28 = Ask;
         color_36 = G_color_152;
      }
      f0_62(Lia_52, As_0, Ai_8, Ai_12);
      for (int index_56 = 0; index_56 < ArraySize(Lia_52); index_56++) {
         ticket_60 = Lia_52[index_56];
         f0_74(Ls_44, ": is now dealing with ticket ", f0_40(ticket_60));
         if (OrderSelect(ticket_60, SELECT_BY_TICKET)) {
            f0_74(Ls_44, ": OrderSelect(", f0_40(ticket_60), ") was successful");
            if (IsTradeContextBusy()) break;
            cmd_40 = OrderType();
            if (cmd_40 == OP_BUYSTOP || cmd_40 == OP_SELLSTOP || cmd_40 == OP_BUYLIMIT || cmd_40 == OP_SELLLIMIT) {
               f0_33(ticket_60);
               break;
            }
            f0_43(ticket_60, OrderLots(), price_28, 999, color_36);
            break;
         }
         f0_74(Ls_44, ": OrderSelect(", f0_40(ticket_60), ") FAILED");
      }
   }
}

// 105AC455BDA77E61CCC6AB05A8558636
double f0_5(string As_0, int Ai_8, double Ad_12, int Ai_20) {
   int Lia_56[];
   int ticket_60;
   string Ls_64;
   double price_28 = 0.0;
   bool Li_36 = FALSE;
   int color_36;
   double Ld_ret_40 = NormalizeDouble(Ad_12, 2);
   string Ls_48 = "reducePositionBySymbol(" + f0_40(Ai_8) + "," + DoubleToStr(Ld_ret_40, 2) + "," + f0_40(Ai_20) + ")";
   f0_74(Ls_48);
   RefreshRates();
   if (Ai_8 == 0) {
      price_28 = Bid;
      color_36 = G_color_156;
   }
   if (Ai_8 == 1) {
      price_28 = Ask;
      color_36 = G_color_152;
   }
   f0_62(Lia_56, As_0, Ai_8, Ai_20);
   for (int index_24 = 0; index_24 < ArraySize(Lia_56); index_24++) {
      ticket_60 = Lia_56[index_24];
      Ls_64 = f0_40(ticket_60);
      f0_74(Ls_48 + ": is now dealing with ticket ", Ls_64);
      if (OrderSelect(ticket_60, SELECT_BY_TICKET)) {
         f0_74(Ls_48 + ": OrderSelect(", Ls_64, ") was successful");
         if (NormalizeDouble(OrderLots() - Ld_ret_40, 2) >= 0.0) {
            f0_74(Ls_48 + ": now trying to partially close order ", Ls_64);
            if (f0_43(ticket_60, Ld_ret_40, price_28, 100, color_36) == 1) {
               f0_74(Ls_48 + ": success! ", Ls_64, " was partially closed");
               return (0);
            }
            f0_74(Ls_48 + ": order ", Ls_64, " found but failed to partially close: " + f0_40(GetLastError()));
            return (Ld_ret_40);
         }
         f0_74(Ls_48 + ": now trying to completely close order ", Ls_64);
         if (f0_43(ticket_60, OrderLots(), price_28, 100, color_36) == 1) {
            Ld_ret_40 = NormalizeDouble(Ld_ret_40 - OrderLots(), 2);
            f0_74(Ls_48 + ": order ", Ls_64, " completely closed. " + DoubleToStr(OrderLots(), 2) + " Remaining lots to close: " + DoubleToStr(Ld_ret_40, 2));
         } else {
            f0_74(Ls_48 + ": order ", Ls_64, " found but failed to completely close: " + f0_40(GetLastError()));
            return (Ld_ret_40);
         }
         if (NormalizeDouble(Ld_ret_40, 2) != 0.0) continue;
         return (0);
      } else f0_74(Ls_48 + ": OrderSelect(", Ls_64, ") FAILED");
   }
   f0_74(Ls_48 + ": nothing more to close. " + DoubleToStr(Ld_ret_40, 2) + " could not be closed");
   return (Ld_ret_40);
}

// B3231C25F5F411DBA987D224D9961439
void f0_62(int &Aia_0[], string A_symbol_4, int A_cmd_12, int A_magic_16) {
   int Lia_44[];
   int order_total_48;
   bool Li_56;
   bool Li_60;
   int count_20 = 0;
   int Li_24 = 10000;
   string Ls_28 = "sort_tickets_by_FIFO()";
   bool Li_36 = TRUE;
   int Li_40 = 0;
   while (Li_36) {
      count_20++;
      if (count_20 == Li_24) {
         count_20 = 0;
         f0_74(Ls_28, ": LOOP_COUNTER(", f0_40(Li_24), ")");
      }
      Li_36 = FALSE;
      Li_40 = 0;
      order_total_48 = OrdersTotal();
      ArrayResize(Aia_0, order_total_48);
      ArrayResize(Lia_44, order_total_48);
      for (int pos_52 = 0; pos_52 < order_total_48; pos_52++) {
         if (OrderSelect(pos_52, SELECT_BY_POS, MODE_TRADES)) {
            if (A_cmd_12 == -1 || OrderType() == A_cmd_12 && A_magic_16 == -1 || OrderMagicNumber() == A_magic_16 && OrderSymbol() == A_symbol_4) {
               Aia_0[Li_40] = OrderTicket();
               Lia_44[Li_40] = f0_15(OrderTicket(), OrderComment());
               Li_40++;
            }
         } else {
            Li_36 = TRUE;
            break;
         }
      }
   }
   ArrayResize(Aia_0, Li_40);
   ArrayResize(Lia_44, Li_40);
   if (Li_40 > 0) {
      Li_56 = FALSE;
      Li_60 = FALSE;
      while (Li_60 == FALSE) {
         Li_60 = TRUE;
         for (pos_52 = 0; pos_52 < Li_40 - 1; pos_52++) {
            if (Lia_44[pos_52 + 1] < Lia_44[pos_52]) {
               Li_60 = FALSE;
               Li_56 = Lia_44[pos_52 + 1];
               Lia_44[pos_52 + 1] = Lia_44[pos_52];
               Lia_44[pos_52] = Li_56;
               Li_56 = Aia_0[pos_52 + 1];
               Aia_0[pos_52 + 1] = Aia_0[pos_52];
               Aia_0[pos_52] = Li_56;
            }
         }
      }
   }
}

// 3215BE76D763479BFB6665DD5C9D978F
int f0_15(int Ai_0, string As_4) {
   int str2int_28;
   if (StringFind(As_4, "from #") != 0) return (Ai_0);
   string Ls_12 = StringSubstr(As_4, 6);
   int str2int_20 = StrToInteger(Ls_12);
   while (true) {
      for (int Li_24 = TRUE; Li_24; str2int_20 = str2int_28) {
         Li_24 = FALSE;
         str2int_28 = f0_88(str2int_20);
         if (str2int_28 == str2int_20) return (str2int_28);
         Li_24 = TRUE;
         if (str2int_28 == -1) continue;
      }
      break;
   }
   return (str2int_20);
}

// E934F6AE09AAEAD003E44DDC4ADB563B
int f0_88(int Ai_0) {
   int hist_total_4 = OrdersHistoryTotal();
   for (int pos_8 = 0; pos_8 < hist_total_4; pos_8++) {
      if (OrderSelect(pos_8, SELECT_BY_POS, MODE_HISTORY) == FALSE) return (-1);
      if (OrderComment() == StringConcatenate("to #", Ai_0)) return (OrderTicket());
   }
   return (Ai_0);
}

// B60C2A8A3952AD867507CD47A1554271
void f0_66(double Ad_0, double Ad_8, int Ai_16, int Ai_20, string As_24) {
   double Ld_32 = NormalizeDouble(Ad_0, 2);
   double Ld_40 = NormalizeDouble(Ad_8, 2);
   double Ld_48 = NormalizeDouble(MathAbs(Ld_32 - Ld_40), 2);
   if (Ld_48 != 0.0) {
      if (Ld_32 == 0.0) {
         if (Ld_40 > 0.0) f0_23(Symbol(), 0, Ai_20);
         if (Ld_40 < 0.0) f0_23(Symbol(), 1, Ai_20);
      }
      if (Ld_32 < 0.0) {
         if (Ld_40 == 0.0) f0_76(Symbol(), OP_SELL, -Ld_32, Bid, Ai_16, 0, 0, As_24, Ai_20, 0, Red);
         if (Ld_40 > 0.0) {
            f0_23(Symbol(), 0, Ai_20);
            f0_76(Symbol(), OP_SELL, -Ld_32, Bid, Ai_16, 0, 0, As_24, Ai_20, 0, Red);
         }
         if (Ld_40 < 0.0) {
            if (Ld_40 < Ld_32) f0_5(Symbol(), 1, Ld_48, Ai_20);
            if (Ld_40 > Ld_32) f0_76(Symbol(), OP_SELL, Ld_48, Bid, Ai_16, 0, 0, As_24 + " - ScaleIN", Ai_20, 0, Red);
         }
      }
      if (Ld_32 > 0.0) {
         if (Ld_40 == 0.0) f0_76(Symbol(), OP_BUY, Ld_32, Ask, Ai_16, 0, 0, As_24, Ai_20, 0, Blue);
         if (Ld_40 > 0.0) {
            if (Ld_40 > Ld_32) f0_5(Symbol(), 0, Ld_48, Ai_20);
            if (Ld_40 < Ld_32) f0_76(Symbol(), OP_BUY, Ld_48, Ask, Ai_16, 0, 0, As_24 + " - ScaleIN", Ai_20, 0, Blue);
         }
         if (Ld_40 < 0.0) {
            f0_23(Symbol(), 1, Ai_20);
            f0_76(Symbol(), OP_BUY, Ld_32, Ask, Ai_16, 0, 0, As_24, Ai_20, 0, Blue);
         }
      }
   }
}

// AEDD1EC29E6ACAEB04C2F9AB35B0521B
int f0_59(string A_symbol_0, int A_cmd_8, int A_magic_12) {
   int count_16 = 0;
   int order_total_20 = OrdersTotal();
   for (int pos_24 = 0; pos_24 < order_total_20; pos_24++) {
      if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES))
         if (A_symbol_0 == OrderSymbol() && A_magic_12 == -1 || OrderMagicNumber() == A_magic_12 && A_cmd_8 == -1 || OrderType() == A_cmd_8) count_16++;
   }
   return (count_16);
}


// 3346294235049C7D247C9D4E85FE4ACB
string f0_16(string As_0) {
   int Li_8;
   for (int Li_12 = 0; Li_12 < StringLen(As_0); Li_12++) {
      Li_8 = StringGetChar(As_0, Li_12);
      if (Li_8 >= 'A' && Li_8 <= 'Z') As_0 = StringSetChar(As_0, Li_12, Li_8 + 32);
   }
   return (As_0);
}

// C55F233C1991A7FA05479098FC827EEC
int f0_71(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);
}

// 54DCAF81D765EE239998DC5F1EF9A9FF
void f0_28(double Ad_0, string As_8 = "update.html") {
   Gd_176 = Ad_0;
}

// 4DCAF58A1A6FD3555D9626CFADC42510
int f0_27(string As_0, string As_8, string As_16, int Ai_24) {
   return (true);
}

// B213B93F78E4323640FE5DDC9938C595
void f0_61() {
   G_datetime_164 = 0;
}

// 1BE3363A6C51DBFCAF00C14BD68BA143
int f0_8(int A_timeframe_0) {
   if (G_datetime_272 == iTime(NULL, A_timeframe_0, 0)) return (0);
   G_datetime_272 = iTime(NULL, A_timeframe_0, 0);
   return (1);
}

// 987D40F3BC43D39ECB3E3CBFF050EFBE
int f0_54() {
   int timeframe_0 = 1440;
   if (G_datetime_276 == iTime(NULL, timeframe_0, 0)) return (0);
   G_datetime_276 = iTime(NULL, timeframe_0, 0);
   return (1);
}

// 4489E3F07583E6F5FAB55D727C362633
string f0_21(string As_0) {
   string Ls_12;
   int Li_8 = GlobalVariablesTotal();
   for (int count_20 = 0; count_20 < Li_8; count_20++) {
      Ls_12 = GlobalVariableName(count_20);
      if (StringSubstr(Ls_12, 0, StringLen(As_0)) == As_0) return (StringSubstr(Ls_12, StringLen(As_0) + 1));
   }
   return ("");
}

// 177C653C7C3F361FAC147C335BB2089E
int f0_7(string As_0) {
   if (IsDllsAllowed()) return (1);
   Alert("DLL calls are not allowed. ", As_0, " cannot run.");
   return (0);
}

// CAE27D017EC9939EFFED36168A2580CB
int f0_75(string As_0, double Ad_8) {
   if (Ad_8 < MarketInfo(Symbol(), MODE_MINLOT)) {
      Alert("Lot size smaller than Minimum permitted amount. ", As_0, " cannot run.");
      return (0);
   }
   if (Ad_8 > MarketInfo(Symbol(), MODE_MAXLOT)) {
      Alert("Lot size bigger than Maximum permitted amount. ", As_0, " cannot run.");
      return (0);
   }
   return (1);
}

// 7195C0F5C047318C482B4EF93E99D9FB
int f0_37() {
   return (IsDllsAllowed());
}

// 2055D2274C1FBBB1455DC560A00DDD22
int f0_12(double Ad_0) {
   if (Ad_0 < MarketInfo(Symbol(), MODE_MINLOT)) return (0);
   if (Ad_0 > MarketInfo(Symbol(), MODE_MAXLOT)) return (0);
   return (1);
}

// FB56FB9B26E7037590B59FC139F9CA3D
void f0_95() {
   if (f0_7("FortissimoFX") != 0) {
      if (f0_75("FortissimoFX", lot_size) != 0) {
         if (IsTesting() == FALSE) {
            G_str_concat_804 = StringConcatenate("v", DoubleToStr(1.02, 2));
            f0_28(1.02);
            f0_61();
            Gs_796 = e_mail;
            if (StringLen(Gs_796) == 0) Gs_796 = f0_21("AUTH_FORTISSIMOFX");
            if (StringLen(Gs_796) == 0) Gs_796 = f0_21("AUTH_PIMPMYEA");
            if (f0_27(Gs_796, "http://www.pimpmyea.com/auth/", "FortissimoFX", 1) == 0) return;
         }
         GlobalVariableSet(StringConcatenate("AUTH_FORTISSIMOFX", "=", Gs_796), 0.0);
         f0_9();
      }
   }
}

// 1C86E8D4535299BB79FDC73CA04439CC
void f0_9() {
   string Lsa_4[];
   HideTestIndicators(TRUE);
   int index_0 = 0;
   G_str_concat_616 = StringConcatenate("fortissimofx_trade_", Symbol(), "_", f0_40(Magic_Number), "_");
   G_str_len_624 = StringLen(G_str_concat_616);
   Gi_280 = TRUE;
   G_digits_656 = Digits;
   if (G_digits_656 == 3 || G_digits_656 == 5) {
      Gd_660 = 10.0 * Point;
      Gd_unused_668 = 10;
   } else {
      Gd_660 = Point;
      Gd_unused_668 = 1;
   }
   G_point_816 = Point;
   if (G_point_816 == 0.00001) G_point_816 = 0.0001;
   if (G_point_816 == 0.001) G_point_816 = 0.01;
   if (f0_71(pb_timeframes, ";", Lsa_4, 5)) {
      Gia_484[0] = f0_18(Lsa_4[0]);
      Gia_484[1] = f0_18(Lsa_4[1]);
      Gia_484[2] = f0_18(Lsa_4[2]);
      Gia_484[3] = f0_18(Lsa_4[3]);
      Gia_484[4] = f0_18(Lsa_4[4]);
   } else {
      Gia_484[0] = 1;
      Gia_484[1] = 5;
      Gia_484[2] = 15;
      Gia_484[3] = 30;
      Gia_484[4] = 60;
      Alert("ERROR in PowerbarsFX timeframes. Default values selected.");
   }
   for (index_0 = 0; index_0 < 5; index_0++) {
      Gia_488[index_0] = Gia_484[index_0];
      Print("pb_timeframe[", index_0, "] = ", f0_40(Gia_484[index_0]));
   }
   ObjectsDeleteAll();
   f0_70(Magic_Number);
   f0_55(Magic_Number);
   MathSrand(GetTickCount());
   switch (martingale) {
   case 0:
      Gi_588 = FALSE;
      Gi_592 = FALSE;
      break;
   case 1:
      Gi_588 = TRUE;
      Gi_592 = FALSE;
      break;
   case 2:
      Gi_588 = FALSE;
      Gi_592 = TRUE;
   }
   G_str_concat_788 = StringConcatenate("fortissimofx_", Symbol(), "_", DoubleToStr(Magic_Number, 0));
   if (GlobalVariableCheck(G_str_concat_788)) G_global_var_780 = GlobalVariableGet(G_str_concat_788);
   else {
      GlobalVariableSet(G_str_concat_788, 0.0);
      G_global_var_780 = 0.0;
   }
   Gi_812 = 15;
   if (atr_period_step > 0 && atr_multiplier_step > 0.0) Gi_428 = TRUE;
   if (atr_period_tp > 0 && atr_multiplier_tp > 0.0) Gi_456 = TRUE;
   Gs_832 = StringSubstr(Symbol(), 6, 0);
   Gd_824 = f0_42();
   Print("atr_currency_factor = ", Gd_824);
   f0_52();
   Gd_852 = lot_size;
   Gd_860 = lot_size;
   Gs_900 = f0_92(Gia_484);
   Gi_892 = f0_73(0);
   Gi_896 = f0_73(1);
   if (pb_autotimeframe > 0) {
      Gi_844 = f0_45(Gi_892);
      Gs_908 = f0_92(Gia_488);
      Gi_848 = f0_45(Gi_896);
      Gs_916 = f0_92(Gia_488);
   }
   if (growing_order_step > 0.0) Gs_980 = "  (must grow " + f0_89(100.0 * growing_order_step, 1) + "%)";
   f0_71(additional_entries_thresholds, ";", Gsa_512);
   G_arr_size_520 = ArraySize(Gsa_512);
   ArrayResize(Gia_516, G_arr_size_520);
   Print("trend_threshold = ", trend_threshold);
   for (index_0 = 0; index_0 < G_arr_size_520; index_0++) {
      if (f0_16(Gsa_512[index_0]) == "n") {
         Gia_516[index_0] = 777;
         Print("additional_thresholds[", index_0 + 1, "] = INACTIVE");
      } else {
         Gia_516[index_0] = f0_18(Gsa_512[index_0]);
         Print("additional_thresholds[", index_0 + 1, "] = ", Gia_516[index_0]);
      }
   }
   if (restore_trades_from_file) {
      f0_1();
      f0_96();
   } else f0_63();
   Gi_640 = FALSE;
   Gi_644 = FALSE;
   if (EA_interface == 1) Gi_640 = TRUE;
   if (EA_interface == 2) Gi_644 = TRUE;
   if (EA_interface == 3) {
      Gi_640 = TRUE;
      Gi_644 = TRUE;
   }
   if (f0_16(BUY_enabled) == "false") Gi_348 = FALSE;
   if (f0_16(BUY_enabled) == "f") Gi_348 = FALSE;
   if (f0_16(SELL_enabled) == "false") Gi_352 = FALSE;
   if (f0_16(SELL_enabled) == "f") Gi_352 = FALSE;
   if (f0_16(BUY_enabled) == "true") Gi_348 = TRUE;
   if (f0_16(BUY_enabled) == "t") Gi_348 = TRUE;
   if (f0_16(SELL_enabled) == "true") Gi_352 = TRUE;
   if (f0_16(SELL_enabled) == "t") Gi_352 = TRUE;
   if (StringSubstr(BUY_enabled, 0, 1) == ">") {
      Gi_348 = FALSE;
      Gd_356 = f0_22(StringSubstr(BUY_enabled, 1));
      if (Gd_356 > 0.0) Print("BUY enabled when Ask price > ", DoubleToStr(Gd_356, Digits));
   }
   if (StringSubstr(BUY_enabled, 0, 1) == "<") {
      Gi_348 = FALSE;
      Gd_364 = f0_22(StringSubstr(BUY_enabled, 1));
      if (Gd_364 > 0.0) Print("BUY enabled when Ask price < ", DoubleToStr(Gd_364, Digits));
   }
   if (StringSubstr(SELL_enabled, 0, 1) == ">") {
      Gi_352 = FALSE;
      Gd_372 = f0_22(StringSubstr(SELL_enabled, 1));
      if (Gd_372 > 0.0) Print("SELL enabled when Bid price > ", DoubleToStr(Gd_372, Digits));
   }
   if (StringSubstr(SELL_enabled, 0, 1) == "<") {
      Gi_352 = FALSE;
      Gd_380 = f0_22(StringSubstr(SELL_enabled, 1));
      if (Gd_380 > 0.0) Print("SELL enabled when Bid price < ", DoubleToStr(Gd_380, Digits));
   }
   f0_26(1);
   Gi_172 = TRUE;
}

// F136145029F44199B7EC1D72D8331EA2
string f0_92(int Aia_0[5]) {
   string str_concat_4 = "(";
   for (int index_12 = 0; index_12 < ArraySize(Aia_0); index_12++) str_concat_4 = StringConcatenate(str_concat_4, f0_40(Aia_0[index_12]), "-");
   return (StringSetChar(str_concat_4, StringLen(str_concat_4) - 1, ')'));
}

// 05F010F00E74535B568A7D86E850DC7E
void f0_4(int Ai_unused_0) {
   Comment("");
   f0_49();
   f0_63();
   int Li_4 = 20;
   for (int count_8 = 0; count_8 < 10; count_8++) {
      for (int count_12 = 0; count_12 < Li_4; count_12++) {
         ObjectDelete("fortissimofx_background_" + f0_40(count_8) + f0_40(count_12));
         ObjectDelete("fortissimofx_background_" + f0_40(count_8) + f0_40(count_12 + 1));
         ObjectDelete("fortissimofx_background_" + f0_40(count_8) + f0_40(count_12 + 2));
      }
   }
   ObjectDelete("fortissimofx_breakeven_buy");
   ObjectDelete("fortissimofx_breakeven_sell");
   f0_64();
}

// B5EB84484B4A5EC707DAE9EC7C0BE103
void f0_65() {
   if (f0_37() != 0) {
      if (f0_12(lot_size) != 0) {
         if (Gi_172 == FALSE) f0_9();
         if (IsTesting() == FALSE)
            if (f0_27(Gs_796, "http://www.pimpmyea.com/auth/", "FortissimoFX", 1) == 0) return;
         if (Gi_560 == FALSE) f0_78();
      }
   }
}

// 780898A2D72D18E0F6951B76741147B7
void f0_39() {
   f0_0();
}

// CE950C824EB925C8055E76804B523700
void f0_78() {
   double Ld_4;
   double Ld_12;
   f0_83(debug_print);
   if (Gd_356 > 0.0 && Ask > Gd_356) Gi_348 = TRUE;
   if (Gd_364 > 0.0 && Ask < Gd_364) Gi_348 = TRUE;
   if (Gd_372 > 0.0 && Bid > Gd_372) Gi_352 = TRUE;
   if (Gd_380 > 0.0 && Bid < Gd_380) Gi_352 = TRUE;
   bool Li_0 = FALSE;
   if (trading_timeframe == 0) Li_0 = TRUE;
   else Li_0 = f0_8(trading_timeframe);
   if (Li_0) {
      Gi_840 = f0_45(0);
      if (growing_order_step > 0.0) {
         Gd_868 = f0_69(0) * (growing_order_step + 1.0);
         Gd_876 = f0_69(1) * (growing_order_step + 1.0);
      }
   }
   Gd_756 = f0_32(Magic_Number);
   Gd_732 = f0_29(0);
   if (Gd_732 >= f0_14(0)) f0_35(0);
   if (Li_0 == TRUE) {
      Gi_884 = f0_87(0);
      Gi_892 = f0_73(0);
      if (Gi_884 == 0) {
         Gd_852 = NormalizeDouble(MathMax(lot_size, f0_68(1)), 2);
         Gi_844 = Gi_840;
      }
      if (Gi_884 > 0) {
         Gd_852 = NormalizeDouble(MathMax(f0_25(0, Gi_884), f0_68(1)), 2);
         if (pb_autotimeframe > 0) {
            Gi_844 = f0_45(Gi_892);
            Gs_908 = f0_92(Gia_488);
         }
      }
      if (Gi_884 > 0 && f0_24(0, Gi_844, Gi_884) == 1) {
         Ld_4 = f0_57(0);
         if (Ld_4 >= f0_38() && Ld_4 >= Gd_868) f0_3(Gd_852);
      }
      if (Gi_884 == 0 && Gi_348)
         if (Gi_844 >= trend_threshold) f0_3(Gd_852);
   }
   Gd_756 = f0_32(Magic_Number);
   Gd_740 = f0_29(1);
   if (Gd_740 >= f0_14(1)) f0_35(1);
   if (Li_0 == TRUE) {
      Gi_888 = f0_87(1);
      Gi_896 = f0_73(1);
      if (Gi_888 == 0) {
         Gd_860 = NormalizeDouble(MathMax(lot_size, f0_68(0)), 2);
         Gi_848 = Gi_840;
      }
      if (Gi_888 > 0) {
         Gd_860 = NormalizeDouble(MathMax(f0_25(1, Gi_888), f0_68(0)), 2);
         if (pb_autotimeframe > 0) {
            Gi_848 = f0_45(Gi_896);
            Gs_916 = f0_92(Gia_488);
         }
      }
      if (Gi_888 > 0 && f0_24(1, Gi_848, Gi_888) == 1) {
         Ld_12 = f0_57(1);
         if (Ld_12 >= f0_38() && Ld_12 >= Gd_876) f0_46(Gd_860);
      }
      if (Gi_888 == 0 && Gi_352)
         if (Gi_848 <= -1 * trend_threshold) f0_46(Gd_860);
   }
   Gd_756 = f0_32(Magic_Number);
   Gd_772 = f0_94(Magic_Number);
   if (Gd_772 < G_global_var_780 - 0.1) {
      G_global_var_780 = Gd_772;
      GlobalVariableSet(G_str_concat_788, G_global_var_780);
      Print("---> Max Floating DD: ", DoubleToStr(G_global_var_780, 2));
   }
   if (drawdown_threshold > 0.0 && G_global_var_780 < (-1.0 * drawdown_threshold)) {
      f0_35(0);
      f0_35(1);
      G_global_var_780 = 0.0;
      GlobalVariableSet(G_str_concat_788, 0.0);
      if (halt_after_max_dd) Gi_560 = TRUE;
   }
   f0_96();
   if (f0_82()) f0_63();
   if (f0_54()) f0_63(f0_72());
}

// B9F13762FA94D5D14D1E027A0DED2E58
double f0_68(int Ai_0) {
   if (balanced_lot_size == FALSE) return (lot_size);
   if (Gi_592 == FALSE) return (lot_size);
   double Ld_4 = f0_47(Ai_0);
   if (Ld_4 == 0.0) return (lot_size);
   double Ld_12 = 0.97;
   return (NormalizeDouble(MathPow(Ld_12 * exponential_factor, MathLog(100.0 * Ld_4) / 2.0 / MathLog(exponential_factor)) / 100.0, 2));
}

// C8062CA1203413778378EA0D0D3A25E3
int f0_73(int Ai_0) {
   if (balanced_lot_size == FALSE) return (f0_87(Ai_0));
   if (Gi_592 == FALSE) return (f0_87(Ai_0));
   double Ld_4 = f0_47(Ai_0);
   double Ld_12 = 1.07;
   return (MathRound(MathLog((exponential_factor - 1.0) * Ld_4 / lot_size + 1.0) / MathLog(exponential_factor * Ld_12)));
}

// 4B7B6D1AFDC5522B326877D7F71C5560
double f0_25(int Ai_0, int Ai_4) {
   double Ld_ret_8 = f0_91(Ai_0);
   double Ld_16 = lot_size;
   if (Gi_588 == TRUE) return (Ld_16 * (Ai_4 + 1));
   if (Gi_592 == TRUE) return (Ld_ret_8 * exponential_factor);
   return (Ld_ret_8);
}

// 779CDFA8F27E8043CE096ED51A370C03
double f0_38() {
   double Ld_0;
   if (Gi_428) {
      Ld_0 = iATR(NULL, atr_timeframe_step, atr_period_step, 1) / G_point_816;
      return (atr_multiplier_step * Ld_0);
   }
   return (order_step);
}

// 3199629FE133210D6124B123A059B7E7
double f0_14(int Ai_0) {
   double Ld_4;
   double Ld_12;
   double Ld_20;
   if (Gi_456) {
      Ld_4 = iATR(NULL, atr_timeframe_tp, atr_period_tp, 1) / G_point_816;
      Gd_824 = f0_42();
      Ld_12 = MathAbs(f0_50(Ai_0));
      Ld_20 = Ld_4 * Gd_824 * Ld_12 / 0.1;
      return (Ld_20 * atr_multiplier_tp);
   }
   return (target_profit);
}

// 7E0F8B2680CECF9776E53E1B3E3C29B5
double f0_42() {
   if (AccountCurrency() == "USD") return (1.0);
   if (AccountCurrency() == "EUR") return (1.0 / MarketInfo("EURUSD" + Gs_832, MODE_BID));
   if (AccountCurrency() == "GBP") return (1.0 / MarketInfo("GBPUSD" + Gs_832, MODE_BID));
   if (AccountCurrency() == "CHF") return (MarketInfo("USDCHF" + Gs_832, MODE_BID));
   if (AccountCurrency() == "JPY") return (MarketInfo("USDJPY" + Gs_832, MODE_BID));
   return (1.0);
}

// 0021B962A6B2F5C54E9D820A33FBD187
void f0_0() {
   string Ls_0;
   double Ld_8;
   double Ld_16;
   string Ls_24;
   if (Gi_640) {
      Ls_0 = "==========================\n";
      Ls_0 = Ls_0 + "               " + "FortissimoFX" + " " + G_str_concat_804 
      + "\n";
      Ls_0 = Ls_0 + "              www.pimpmyea.com\n";
      Ls_0 = Ls_0 + "==========================\n";
      Gs_988 = Gs_988 + "|";
      if (StringLen(Gs_988) >= 20) Gs_988 = "";
      Ld_8 = f0_2(0);
      Ld_16 = f0_2(1);
      Ls_24 = "RUNNING";
      if (Gi_560) Ls_0 = Ls_0 + "  Status: HALTED AFTER MAX DD\n";
      else {
         Ls_0 = Ls_0 + "  Status: " + Ls_24 + " " + Gs_988 
         + "\n";
      }
      Ls_0 = Ls_0 + "==========================\n";
      Ls_0 = Ls_0 + "  Closed Orders Profit: $ " + DoubleToStr(Gd_756, 2) 
      + "\n";
      Ls_0 = Ls_0 + "  MAX Floating DD: $ " + DoubleToStr(G_global_var_780, 2) 
      + "\n";
      Ls_0 = Ls_0 + "==========================\n";
      Ls_0 = Ls_0 + "  Order Step: " + f0_89(f0_38(), 1) + " pips" + Gs_980 
      + "\n";
      if (growing_order_step > 0.0) {
         Ls_0 = Ls_0 + "  Trades Delta: BUY " + DoubleToStr(Gd_868, 1) + " SELL " + DoubleToStr(Gd_876, 1) 
         + "\n";
      }
      Ls_0 = Ls_0 + "  BUY VIRTUAL Orders: " + f0_40(f0_87(0)) + " (" + DoubleToStr(f0_47(0), 2) + " lots)\n";
      Ls_0 = Ls_0 + "  SELL VIRTUAL Orders: " + f0_40(f0_87(1)) + " (" + DoubleToStr(f0_47(1), 2) + " lots)\n";
      Ls_0 = Ls_0 + "  BUY Target: $ " + DoubleToStr(f0_14(0), 2) 
      + "\n";
      Ls_0 = Ls_0 + "  SELL Target: $ " + DoubleToStr(f0_14(1), 2) 
      + "\n";
      Ls_0 = Ls_0 + "  BUY VIRTUAL Orders Value: $ " + DoubleToStr(f0_29(0), 2) 
      + "\n";
      Ls_0 = Ls_0 + "  SELL VIRTUAL Orders Value: $ " + DoubleToStr(f0_29(1), 2) 
      + "\n";
      Ls_0 = Ls_0 + "  OPEN Orders Value: $ " + DoubleToStr(Gd_772, 2) 
      + "\n";
      Ls_0 = Ls_0 + "  BUY Breakeven Level @ " + DoubleToStr(Ld_8, Digits) 
      + "\n";
      Ls_0 = Ls_0 + "  SELL Breakeven Level @ " + DoubleToStr(Ld_16, Digits) 
      + "\n";
      Ls_0 = Ls_0 + "==========================\n";
      Ls_0 = Ls_0 + "  Base Lot Size: " + DoubleToStr(lot_size, 2) + " lots\n";
      Ls_0 = Ls_0 + "  Next Lot Size: BUY " + DoubleToStr(Gd_852, 2) + " SELL " + DoubleToStr(Gd_860, 2) 
      + "\n";
      Ls_0 = Ls_0 + "  Slippage: " + DoubleToStr(slippage, 2) + " pips\n";
      Ls_0 = Ls_0 + "==========================\n";
      Ls_0 = Ls_0 + "  Trend Score " + Gs_900 + ": " + f0_40(Gi_840) 
      + "\n";
      Ls_0 = Ls_0 + "  TS BUY " + Gs_908 + ": " + f0_40(Gi_844) 
      + "\n";
      Ls_0 = Ls_0 + "  TS SELL " + Gs_916 + ": " + f0_40(Gi_848) 
      + "\n";
      Ls_0 = Ls_0 + "==========================\n";
      Comment(Ls_0);
      f0_85("fortissimofx_breakeven_buy", Ld_8, Green, "Breakeven Line");
      f0_85("fortissimofx_breakeven_sell", Ld_16, Red, "Breakeven Line");
      if (Gi_280 || Seconds() % 5 == 0) {
         Gi_280 = FALSE;
         for (int count_32 = 0; count_32 < 9; count_32++) {
            for (int count_36 = 0; count_36 < Gi_812; count_36++) {
               ObjectDelete("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36));
               ObjectDelete("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36 + 1));
               ObjectDelete("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36 + 2));
               ObjectCreate("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36), OBJ_LABEL, 0, 0, 0);
               ObjectSetText("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36), "n", 30, "Wingdings", G_color_284);
               ObjectSet("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36), OBJPROP_XDISTANCE, 20 * count_32);
               ObjectSet("fortissimofx_background_" + f0_40(count_32) + f0_40(count_36), OBJPROP_YDISTANCE, 23 * count_36 + 9);
            }
         }
      }
   }
}

// A74EC9C5B6882F79E32A8FBD8DA90C1B
double f0_57(int Ai_0) {
   double Ld_4 = 0.0;
   double Ld_12 = f0_79(Ai_0);
   if (Ai_0 == 0) Ld_4 = Ld_12 - Ask;
   if (Ai_0 == 1) Ld_4 = Bid - Ld_12;
   return (Ld_4 / G_point_816);
}

// D8FEA3407981FF751CA0FC579801B40E
void f0_80(int A_ticket_0, bool Ai_4 = FALSE) {
   string name_8;
   string name_16;
   color color_24 = Black;
   if (IsOptimization() == FALSE) {
      if (OrderSelect(A_ticket_0, SELECT_BY_TICKET)) {
         name_8 = "#" + f0_40(A_ticket_0) + " ";
         if (OrderType() == OP_BUY) {
            name_8 = name_8 + "buy ";
            color_24 = G_color_152;
         }
         if (OrderType() == OP_SELL) {
            name_8 = name_8 + "sell ";
            color_24 = G_color_156;
         }
         name_8 = name_8 + DoubleToStr(OrderLots(), 2) + " ";
         name_8 = name_8 + OrderSymbol() + " ";
         name_16 = name_8 + "at " + DoubleToStr(0, MarketInfo(OrderSymbol(), MODE_DIGITS));
         name_8 = name_8 + "at " + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
         ObjectDelete(name_16);
         if (Ai_4) ObjectDelete(name_8);
         else {
            ObjectCreate(name_8, OBJ_ARROW, 0, OrderOpenTime(), OrderOpenPrice());
            ObjectSet(name_8, OBJPROP_ARROWCODE, 1);
            ObjectSet(name_8, OBJPROP_COLOR, color_24);
            ObjectSetText(name_8, f0_53());
         }
      }
   }
}

// 7184D350C10FD03A5EA9A6F9FE260B51
void f0_36(int A_ticket_0, bool Ai_4 = FALSE) {
   string name_8;
   color color_16 = Black;
   if (IsOptimization() == FALSE) {
      if (OrderSelect(A_ticket_0, SELECT_BY_TICKET)) {
         name_8 = "#" + f0_40(A_ticket_0) + " ";
         if (OrderType() == OP_BUY) {
            name_8 = name_8 + "buy ";
            color_16 = G_color_156;
         }
         if (OrderType() == OP_SELL) {
            name_8 = name_8 + "sell ";
            color_16 = G_color_152;
         }
         name_8 = name_8 + DoubleToStr(OrderLots(), 2) + " ";
         name_8 = name_8 + OrderSymbol() + " ";
         name_8 = name_8 + "at " + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS)) + " ";
         name_8 = name_8 + "close at " + DoubleToStr(OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
         if (Ai_4) ObjectDelete(name_8);
         else {
            ObjectCreate(name_8, OBJ_ARROW, 0, OrderCloseTime(), OrderClosePrice());
            ObjectSet(name_8, OBJPROP_ARROWCODE, 3);
            ObjectSet(name_8, OBJPROP_COLOR, color_16);
            ObjectSetText(name_8, f0_53());
         }
      }
   }
}

// CE14D506C080AB1D52085A688876BC5E
void f0_77(int A_ticket_0, bool Ai_4 = FALSE) {
   string name_8;
   color color_16 = Black;
   if (IsOptimization() == FALSE) {
      if (OrderSelect(A_ticket_0, SELECT_BY_TICKET)) {
         name_8 = "#" + f0_40(A_ticket_0) + " ";
         if (OrderType() == OP_BUY) color_16 = G_color_152;
         if (OrderType() == OP_SELL) color_16 = G_color_156;
         name_8 = name_8 + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
         name_8 = name_8 + " -> ";
         name_8 = name_8 + DoubleToStr(OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
         if (Ai_4) ObjectDelete(name_8);
         else {
            ObjectCreate(name_8, OBJ_TREND, 0, OrderOpenTime(), OrderOpenPrice(), OrderCloseTime(), OrderClosePrice());
            ObjectSet(name_8, OBJPROP_RAY, FALSE);
            ObjectSet(name_8, OBJPROP_STYLE, STYLE_DOT);
            ObjectSet(name_8, OBJPROP_COLOR, color_16);
         }
      }
   }
}

// 93A1C623BB3214962B5C79ACEE70A34C
string f0_53() {
   return (StringConcatenate(OrderComment(), " (", OrderMagicNumber(), ")\nP/L: ", DoubleToStr(OrderProfit() + OrderSwap() + OrderCommission(), 2), " ", AccountCurrency(),
      " (", DoubleToStr(MathAbs(OrderOpenPrice() - OrderClosePrice()) / (MarketInfo(OrderSymbol(), MODE_POINT) * f0_13()), 2), " pips)"));
}

// C42242D658B592FC9BDFE2B8657E70C3
void f0_70(int A_magic_0 = -1) {
   int order_total_4;
   string dbl2str_12;
   if (IsTesting() == FALSE) {
      dbl2str_12 = DoubleToStr(A_magic_0, 0);
      order_total_4 = OrdersTotal();
      for (int pos_8 = 0; pos_8 < order_total_4; pos_8++) {
         if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) {
            if (A_magic_0 == -1 || OrderMagicNumber() == A_magic_0 || OrderComment() == dbl2str_12 && OrderSymbol() == Symbol())
               if (OrderType() == OP_BUY || OrderType() == OP_SELL) f0_80(OrderTicket());
         }
      }
   }
}

// 9B1118EAB82AD58B0F5BDB2CD2BA6065
void f0_55(int A_magic_0 = -1) {
   bool bool_4;
   int Li_8;
   int datetime_12;
   bool Li_16;
   int hist_total_20;
   string dbl2str_28;
   if (IsTesting() == FALSE) {
      bool_4 = GlobalVariableCheck("ARROW_MAX_AGE");
      Li_8 = 60.0 * (60.0 * (24.0 * GlobalVariableGet("ARROW_MAX_AGE")));
      datetime_12 = TimeCurrent();
      dbl2str_28 = DoubleToStr(A_magic_0, 0);
      hist_total_20 = OrdersHistoryTotal();
      if (OrderSelect(hist_total_20 - 1, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderTicket() + Li_8 + bool_4 != Gi_996) {
            Gi_996 = OrderTicket() + Li_8 + bool_4;
            for (int pos_24 = 0; pos_24 < hist_total_20; pos_24++) {
               if (OrderSelect(pos_24, SELECT_BY_POS, MODE_HISTORY)) {
                  if (A_magic_0 == -1 || OrderMagicNumber() == A_magic_0 || OrderComment() == dbl2str_28 && OrderSymbol() == Symbol()) {
                     if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
                        if (bool_4 && datetime_12 - OrderCloseTime() > Li_8) Li_16 = TRUE;
                        else Li_16 = FALSE;
                        f0_80(OrderTicket(), Li_16);
                        f0_36(OrderTicket(), Li_16);
                        f0_77(OrderTicket(), Li_16);
                     }
                  }
               }
            }
         }
      }
   }
}

// E17F10504B516B2F05B14321D7FFFCBB
string f0_85(string A_name_0, double A_price_8, color A_color_16 = 255, string A_text_20 = "", bool Ai_28 = FALSE) {
   if (!IsOptimization()) {
      if (A_name_0 == "") A_name_0 = "fortissimofx_" + f0_40(Time[0]);
      if (ObjectFind(A_name_0) == -1) ObjectCreate(A_name_0, OBJ_HLINE, 0, 0, A_price_8);
      else ObjectSet(A_name_0, OBJPROP_PRICE1, A_price_8);
      ObjectSet(A_name_0, OBJPROP_COLOR, A_color_16);
      ObjectSetText(A_name_0, A_text_20);
      if (Ai_28) ObjectSet(A_name_0, OBJPROP_STYLE, STYLE_DASH);
   }
   return (A_name_0);
}

// 2530EB32B3849A2C59B6ED2041F8602C
double f0_13() {
   int digits_4;
   string Ls_16;
   double Ld_ret_8 = 1;
   int file_24 = FileOpenHistory("symbols.raw", FILE_BIN|FILE_READ);
   int Li_28 = FileSize(file_24) / 1936;
   for (int count_0 = 0; count_0 < Li_28; count_0++) {
      Ls_16 = FileReadString(file_24, 12);
      if (StringFind(Ls_16, "EURUSD") != -1) {
         digits_4 = MarketInfo(Ls_16, MODE_DIGITS);
         if (digits_4 == 4) {
            Ld_ret_8 = 1;
            break;
         }
         Ld_ret_8 = 10;
         break;
      }
      FileSeek(file_24, 1924, SEEK_CUR);
   }
   FileClose(file_24);
   return (Ld_ret_8);
}

// 934D4EC36EFC3210D6D6C6C5F474D688
void f0_52() {
   string Lsa_8[8];
   string str_concat_12;
   f0_58(Gia_484, Gia_948, Gia_952, Gia_956, Gia_960);
   Gs_924 = StringSubstr(Symbol(), 0, 3);
   Gs_932 = StringSubstr(Symbol(), 3, 3);
   string str_concat_0 = StringConcatenate(Gs_924, Gs_932);
   Lsa_8[0] = "AUD";
   Lsa_8[1] = "CAD";
   Lsa_8[2] = "CHF";
   Lsa_8[3] = "EUR";
   Lsa_8[4] = "GBP";
   Lsa_8[5] = "JPY";
   Lsa_8[6] = "NZD";
   Lsa_8[7] = "USD";
   G_index_944 = 0;
   for (int index_20 = 0; index_20 < 8; index_20++) {
      for (int index_24 = 0; index_24 < 8; index_24++) {
         if (index_20 != index_24) {
            str_concat_12 = StringConcatenate(Lsa_8[index_20], Lsa_8[index_24], Gs_832);
            if (MarketInfo(str_concat_12, MODE_TRADEALLOWED) == 1.0) {
               Gsa_940[G_index_944] = str_concat_12;
               G_index_944++;
            }
         }
      }
   }
}

// 80DB8CF7D5C0C3A193B746F34FF5EB0F
int f0_45(int Ai_0) {
   int Li_ret_4 = 0;
   double Ld_8 = f0_30(pb_bar, Ai_0);
   Li_ret_4 = MathRound(Ld_8 / Gi_500);
   if (Li_ret_4 > 5) Li_ret_4 = 5;
   if (Li_ret_4 < -5) Li_ret_4 = -5;
   return (Li_ret_4);
}

// 5750CCF4CA37665B8AF26B91A2B45957
double f0_30(int Ai_0, int Ai_4) {
   double Ld_8 = 0.0;
   int shift_16 = 0;
   double Ld_20 = 0.0;
   double Ld_28 = 0.0;
   double Ld_36 = 0.0;
   int index_44 = 0;
   if (Ai_4 == 0 || pb_autotimeframe == 0) {
      for (index_44 = 0; index_44 < 5; index_44++) {
         shift_16 = iBarShift(Symbol(), Gia_484[index_44], Time[Ai_0]);
         Ld_20 = f0_6(Gs_924, index_44, shift_16, Gia_484, Gia_948, Gia_952, Gia_956, Gia_960);
         Ld_28 = f0_6(Gs_932, index_44, shift_16, Gia_484, Gia_948, Gia_952, Gia_956, Gia_960);
         Ld_36 = Ld_20 - Ld_28;
         Ld_8 += Ld_36;
      }
      return (Ld_8 / 5.0);
   }
   if (Ai_4 > 0 && pb_autotimeframe > 0) {
      f0_44(Ai_4);
      f0_58(Gia_488, Gia_964, Gia_968, Gia_972, Gia_976);
      for (index_44 = 0; index_44 < 5; index_44++) {
         shift_16 = iBarShift(Symbol(), Gia_488[index_44], Time[Ai_0]);
         Ld_20 = f0_6(Gs_924, index_44, shift_16, Gia_488, Gia_964, Gia_968, Gia_972, Gia_976);
         Ld_28 = f0_6(Gs_932, index_44, shift_16, Gia_488, Gia_964, Gia_968, Gia_972, Gia_976);
         Ld_36 = Ld_20 - Ld_28;
         Ld_8 += Ld_36;
      }
   }
   return (Ld_8 / 5.0);
}

// 12E1976D0BC8C1AEA8CF9F2653CF1FF2
double f0_6(string As_0, int Ai_8, int Ai_12, int Aia_16[5], int Aia_20[5], int Aia_24[5], int Aia_28[5], int Aia_32[5]) {
   double Ld_48;
   double Ld_36 = 0.0;
   int count_44 = 0;
   for (int index_56 = 0; index_56 < G_index_944; index_56++) {
      Ld_48 = 0.0001;
      if (StringSubstr(Gsa_940[index_56], 3, 3) == "JPY") Ld_48 = 0.01;
      if (StringSubstr(Gsa_940[index_56], 0, 3) == As_0) {
         if (pb_algo == 1) Ld_36 += iRSI(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], PRICE_CLOSE, Ai_12);
         if (pb_algo == 2) Ld_36 += iWPR(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], Ai_12) + 100.0;
         if (pb_algo == 3) Ld_36 += iStochastic(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], 3, 3, MODE_SMA, 0, MODE_MAIN, Ai_12);
         if (pb_algo == 4) Ld_36 += f0_51(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], 2, Ai_12);
         if (pb_algo == 5) Ld_36 += iMACD(Gsa_940[index_56], Aia_16[Ai_8], Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_48;
         if (pb_algo == 6) {
            Ld_36 += iMACD(Gsa_940[index_56], Aia_16[Ai_8], Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_MAIN, Ai_12) / Ld_48 - iMACD(Gsa_940[index_56], Aia_16[Ai_8],
               Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_48;
         }
         count_44++;
      }
      if (StringSubstr(Gsa_940[index_56], 3, 3) == As_0) {
         if (pb_algo == 1) Ld_36 += 100 - iRSI(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], PRICE_CLOSE, Ai_12);
         if (pb_algo == 2) Ld_36 -= iWPR(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], Ai_12);
         if (pb_algo == 3) Ld_36 += 100 - iStochastic(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], 3, 3, MODE_SMA, 0, MODE_MAIN, Ai_12);
         if (pb_algo == 4) Ld_36 += 100 - f0_51(Gsa_940[index_56], Aia_16[Ai_8], Aia_20[Ai_8], 2, Ai_12);
         if (pb_algo == 5) Ld_36 -= iMACD(Gsa_940[index_56], Aia_16[Ai_8], Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_48;
         if (pb_algo == 6) {
            Ld_36 += iMACD(Gsa_940[index_56], Aia_16[Ai_8], Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_SIGNAL, Ai_12) / Ld_48 - iMACD(Gsa_940[index_56], Aia_16[Ai_8],
               Aia_24[Ai_8], Aia_28[Ai_8], Aia_32[Ai_8], PRICE_CLOSE, MODE_MAIN, Ai_12) / Ld_48;
         }
         count_44++;
      }
   }
   if (count_44 > 0) return (Ld_36 / count_44);
   return (0.0);
}

// 93400DC344D31D62D24D5CEFE516D523
double f0_51(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);
}

// 80A992C478EDF56FE6484B0FE79277F4
void f0_44(int Ai_0) {
   int Li_8;
   for (int index_4 = 0; index_4 < 4; index_4++) {
      Gia_488[index_4] = Gia_484[index_4];
      if (pb_autotimeframe > 0) {
         Li_8 = index_4 + Ai_0 / (pb_autotimeframe + index_4);
         if (Li_8 > 4) Li_8 = 4;
         Gia_488[index_4] = Gia_484[Li_8];
      }
   }
}

// ACCF5B4502E4C99A179DE703F4B67AAD
void f0_58(int &Aia_0[5], int &Aia_4[5], int &Aia_8[5], int &Aia_12[5], int &Aia_16[5]) {
   for (int index_20 = 0; index_20 < 5; index_20++) {
      if (Aia_0[index_20] == 0) Aia_0[index_20] = Period();
      switch (Aia_0[index_20]) {
      case 1:
         Aia_4[index_20] = 30;
         Aia_8[index_20] = 14;
         Aia_12[index_20] = 30;
         Aia_16[index_20] = 10;
         break;
      case 5:
         Aia_4[index_20] = 24;
         Aia_8[index_20] = 11;
         Aia_12[index_20] = 24;
         Aia_16[index_20] = 8;
         break;
      case 15:
         Aia_4[index_20] = 24;
         Aia_8[index_20] = 11;
         Aia_12[index_20] = 24;
         Aia_16[index_20] = 8;
         break;
      case 30:
         Aia_4[index_20] = 24;
         Aia_8[index_20] = 11;
         Aia_12[index_20] = 24;
         Aia_16[index_20] = 8;
         break;
      case 60:
         Aia_4[index_20] = 24;
         Aia_8[index_20] = 11;
         Aia_12[index_20] = 24;
         Aia_16[index_20] = 8;
         break;
      case 240:
         Aia_4[index_20] = 30;
         Aia_8[index_20] = 14;
         Aia_12[index_20] = 30;
         Aia_16[index_20] = 10;
         break;
      case 1440:
         Aia_4[index_20] = 20;
         Aia_8[index_20] = 9;
         Aia_12[index_20] = 20;
         Aia_16[index_20] = 7;
         break;
      case 10080:
         Aia_4[index_20] = 27;
         Aia_8[index_20] = 12;
         Aia_12[index_20] = 27;
         Aia_16[index_20] = 9;
         break;
      case 43200:
         Aia_4[index_20] = 24;
         Aia_8[index_20] = 11;
         Aia_12[index_20] = 24;
         Aia_16[index_20] = 8;
      }
   }
}

// 9ECCEF02059F3FD6D950F4ACDFCE123F
void f0_56(double Ad_0, int Ai_8) {
   int Li_12;
   string str_concat_40;
   double Ld_16 = MarketInfo(Symbol(), MODE_MINLOT);
   double Ld_24 = MarketInfo(Symbol(), MODE_MAXLOT);
   double lotstep_32 = MarketInfo(Symbol(), MODE_LOTSTEP);
   if (NormalizeDouble(lotstep_32, 2) < 0.1) Li_12 = 2;
   else Li_12 = 1;
   Ad_0 = NormalizeDouble(Ad_0, Li_12);
   if (Ad_0 < Ld_16) Ad_0 = Ld_16;
   if (Ad_0 > Ld_24) Ad_0 = Ld_24;
   RefreshRates();
   if (Ai_8 == 0) {
      str_concat_40 = StringConcatenate(G_str_concat_616, f0_89(Ask, Digits));
      GlobalVariableSet(str_concat_40, Ad_0);
   }
   if (Ai_8 == 1) {
      str_concat_40 = StringConcatenate(G_str_concat_616, f0_89(Bid, Digits));
      GlobalVariableSet(str_concat_40, -Ad_0);
   }
}

// 0461EBD2B773878EAC9F78A891912D65
void f0_3(double Ad_0) {
   f0_56(Ad_0, 0);
}

// 8325324B47E1E62A1C2998A640CBDC72
void f0_46(double Ad_0) {
   f0_56(Ad_0, 1);
}

// FE634B928B6A79BF3DFFA04A5A8D9EA4
void f0_96() {
   double Ld_0 = NormalizeDouble(f0_50(0) + f0_50(1), 2);
   double Ld_8 = NormalizeDouble(f0_81(Symbol(), Magic_Number), 2);
   double Ld_16 = NormalizeDouble(Ld_0 - Ld_8, 2);
   if (Ld_16 != 0.0) f0_66(Ld_0, Ld_8, slippage, Magic_Number, comment);
   f0_93();
   f0_63();
}

// F5632D521B1EA2C72BCBF702C9F0CE94
void f0_93() {
   int Li_0;
   string Ls_8;
   double global_var_16;
   double Ld_24;
   if (Gi_644) {
      f0_64();
      Li_0 = GlobalVariablesTotal();
      for (int count_4 = 0; count_4 < Li_0; count_4++) {
         Ls_8 = GlobalVariableName(count_4);
         if (StringFind(Ls_8, G_str_concat_616) == 0) {
            global_var_16 = GlobalVariableGet(Ls_8);
            Ld_24 = f0_22(StringSubstr(Ls_8, G_str_len_624));
            if (global_var_16 > 0.0) f0_85(Ls_8, Ld_24, Blue, "Virtual Trade Long", 1);
            if (global_var_16 < 0.0) f0_85(Ls_8, Ld_24, Red, "Virtual Trade Short", 1);
         }
      }
   }
}

// B51145507B974D7678A7172122BB0DA9
void f0_64() {
   string name_12;
   int count_0 = 0;
   int objs_total_4 = ObjectsTotal();
   for (int Li_8 = 0; Li_8 < objs_total_4; Li_8++) {
      name_12 = ObjectName(Li_8);
      if (StringFind(name_12, "fortissimofx_trade_") == 0) {
         count_0++;
         ObjectDelete(name_12);
      }
   }
}

// 90E62BF0467FCC20D31A8E2BC6BB4B83
double f0_50(int Ai_0) {
   string Ls_20;
   double global_var_28;
   double Ld_ret_4 = 0.0;
   int Li_12 = GlobalVariablesTotal();
   for (int count_16 = 0; count_16 < Li_12; count_16++) {
      Ls_20 = GlobalVariableName(count_16);
      if (StringFind(Ls_20, G_str_concat_616) == 0) {
         global_var_28 = GlobalVariableGet(Ls_20);
         if (f0_90(global_var_28, Ai_0)) Ld_ret_4 += global_var_28;
      }
   }
   return (Ld_ret_4);
}

// 716F6B30598BA30945D84485E61C1027
void f0_35(int Ai_0) {
   string Ls_12;
   double global_var_20;
   int Li_4 = GlobalVariablesTotal();
   for (int count_8 = 0; count_8 < Li_4; count_8++) {
      Ls_12 = GlobalVariableName(count_8);
      if (StringFind(Ls_12, G_str_concat_616) == 0) {
         global_var_20 = GlobalVariableGet(Ls_12);
         if (f0_90(global_var_20, Ai_0)) GlobalVariableDel(Ls_12);
      }
   }
}

// 020061EF10F0ABCDAC97861ADBC957F1
double f0_2(int Ai_0) {
   string Ls_28;
   double global_var_36;
   double Ld_44;
   double Ld_4 = 0.0;
   double Ld_12 = 0.0;
   int Li_20 = GlobalVariablesTotal();
   for (int count_24 = 0; count_24 < Li_20; count_24++) {
      Ls_28 = GlobalVariableName(count_24);
      if (StringFind(Ls_28, G_str_concat_616) == 0) {
         global_var_36 = GlobalVariableGet(Ls_28);
         if (f0_90(global_var_36, Ai_0)) {
            Ld_44 = f0_22(StringSubstr(Ls_28, G_str_len_624));
            Ld_12 += Ld_44 * global_var_36;
            Ld_4 += global_var_36;
         }
      }
   }
   if (Ld_4 != 0.0) return (Ld_12 / Ld_4);
   return (0.0);
}

// D4D37C4938CB842ADF67803655D8FA59
double f0_79(int Ai_0) {
   string Ls_36;
   double Ld_44;
   double Ld_ret_4 = 0.0;
   int Li_12 = GlobalVariablesTotal();
   double global_var_16 = 0.0;
   double global_var_24 = 0.0;
   for (int count_32 = 0; count_32 < Li_12; count_32++) {
      Ls_36 = GlobalVariableName(count_32);
      if (StringFind(Ls_36, G_str_concat_616) == 0) {
         global_var_16 = GlobalVariableGet(Ls_36);
         if (f0_90(global_var_16, Ai_0)) {
            Ld_44 = f0_22(StringSubstr(Ls_36, G_str_len_624));
            if (global_var_24 == 0.0) {
               global_var_24 = global_var_16;
               Ld_ret_4 = Ld_44;
               continue;
            }
            if (MathAbs(global_var_16) > MathAbs(global_var_24)) {
               global_var_24 = global_var_16;
               Ld_ret_4 = Ld_44;
            }
         }
      }
   }
   return (Ld_ret_4);
}

// BA165807A1687C15D628FAD2BC95DDE5
double f0_69(int Ai_0) {
   string Ls_64;
   double Ld_72;
   double Ld_4 = 0.0;
   double Ld_12 = 0.0;
   int Li_unused_20 = 0;
   int Li_24 = GlobalVariablesTotal();
   double global_var_28 = 0.0;
   double Ld_unused_36 = 0.0;
   double Ld_44 = f0_91(Ai_0);
   if (Ld_44 == 0.0) return (0.0);
   double Ld_52 = f0_86(Ai_0, Ld_44);
   if (Ld_52 == 0.0) return (0.0);
   for (int count_60 = 0; count_60 < Li_24; count_60++) {
      Ls_64 = GlobalVariableName(count_60);
      if (StringFind(Ls_64, G_str_concat_616) == 0) {
         global_var_28 = GlobalVariableGet(Ls_64);
         if (f0_90(global_var_28, Ai_0)) {
            Ld_72 = f0_22(StringSubstr(Ls_64, G_str_len_624));
            if (Ld_44 == MathAbs(global_var_28)) Ld_4 = Ld_72;
            if (Ld_52 == MathAbs(global_var_28)) Ld_12 = Ld_72;
         }
      }
   }
   if (Ld_4 > 0.0 && Ld_12 > 0.0) return (NormalizeDouble(MathAbs(Ld_4 - Ld_12) / G_point_816, 1));
   return (0.0);
}

// F0BA340536FB5A62EF820D1347A4FFB4
double f0_91(int Ai_0) {
   string Ls_28;
   int Li_4 = GlobalVariablesTotal();
   double global_var_8 = 0.0;
   double Ld_ret_16 = 0.0;
   for (int count_24 = 0; count_24 < Li_4; count_24++) {
      Ls_28 = GlobalVariableName(count_24);
      if (StringFind(Ls_28, G_str_concat_616) == 0) {
         global_var_8 = GlobalVariableGet(Ls_28);
         if (f0_90(global_var_8, Ai_0)) Ld_ret_16 = MathMax(Ld_ret_16, MathAbs(global_var_8));
      }
   }
   return (Ld_ret_16);
}

// E22A229DB08488D5F1AAC6705B7543DA
double f0_86(int Ai_0, double Ad_4) {
   string Ls_36;
   int Li_12 = GlobalVariablesTotal();
   double global_var_16 = 0.0;
   double Ld_ret_24 = 0.0;
   for (int count_32 = 0; count_32 < Li_12; count_32++) {
      Ls_36 = GlobalVariableName(count_32);
      if (StringFind(Ls_36, G_str_concat_616) == 0) {
         global_var_16 = GlobalVariableGet(Ls_36);
         if (f0_90(global_var_16, Ai_0))
            if (MathAbs(global_var_16) < Ad_4) Ld_ret_24 = MathMax(Ld_ret_24, MathAbs(global_var_16));
      }
   }
   return (Ld_ret_24);
}

// 868C5332B7AE9CFAA2B7E30368FF2FB6
double f0_47(int Ai_0) {
   return (MathAbs(f0_50(Ai_0)));
}

// E2942A04780E223B215EB8B663CF5353
int f0_87(int Ai_0) {
   string Ls_16;
   double global_var_24;
   int count_4 = 0;
   int Li_8 = GlobalVariablesTotal();
   for (int count_12 = 0; count_12 < Li_8; count_12++) {
      Ls_16 = GlobalVariableName(count_12);
      if (StringFind(Ls_16, G_str_concat_616) == 0) {
         global_var_24 = GlobalVariableGet(Ls_16);
         if (f0_90(global_var_24, Ai_0)) count_4++;
      }
   }
   return (count_4);
}

// 573C2DCD2155FF9914DD5795F8999C6D
double f0_29(int Ai_0) {
   string Ls_36;
   double global_var_44;
   double Ld_52;
   double Ld_unused_4 = 0.0;
   Gd_824 = f0_42();
   double Ld_12 = 0.0;
   double Ld_20 = 0.0;
   int Li_28 = GlobalVariablesTotal();
   for (int count_32 = 0; count_32 < Li_28; count_32++) {
      Ls_36 = GlobalVariableName(count_32);
      if (StringFind(Ls_36, G_str_concat_616) == 0) {
         global_var_44 = GlobalVariableGet(Ls_36);
         if (f0_90(global_var_44, Ai_0)) {
            Ld_52 = f0_60(Ls_36);
            Ld_20 += Ld_52 * global_var_44;
            Ld_12 += global_var_44;
         }
      }
   }
   if (Ld_12 != 0.0) Ld_20 /= Ld_12;
   if (Ld_12 > 0.0) return ((Bid - Ld_20) / G_point_816 * Gd_824 * Ld_12 / 0.1);
   if (Ld_12 < 0.0) return ((Ask - Ld_20) / G_point_816 * Gd_824 * Ld_12 / 0.1);
   return (0.0);
}

// ED24772458AD84F04587FEF5BEE6B915
int f0_90(double Ad_0, int Ai_8) {
   if (Ai_8 == 0 && Ad_0 > 0.0) return (1);
   if (Ai_8 == 1 && Ad_0 < 0.0) return (1);
   return (0);
}

// B07B960FBDB900B7408B1A8A28BC809A
double f0_60(string As_0) {
   return (NormalizeDouble(f0_22(StringSubstr(As_0, G_str_len_624)), Digits));
}

// F997BF1F9F382070CE6267D360D03781
double f0_94(int A_magic_0) {
   double Ld_ret_4 = 0.0;
   int order_total_12 = OrdersTotal();
   string dbl2str_16 = DoubleToStr(A_magic_0, 0);
   if (order_total_12 > 0) {
      for (int pos_24 = 0; pos_24 < order_total_12; pos_24++) {
         if (OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES))
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == A_magic_0 || OrderComment() == dbl2str_16) Ld_ret_4 += OrderProfit() + OrderSwap() + OrderCommission();
      }
      return (Ld_ret_4);
   }
   return (0);
}

// 5DD01D070EC813C0626C05E74A2FCD6D
double f0_32(int A_magic_0) {
   double Ld_ret_4 = 0;
   int hist_total_12 = OrdersHistoryTotal();
   string dbl2str_16 = DoubleToStr(A_magic_0, 0);
   if (hist_total_12 > 0) {
      for (int pos_24 = 0; pos_24 < hist_total_12; pos_24++) {
         if (OrderSelect(pos_24, SELECT_BY_POS, MODE_HISTORY))
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == A_magic_0 || OrderComment() == dbl2str_16) Ld_ret_4 += OrderProfit() + OrderSwap() + OrderCommission();
      }
      return (Ld_ret_4);
   }
   return (0);
}

// 4ABDB68B08CD61CA68A83B7D9347987E
int f0_24(int Ai_0, int Ai_4, int Ai_8) {
   if (G_arr_size_520 == 0) return (1);
   if (additional_entries_thresholds == "") return (1);
   int Li_12 = 0;
   if (Ai_8 <= G_arr_size_520) Li_12 = Gia_516[Ai_8 - 1];
   if (Ai_8 > G_arr_size_520) Li_12 = Gia_516[G_arr_size_520 - 1];
   if (Li_12 == 777) return (1);
   if (Ai_0 == 0 && Ai_4 >= Li_12) return (1);
   if (Ai_0 == 1 && Ai_4 <= (-1 * Li_12)) return (1);
   return (0);
}

// B47453F49D61A7E87D999F06C453729F
void f0_63(string As_0 = "") {
   int Li_20;
   string Ls_28;
   double global_var_36;
   double Ld_44;
   string str_concat_8 = StringConcatenate(As_0, "fortissimofx_trades_", Symbol(), "_", f0_40(Magic_Number), ".txt");
   int file_16 = FileOpen(str_concat_8, FILE_CSV|FILE_WRITE);
   if (file_16 != -1) {
      Li_20 = GlobalVariablesTotal();
      for (int count_24 = 0; count_24 < Li_20; count_24++) {
         Ls_28 = GlobalVariableName(count_24);
         if (StringFind(Ls_28, G_str_concat_616) == 0) {
            global_var_36 = GlobalVariableGet(Ls_28);
            Ld_44 = f0_60(Ls_28);
            FileWrite(file_16, f0_89(Ld_44, Digits), f0_89(global_var_36, 2));
         }
      }
      FileClose(file_16);
   }
}

// 01722D7D5BBDD0E97B9AE5850FFAC110
void f0_1() {
   double Lda_12[500];
   double Lda_16[500];
   string str_concat_24;
   string str_concat_0 = StringConcatenate("fortissimofx_trades_", Symbol(), "_", f0_40(Magic_Number), ".txt");
   int file_8 = FileOpen(str_concat_0, FILE_CSV|FILE_READ);
   if (file_8 == -1) {
      Alert("FortissimoFX: ", Symbol(), ": File not found: cannot restore Global Variables! No current GV has been deleted.");
      return;
   }
   ArrayInitialize(Lda_12, 0.0);
   ArrayInitialize(Lda_16, 0.0);
   for (int index_20 = 0; !FileIsEnding(file_8) && index_20 < 500; index_20++) {
      Lda_12[index_20] = FileReadNumber(file_8);
      Lda_16[index_20] = FileReadNumber(file_8);
      Print("Restored from file: array_prices[", index_20, "] = ", Lda_12[index_20]);
      Print("Restored from file: array_lots[", index_20, "] = ", Lda_16[index_20]);
   }
   FileClose(file_8);
   if (index_20 == 0) {
      Alert("FortissimoFX: ", Symbol(), ": File looks empty: cannot restore Global Variables! No current GV has been deleted.");
      return;
   }
   f0_11();
   for (int index_32 = 0; index_32 < index_20; index_32++) {
      str_concat_24 = StringConcatenate(G_str_concat_616, f0_89(Lda_12[index_32], Digits));
      GlobalVariableSet(str_concat_24, Lda_16[index_32]);
      Print("GV Restored from file: ", str_concat_24, " = ", f0_89(Lda_16[index_32], 2));
   }
   Alert("FortissimoFX: ", Symbol(), ": Global Variables restored from file = ", f0_40(index_20));
}

// 1FFCEE87144F709FF804685A582FA6CB
void f0_11() {
   string Ls_8;
   int Li_0 = GlobalVariablesTotal();
   for (int count_4 = 0; count_4 < Li_0; count_4++) {
      Ls_8 = GlobalVariableName(count_4);
      if (StringFind(Ls_8, G_str_concat_616) == 0) GlobalVariableDel(Ls_8);
   }
}

// DC4018674AA3C002372C9E170DAF5222
int f0_82() {
   int timeframe_0 = 5;
   if (G_datetime_1000 == iTime(NULL, timeframe_0, 0)) return (0);
   G_datetime_1000 = iTime(NULL, timeframe_0, 0);
   return (1);
}

// C639DB05C189E665A3B9BBC7DA6832B7
string f0_72() {
   string Ls_ret_0 = "BCK" + f0_40(Year());
   if (Month() < 10) Ls_ret_0 = Ls_ret_0 + "0";
   Ls_ret_0 = Ls_ret_0 + f0_40(Month());
   if (Day() < 10) Ls_ret_0 = Ls_ret_0 + "0";
   Ls_ret_0 = Ls_ret_0 + f0_40(Day()) + "_";
   if (Hour() < 10) Ls_ret_0 = Ls_ret_0 + "0";
   Ls_ret_0 = Ls_ret_0 + f0_40(Hour());
   if (Minute() < 10) Ls_ret_0 = Ls_ret_0 + "0";
   Ls_ret_0 = Ls_ret_0 + f0_40(Minute()) + "_";
   return (Ls_ret_0);
}

// 4BA6B77F0F5EB5D7275DB27158D3B186
void f0_26(int Ai_unused_0) {
   f0_0();
}

// 8B1B145977BB617E1B098A84561E4D7A
void f0_49() {
}

// E37F0136AA3FFAF149B351F6A4C948E9
void init() {
   f0_95();
}

// 52D46093050F38C27267BCE42543EF60
void deinit() {
   f0_4(0);
}

// EA2B2676C28C0DB26D39331A336C6B92
void start() {
   f0_65();
   f0_39();
}