
#property copyright "Copyright Wise-EA Programming"
#property link      ""

extern string TRAD = " -------------------------- Trading Condition Settings -------------------------- ";
extern bool ManageAllTrades = TRUE;
extern int MagicNumber = 1234;
extern bool FutureTradesOnly = FALSE;
extern string ColorSetting = " -------------------------- ColorSetting -------------------------- ";
extern color SL_LineColor = OrangeRed;
extern color TP_LineColor = RoyalBlue;
extern string HardTPSTLSetting = " -------------------------- Hard TakeProfit/StopLoss Settings -------------------------- ";
extern string VIS = " --- VIS: 0=Hidden SLTP, 1=Hard SLTP, 2=Both --- ";
extern int Visibility_SLTP = 2;
extern double FakeStopLoss = 15.0;
extern double FakeTakeProfit = 100.0;
extern string SLSetting = " -------------------------- StopLoss Settings -------------------------- ";
extern string SL = " --- SL: 0=None, 1=Fixed, 2=ATR, 3=Risk --- ";
extern int SL_Method = 2;
extern double FixedStopLoss = 20.0;
extern int ATRTimeFrame = 1440;
extern int ATRPeriod = 20;
extern double ATRMultiplier = 2.0;
extern double AccountRiskPercent = 2.0;
extern bool UseBE = TRUE;
extern double BEPoint = 25.0;
extern double BEProfitPip = 5.0;
extern string TrailStop = "-------------------------- TrailStop --------------------------";
extern string TRAIL = " --- TRAIL: 0=None, 1=Fixed, 2=MA --- ";
extern int TrailStop_Method = 1;
extern double TrailActivation = 7.0;
extern double TrailingStop = 4.0;
extern double TrailingStep = 1.0;
extern int MATimeFrame = 0;
extern int MAPeriod = 20;
extern int MAType = 0;
extern int MAPrice = 0;
extern int MABarShift = 1;
extern string TakeProfitSettings = "-------------------------- TakeProfit Settings --------------------------";
extern string TP = " --- TP: 0=None, 1=Fixed, 2=SL --- ";
extern int TP_Method = 2;
extern double FixedTakeProfit = 45.0;
extern double TP_Multipler = 3.0;
extern string PortionsTakeProfitSettings = "-------------------------- Portions TakeProfit Settings --------------------------";
extern string PartialCls = " --- 0=None,1=Fixed,2=TP Ratio --- ";
extern int PartialCls_Method = 2;
extern string TPLevels = "25,50,75";
extern string TPLotPercent = "50,50,50";
extern bool ExtendPartialLines = TRUE;

string TestingDirection = "buy";

int G_digits_320;
int G_arr_size_324;
double Gd_328;
double G_price_336;
double G_price_344;
double Gd_352;
double Gd_360;
double Gd_368;
double Gda_384[100];
double Gda_388[100];
int G_datetime_392;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   int cmd_0;
   double price_4;
   Gd_328 = MarketInfo(Symbol(), MODE_POINT);
   G_digits_320 = MarketInfo(Symbol(), MODE_DIGITS);
   if (G_digits_320 == 3 || G_digits_320 == 5) Gd_328 = 10.0 * Gd_328;
   if (PartialCls_Method > 0) {
      f0_10(TPLevels, Gda_384);
      f0_10(TPLotPercent, Gda_388);
      G_arr_size_324 = ArraySize(Gda_384);
   }
   if (FutureTradesOnly) G_datetime_392 = TimeCurrent();
   else G_datetime_392 = 0;
   if (TestingDirection == "buy") {
      cmd_0 = 0;
      price_4 = Ask;
   } else {
      cmd_0 = 1;
      price_4 = Bid;
   }
   if (IsTesting()) bool send = OrderSend(Symbol(), cmd_0, 1, price_4, 2, 0, 0, "", 0, 0, Lime);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   f0_1("LOGO");
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   f0_3();
   f0_19();
   f0_2();
 //  f0_16();
   return (0);
}

// 33B0A9C6D0D847D114972109165BA9AE
void f0_5(int Ai_unused_0) {
   string name_4 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-StopLine";
   ObjectDelete(name_4);
   ObjectCreate(name_4, OBJ_HLINE, 0, Time[0], G_price_336);
   ObjectSet(name_4, OBJPROP_COLOR, SL_LineColor);
   ObjectSet(name_4, OBJPROP_WIDTH, 1);
   ObjectSet(name_4, OBJPROP_STYLE, STYLE_DASHDOT);
   ObjectSet(name_4, OBJPROP_TIMEFRAMES, NULL);
   name_4 = name_4 + " name";
   ObjectDelete(name_4);
   int shift_12 = iBarShift(NULL, 0, OrderOpenTime());
   ObjectCreate(name_4, OBJ_TEXT, 0, Time[shift_12], G_price_336);
   ObjectSetText(name_4, f0_4(0, G_price_336), 8, "Arial", SL_LineColor);
   name_4 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-TPLine";
   ObjectDelete(name_4);
   ObjectCreate(name_4, OBJ_HLINE, 0, Time[0], G_price_344);
   ObjectSet(name_4, OBJPROP_COLOR, TP_LineColor);
   ObjectSet(name_4, OBJPROP_WIDTH, 1);
   ObjectSet(name_4, OBJPROP_STYLE, STYLE_DASHDOT);
   ObjectSet(name_4, OBJPROP_TIMEFRAMES, NULL);
   name_4 = name_4 + " name";
   ObjectDelete(name_4);
   ObjectCreate(name_4, OBJ_TEXT, 0, Time[shift_12], G_price_344);
   ObjectSetText(name_4, f0_4(1, G_price_344), 8, "Arial", TP_LineColor);
}

// 1504365982A3B6FBB5806F0EB57D2E6E
void f0_2() {
   string Ls_4;
   string name_12;
   int Li_20;
   string Ls_24;
   string Ls_32;
   for (int pos_0 = OrdersHistoryTotal() - 1; pos_0 >= 0; pos_0--) {
      if (OrderSelect(pos_0, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderSymbol() == Symbol()) {
            Ls_4 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320);
            if (f0_17(OrderOpenTime(), OrderOpenPrice()) == 0) f0_1(Ls_4);
         }
      }
   }
   Ls_4 = "";
   for (pos_0 = ObjectsTotal() - 1; pos_0 >= 0; pos_0--) {
      name_12 = ObjectName(pos_0);
      Li_20 = 0;
      if (StringLen(name_12) >= 25 && StringSubstr(name_12, 19, 1) == "-") {
         Ls_24 = StringSubstr(name_12, 0, 19);
         Li_20 = StringFind(name_12, "-", 20);
         if (Li_20 > 0) Ls_32 = StringSubstr(name_12, 20, Li_20 - 20);
         Ls_4 = Ls_24 + "-" + Ls_32;
         if (f0_17(StrToTime(Ls_24), StrToDouble(Ls_32)) == 0) {
            f0_1(Ls_4);
            return;
         }
      }
   }
}

// E05A4495EFF74F0BCF71D55E55A7C81F
int f0_17(int Ai_0, double Ad_4) {
   int count_12 = 0;
   for (int pos_16 = OrdersTotal() - 1; pos_16 >= 0; pos_16--) {
      if (OrderSelect(pos_16, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderOpenTime() >= G_datetime_392) {
               if (ManageAllTrades || ((!ManageAllTrades) && OrderMagicNumber() == MagicNumber))
                  if (OrderOpenTime() == Ai_0 && OrderOpenPrice() == Ad_4) count_12++;
            }
         }
      }
   }
   return (count_12);
}

// 288404204E3D452229308317344A285D
string f0_4(int Ai_0, double Ad_4) {
   double Ld_20;
   double tickvalue_12 = MarketInfo(Symbol(), MODE_TICKVALUE);
   if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) Ld_20 = (Ad_4 - OrderOpenPrice()) / Point;
   else Ld_20 = (OrderOpenPrice() - Ad_4) / Point;
   double Ld_28 = Ld_20 * tickvalue_12 * OrderLots();
   Ld_28 = NormalizeDouble(Ld_28, 2);
   if (Ai_0 == 0) return (OrderTicket() + " SL(" + DoubleToStr(Ld_28, 2) + ")");
   return (OrderTicket() + " TP(" + DoubleToStr(Ld_28, 2) + ")");
}

// 27455279702DE949E07090F88E445769
void f0_3() {
   string Ls_20;
   string name_28;
   string name_36;
   double Ld_44;
   for (int pos_16 = OrdersTotal() - 1; pos_16 >= 0; pos_16--) {
      if (OrderSelect(pos_16, SELECT_BY_POS)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderOpenTime() >= G_datetime_392) {
               if (ManageAllTrades || ((!ManageAllTrades) && OrderMagicNumber() == MagicNumber)) {
                  Ls_20 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320);
                  name_28 = Ls_20 + "-StopLine" + " name";
                  name_36 = Ls_20 + "-TPLine" + " name";
                  if (ObjectFind(name_28) == -1 || ObjectFind(name_36) == -1) {
                     f0_11();
                     f0_5(OrderTicket());
                     if (Visibility_SLTP == 2) f0_6();
                     if (PartialCls_Method <= 0) continue;
                     f0_13(OrderTicket());
                     continue;
                  }
                  if (ObjectDescription(name_28) != OrderTicket() + " SL" || ObjectDescription(name_36) != OrderTicket() + " TP") {
                     Ld_44 = ObjectGet(Ls_20 + "-StopLine", OBJPROP_PRICE1);
                     ObjectSetText(name_28, f0_4(0, Ld_44), 8, "Arial", SL_LineColor);
                     Ld_44 = ObjectGet(Ls_20 + "-TPLine", OBJPROP_PRICE1);
                     ObjectSetText(name_36, f0_4(1, Ld_44), 8, "Arial", TP_LineColor);
                  }
               }
            }
         }
      }
   }
}

// 360C04D551ED3E6FD063A598E25C7DFB
void f0_6() {
   double price_0;
   double price_8;
   int error_20;
   if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) {
      if (FakeStopLoss > 0.0) price_0 = OrderOpenPrice() - FakeStopLoss * Gd_328;
      else price_0 = 0;
      if (FakeTakeProfit > 0.0) price_8 = OrderOpenPrice() + FakeTakeProfit * Gd_328;
      else price_8 = 0;
   } else {
      if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) {
         if (FakeStopLoss > 0.0) price_0 = OrderOpenPrice() + FakeStopLoss * Gd_328;
         else price_0 = 0;
         if (FakeTakeProfit > 0.0) price_8 = OrderOpenPrice() - FakeTakeProfit * Gd_328;
         else price_8 = 0;
      }
   }
   price_0 = NormalizeDouble(price_0, G_digits_320);
   price_8 = NormalizeDouble(price_8, G_digits_320);
   if (price_0 != OrderStopLoss() || price_8 != OrderTakeProfit()) {
      for (int Li_16 = 5; Li_16 > 0; Li_16--) {
         bool modif = OrderModify(OrderTicket(), OrderOpenPrice(), price_0, price_8, 0, CLR_NONE);
         error_20 = GetLastError();
         if (error_20 == 1/* NO_RESULT */) error_20 = 0;
         if (error_20 == 0/* NO_ERROR */) break;
         Sleep(1000);
         RefreshRates();
      }
   }
}

// 643DE8D17A5F387FCE2B6FCF6C5E1466
void f0_11() {
   Gd_352 = 0;
   int Li_0 = iBarShift(NULL, ATRTimeFrame, OrderOpenTime()) + 1;
   if (SL_Method == 1) Gd_352 = FixedStopLoss;
   else {
      if (SL_Method == 2) Gd_352 = ATRMultiplier * iATR(NULL, ATRTimeFrame, ATRPeriod, Li_0) / Gd_328;
      else
         if (SL_Method == 3) Gd_352 = f0_12(OrderLots());
   }
   Gd_360 = 0;
   if (TP_Method == 1) Gd_360 = FixedTakeProfit;
   else
      if (TP_Method == 2) Gd_360 = TP_Multipler * Gd_352;
   if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) {
      if (SL_Method == 0) G_price_336 = 0;
      else G_price_336 = OrderOpenPrice() - Gd_352 * Gd_328;
      if (TP_Method == 0) G_price_344 = 0;
      else G_price_344 = OrderOpenPrice() + Gd_360 * Gd_328;
   } else {
      if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) {
         if (SL_Method == 0) G_price_336 = 0;
         else G_price_336 = OrderOpenPrice() + Gd_352 * Gd_328;
         if (TP_Method == 0) G_price_344 = 0;
         else G_price_344 = OrderOpenPrice() - Gd_360 * Gd_328;
      }
   }
   G_price_336 = NormalizeDouble(G_price_336, G_digits_320);
   G_price_344 = NormalizeDouble(G_price_344, G_digits_320);
}

// 6EE171E5A81A102EB52C9B6AD405F050
double f0_12(double Ad_0) {
   int Li_unused_16;
   if (AccountRiskPercent <= 0.0) AccountRiskPercent = 0.1;
   if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) Li_unused_16 = 2;
   else {
      if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.1) Li_unused_16 = 1;
      else Li_unused_16 = 0;
   }
   double Ld_20 = AccountBalance() * AccountRiskPercent / 100.0;
   double tickvalue_28 = MarketInfo(Symbol(), MODE_TICKVALUE);
   double Ld_ret_8 = Ld_20 * Point / (Gd_328 * tickvalue_28 * Ad_0);
   return (Ld_ret_8);
}

// E3A54926DC5EF1106D81EFCA47E35C6C
void f0_19() {
   string name_4;
   int shift_12;
   double Ld_16;
   int ticket_24;
   int Li_28;
   for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) {
      if (OrderSelect(pos_0, SELECT_BY_POS)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderOpenTime() >= G_datetime_392) {
               if (ManageAllTrades || ((!ManageAllTrades) && OrderMagicNumber() == MagicNumber)) {
                  name_4 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-StopLine";
                  if (ObjectFind(name_4) != -1) {
                     Gd_368 = ObjectGet(name_4, OBJPROP_PRICE1);
                     if (UseBE) f0_15();
                     if (TrailStop_Method > 0) f0_9();
                     Gd_368 = NormalizeDouble(Gd_368, G_digits_320);
                     ObjectMove(name_4, 0, Time[0], Gd_368);
                     shift_12 = iBarShift(NULL, 0, OrderOpenTime());
                     ObjectMove(name_4 + " name", 0, Time[shift_12], Gd_368);
                     ObjectSetText(name_4 + " name", f0_4(0, Gd_368), 8, "Arial", SL_LineColor);
                     name_4 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-TPLine";
                     Ld_16 = ObjectGet(name_4, OBJPROP_PRICE1);
                     Ld_16 = NormalizeDouble(Ld_16, G_digits_320);
                     ObjectMove(name_4 + " name", 0, Time[shift_12], Ld_16);
                     ObjectSetText(name_4 + " name", f0_4(1, Ld_16), 8, "Arial", TP_LineColor);
                     if (Visibility_SLTP == 0 || Visibility_SLTP == 2) {
                        if (OrderType() == OP_BUY && ((Bid >= Ld_16 && Ld_16 > 0.0) || (Bid <= Gd_368 && Gd_368 > 0.0))) f0_21();
                        else
                           if (OrderType() == OP_SELL && ((Ask <= Ld_16 && Ld_16 > 0.0) || (Ask >= Gd_368 && Gd_368 > 0.0))) f0_21();
                     } else {
                        if (Visibility_SLTP == 1) {
                           if (NormalizeDouble(OrderStopLoss(), G_digits_320) != NormalizeDouble(Gd_368, G_digits_320) || NormalizeDouble(OrderTakeProfit(), G_digits_320) != NormalizeDouble(Ld_16,
                              G_digits_320)) bool modif = OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Gd_368, G_digits_320), NormalizeDouble(Ld_16, G_digits_320), 0, CLR_NONE);
                        }
                     }
                     if (OrderType() <= OP_SELL && PartialCls_Method > 0) {
                        if (ExtendPartialLines) f0_18();
                        ticket_24 = OrderTicket();
                        Li_28 = f0_20(OrderOpenTime(), OrderOpenPrice());
                        if (Li_28 < G_arr_size_324 && OrderSelect(ticket_24, SELECT_BY_TICKET, MODE_TRADES)) f0_14(Li_28);
                     }
                  }
               }
            }
         }
      }
   }
}

// A5D053FE96FA99510D8C6DC908118731
void f0_15() {
   if (OrderType() == OP_BUY && Gd_368 < OrderOpenPrice() + BEProfitPip * Gd_328) {
      if (Bid < OrderOpenPrice() + BEPoint * Gd_328) return;
      Gd_368 = OrderOpenPrice() + BEProfitPip * Gd_328;
      return;
   }
   if (OrderType() == OP_SELL && Gd_368 > OrderOpenPrice() - BEProfitPip * Gd_328)
      if (Ask <= OrderOpenPrice() - BEPoint * Gd_328) Gd_368 = OrderOpenPrice() - BEProfitPip * Gd_328;
}

// 5BADBB6A5D8ADD05F899BB7058AC9FA4
void f0_9() {
   double Ld_0 = NormalizeDouble(iMA(NULL, MATimeFrame, MAPeriod, 0, MAType, MAPrice, MABarShift), G_digits_320);
   if (OrderType() == OP_BUY && Bid >= OrderOpenPrice() + TrailActivation * Gd_328) {
      if (TrailStop_Method == 1 && Gd_368 < Bid - TrailingStop * Gd_328 - TrailingStep * Gd_328) {
         Gd_368 = Bid - TrailingStop * Gd_328;
         return;
      }
      if (!(TrailStop_Method == 2 && Gd_368 < Ld_0)) return;
      Gd_368 = Ld_0;
      return;
   }
   if (OrderType() == OP_SELL && Ask <= OrderOpenPrice() - TrailActivation * Gd_328) {
      if (TrailStop_Method == 1 && Gd_368 > Ask + TrailingStop * Gd_328 + TrailingStep * Gd_328) {
         Gd_368 = Ask + TrailingStop * Gd_328;
         return;
      }
      if (TrailStop_Method == 2 && Gd_368 > Ld_0) Gd_368 = Ld_0;
   }
}

// 5C9A09239F7D1DD4C8C3FAE0C0813216
void f0_10(string As_0, double &Ada_8[100]) {
   int Li_16 = 0;
   int Li_20 = 0;
   for (int Li_12 = StringFind(As_0, ",", Li_16); Li_12 > 0; Li_12 = StringFind(As_0, ",", Li_16)) {
      Ada_8[Li_20] = StrToDouble(StringSubstr(As_0, Li_16, Li_12 - Li_16));
      Li_20++;
      Li_16 = Li_12 + 1;
   }
   if (Li_12 < 0) {
      if (Li_20 > 0) Ada_8[Li_20] = StrToDouble(StringSubstr(As_0, Li_16, StringLen(As_0) - 1));
      else Ada_8[Li_20] = StrToDouble(StringSubstr(As_0, Li_16, StringLen(As_0)));
      Li_20++;
   }
   ArrayResize(Ada_8, Li_20);
}

// EBDAF44023365628F68DCB767FB8C995
int f0_20(int Ai_0, double Ad_4) {
   int count_12 = 0;
   for (int pos_16 = OrdersHistoryTotal() - 1; pos_16 >= 0; pos_16--) {
      if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderOpenTime() >= G_datetime_392) {
               if (ManageAllTrades || ((!ManageAllTrades) && OrderMagicNumber() == MagicNumber))
                  if (OrderOpenTime() == Ai_0 && OrderOpenPrice() == Ad_4) count_12++;
            }
         }
      }
   }
   return (count_12);
}

// 7B338FE234B7537C308B9676105075C2
void f0_13(int A_ticket_0) {
   double Ld_12;
   int Li_4 = f0_20(OrderOpenTime(), OrderOpenPrice());
   if (OrderSelect(A_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) {
      for (int Li_8 = Li_4; Li_8 < G_arr_size_324; Li_8++) {
         if (PartialCls_Method == 1) {
            if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) Ld_12 = OrderOpenPrice() + Gda_384[Li_8] * Gd_328;
            else
               if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) Ld_12 = OrderOpenPrice() - Gda_384[Li_8] * Gd_328;
         } else {
            if (PartialCls_Method == 2) {
               if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP) Ld_12 = OrderOpenPrice() + Gda_384[Li_8] * Gd_360 * Gd_328 / 100.0;
               else
                  if (OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELLSTOP) Ld_12 = OrderOpenPrice() - Gda_384[Li_8] * Gd_360 * Gd_328 / 100.0;
            }
         }
         Ld_12 = NormalizeDouble(Ld_12, G_digits_320);
         f0_8(Li_8, Ld_12);
      }
   }
}

// 52C27BF0A664587D94B0F9F12011A14E
void f0_8(int Ai_0, double A_price_4) {
   int shift_12 = iBarShift(NULL, 0, OrderOpenTime());
   string name_16 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-TP" + Ai_0;
   ObjectDelete(name_16);
   ObjectCreate(name_16, OBJ_TREND, 0, Time[shift_12 + 4], A_price_4, Time[shift_12], A_price_4);
   ObjectSet(name_16, OBJPROP_RAY, FALSE);
   ObjectSet(name_16, OBJPROP_COLOR, Yellow);
   ObjectSet(name_16, OBJPROP_WIDTH, 1);
   ObjectSet(name_16, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(name_16, OBJPROP_TIMEFRAMES, NULL);
}

// E0A91E6DB6FF1103171559559F2D9698
void f0_18() {
   string name_12;
   string Ls_0 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-TP";
   for (int Li_8 = ObjectsTotal() - 1; Li_8 >= 0; Li_8--) {
      name_12 = ObjectName(Li_8);
      if (StringSubstr(name_12, 0, StringLen(Ls_0)) == Ls_0) ObjectSet(name_12, OBJPROP_TIME2, Time[0]);
   }
}

// 99995FB7407E3FDF4EBE607B6141484B
void f0_14(int Ai_0) {
   double Ld_20;
   double price_28;
   bool is_closed_36;
   double lots_4 = f0_0(OrderLots() * Gda_388[Ai_0] / 100.0);
   string name_12 = TimeToStr(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "-" + DoubleToStr(OrderOpenPrice(), G_digits_320) + "-TP" + Ai_0;
   if (ObjectFind(name_12) == 0) Ld_20 = ObjectGet(name_12, OBJPROP_PRICE1);
   else Ld_20 = 0;
   if (Ld_20 != 0.0 && lots_4 > 0.0) {
      if ((OrderType() == OP_BUY && Bid >= Ld_20) || (OrderType() == OP_SELL && Ask <= Ld_20)) {
         if (OrderType() == OP_BUY) price_28 = Bid;
         else price_28 = Ask;
         is_closed_36 = OrderClose(OrderTicket(), lots_4, price_28, 1, MediumSeaGreen);
         if (is_closed_36) ObjectDelete(name_12);
      }
   }
}

// 02828375C6E47645A1860824EB93573F
double f0_0(double Ad_0) {
   int Li_8;
   if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) Li_8 = 2;
   else {
      if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.1) Li_8 = 1;
      else Li_8 = 0;
   }
   double Ld_ret_12 = NormalizeDouble(Ad_0, Li_8);
   if (Ld_ret_12 < MarketInfo(Symbol(), MODE_MINLOT)) Ld_ret_12 = MarketInfo(Symbol(), MODE_MINLOT);
   else
      if (Ld_ret_12 > MarketInfo(Symbol(), MODE_MAXLOT)) Ld_ret_12 = MarketInfo(Symbol(), MODE_MAXLOT);
   return (Ld_ret_12);
}

// FD195FAAFB381C3C831EC9C02B980F3F
void f0_21() {
   double price_0;
   if (OrderType() == OP_BUY) price_0 = Bid;
   else
      if (OrderType() == OP_SELL) price_0 = Ask;
   bool is_closed_8 = OrderClose(OrderTicket(), OrderLots(), price_0, 2, MediumSeaGreen);
   if (is_closed_8) {
      Print(TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS) + " | " + "CL_EC_03" + " | " + " Order (" + OrderTicket() + ")  closed: " + " @" + DoubleToStr(OrderClosePrice(),
         G_digits_320));
      return;
   }
   Print(TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS) + " | " + "CL_EC_03" + " | " + " Error closing order : ", GetLastError());
}

// B0A937E0707BD38336617900D00D24A0
//void f0_16() {
 //  f0_7("LOGO" + "0", "", 20, DarkGray, 3, 275, 5, "Arial", 150);
  // f0_7("LOGO" + "1", "Product of Wise-EA Programming", 10, DarkGray, 3, 70, 10, "Arial", 0);
 //  f0_7("LOGO" + "2", "", 20, DarkGray, 3, 37, 5, "Arial", 151);
//}

// 509EB2CDBFCCB9AF9DD0ADFF16C70741
void f0_7(string A_name_0, string A_text_8, int A_fontsize_16, color A_color_20, int A_corner_24, int A_x_28, int A_y_32, string A_fontname_36, int Ai_44) {
   ObjectDelete(A_name_0);
   ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0);
   if (A_text_8 != "") ObjectSetText(A_name_0, A_text_8, A_fontsize_16, A_fontname_36, A_color_20);
   else ObjectSetText(A_name_0, CharToStr(Ai_44), A_fontsize_16, "Wingdings", A_color_20);
   ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_24);
   ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_28);
   ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_32);
}

// 1295BD0766D450411297FF78E4068DA3
void f0_1(string As_0) {
   string name_12;
   int Li_8 = 0;
   while (Li_8 < ObjectsTotal()) {
      name_12 = ObjectName(Li_8);
      if (StringSubstr(name_12, 0, StringLen(As_0)) == As_0) ObjectDelete(name_12);
      else Li_8++;
   }
}
