Navigation:Home > Content >

HarmonicsTrader_v2.2~.mq4

Time: 2011-12-20 | Download file:HarmonicsTrader_v2.2~.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.438.1 [-]
   Website: https://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2012, HarmonicsTrader"
#property link      "http://www.HarmonicsTrader.com"

#import "HarmonicsTrader.dll"
   double ABCD(string a0, double a1, double a2);
   double POC(double a0, double a1, double a2, int a3);
   int POC2(double a0, double a1, double a2, double a3, double a4, double a5, int a6, int a7);
   string TFtext(int a0);
#import "wininet.dll"
   int InternetOpenA(string a0, int a1, string a2, string a3, int a4);
   int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5);
   int InternetReadFile(int a0, string a1, int a2, int& a3[]);
   int InternetCloseHandle(int a0);
#import

extern string _____SerialNumber_Info1_____ = "Enter your serial number for live trading";
extern string _____SerialNumber_Info2_____ = "Leave 0 for Demo or Strategy Tester";
extern string SerialNumber = "0";
extern string _______Enabled_Info1_______ = "Allow to open new Trades. If Disabled";
extern string _______Enabled_Info2_______ = "will still manage open Trades.";
extern bool Enabled = TRUE;
extern string _______NbrOfOrders_Info1_______ = "Max Number of Orders for each Pattern.";
extern string _______NbrOfOrders_Info2_______ = "Max = 5";
extern int NbrOfOrders = 5;
extern string ____Money_Management____ = "__________________________________";
extern string _______Risk_Info1_______ = "Risk % of account equity per found Pattern";
extern bool Use_Risk = TRUE;
extern double Risk = 1.5;
extern string _______Lots_Info1_______ = "If Use_Risk is set to \' false\' then";
extern string _______Lots_Info2_______ = "fixed Lot value for each Order.";
extern double Lots = 0.01;
extern string ___Use_RiskReward_Info1___ = "Skips or Adjusts the Order to R:R ...";
extern string ___Use_RiskReward_Info2___ = "... if R:R condition is not met.";
extern bool Use_RiskReward = TRUE;
extern string _______Reward_Info_______ = "R:R ratio. Risk of 1 to Reward of";
extern double Reward = 1.0;
extern string _______Skip_Info1______ = "Skip or adjust order? Set to \' false\' to...";
extern string _______Skip_Info2______ = "...adjust TP to meet R:R criterium.";
extern bool Skip = FALSE;
double gd_248 = 10.0;
double gd_256 = 20.0;
double gd_264 = 30.0;
double gd_272 = 40.0;
double gd_280 = 50.0;
extern string _______TP_Info1_______ = "TP at Percent of Retracement (leg C-D).";
extern string _______TP_Info2_______ = "Must be Ascending and > 0 !";
extern string _______TP_Info3_______ = "Percent =";
extern double TP_1 = 38.2;
extern double TP_2 = 50.0;
extern double TP_3 = 61.8;
extern double TP_4 = 100.0;
extern double TP_5 = 161.8;
extern string _______TR_Info1______ = "Start Trailing the Position at Percent=";
extern string _______TR_Info2______ = "Set to 0 to not trail the position.";
extern double TR_1 = 80.0;
extern double TR_2 = 70.0;
extern double TR_3 = 60.0;
extern double TR_4 = 50.0;
extern double TR_5 = 40.0;
extern string ___SetBreakEven_Info1___ = "Set to Break Even";
extern string ___SetBreakEven_Info2___ = "Trails all positions together with 1st position...";
extern string ___SetBreakEven_Info3___ = "...opened, if it has a trailing stop.";
extern bool SetBreakEven = TRUE;
extern string ___HighSpreadFilter_Info___ = "Open no trades when spread too high";
extern bool HighSpreadFilter = TRUE;
extern string SpreadLongPreriodTicks_Info1 = "Ticks to calculate average spread...";
extern string SpreadLongPreriodTicks_Info2 = "...for Long period? Ticks = ( max 10000 )";
extern int SpreadLongPreriodTicks = 10000;
extern string SpreadShortPreriodTicks_Info1 = "Ticks to calculate average spread...";
extern string SpreadShortPreriodTicks_Info2 = "...for Short period? Ticks = ( max 200 )";
extern int SpreadShortPreriodTicks = 60;
extern string PercShortHigherThanLong_Info1 = "% of \'Short period average spread\'  higher";
extern string PercShortHigherThanLong_Info2 = "than \'Long period average spread\' to ";
extern string PercShortHigherThanLong_Info3 = "activate the High Spread filter. Percent = ";
extern double PercShortHigherThanLong = 30.0;
extern string _______Other_Settings_______ = "_-_-_-_-_-_-_-_-_";
extern bool HedgingAllowed = TRUE;
extern color TextColor = Silver;
extern bool ShowSettings = TRUE;
extern string _______Sound_Info_______ = "Play Sound when orders are placed";
extern bool Sound = TRUE;
extern string _______Name_Info1_______ = "Name of Indicator Objects";
extern string _______Name_Info2_______ = "Do NOT change unless using other indi!";
extern string NameTriangle1 = "Triangle1_";
extern string NameTriangle2 = "Triangle2_";
extern string NamePRZ = "PointD_";
bool gi_592 = TRUE;
int g_objs_total_596;
int gi_600;
int gi_612;
int gi_616 = 15;
int g_y_620;
string gs_624 = "";
int gi_632;
double gda_636[200];
double gd_640 = 0.0;
double gd_648 = 0.0;
double gd_unused_656 = 0.0;
double gd_unused_664 = 0.0;
int gi_672 = 1;
int gi_676;
bool gi_680 = FALSE;
int gi_684;
double gda_688[10000];
double gd_692 = 0.0;
double gd_700 = 0.0;
double gd_unused_708 = 0.0;
double gd_unused_716 = 0.0;
int gi_724 = 1;
int gi_728;
bool gi_732 = FALSE;
bool gi_736 = FALSE;
int g_count_740 = 0;
string gs_744;
string gs_752;

int init() {
   double str2dbl_40;
   double str2dbl_48;
   double ld_56;
   string lsa_72[5];
   string lsa_76[5];
   string lsa_80[5];
   string text_84;
   string str_concat_92;
   string str_concat_100;
   string str_concat_108;
   string str_concat_116;
   string text_124;
   string text_132;
   color color_140;
   string dbl2str_0 = DoubleToStr(AccountNumber(), 0);
   string ls_8 = AccountCompany();
   string str_concat_16 = StringConcatenate(f0_12(TerminalPath(), "\\", "/"), "/experts/HarmonicsTrader_v2.2.ex4");
   string str_concat_24 = "";
   string ls_32 = "";
   if (IsDllsAllowed() == FALSE) {
      Alert("Please Check \"Allow DLL imports\". Expert cannot run.");
      gi_592 = FALSE;
      return;
   }
   if (IsDemo() == FALSE && IsTesting() == FALSE) {
      str_concat_24 = StringConcatenate("https://harmtrad.ipower.com/check.php?serial=", SerialNumber);
      f0_9(str_concat_24, ls_32);
      str2dbl_40 = StrToDouble(StringSubstr(ls_32, 0, StringLen(ls_32) - StringLen(dbl2str_0)));
      str2dbl_48 = StrToDouble(StringSubstr(ls_32, StringLen(ls_32) - StringLen(dbl2str_0)));
      ld_56 = ABCD(str_concat_16, str2dbl_40, str2dbl_48);
      if (DoubleToStr(str2dbl_48, 0) == dbl2str_0 && ld_56 == 0.0) {
         Comment("License OK");
         gi_592 = TRUE;
      } else {
         Alert("EA does not work! Possible reasons:\n 1. Serial Number ", SerialNumber, " does not match this Account Number!\nPlease go to http://www.harmonicstrader.com/activate.php to Activate the EA on this Account.\n 2. The integrity of the files has been compromised!");
         gi_592 = FALSE;
      }
   } else {
      str_concat_24 = StringConcatenate("https://harmtrad.ipower.com/checkdemo.php?account=", dbl2str_0, "&company=", ls_8);
      f0_9(str_concat_24, ls_32);
      ld_56 = ABCD(str_concat_16, 1, 1);
      if (ld_56 == 0.0) gi_592 = TRUE;
      else {
         Alert("The integrity of the files has been compromised!. EA does not work!");
         gi_592 = FALSE;
      }
      Comment("");
   }
   gs_624 = TFtext(Period());
   if (NbrOfOrders > 5) NbrOfOrders = 5;
   if (SpreadLongPreriodTicks > 10000) SpreadLongPreriodTicks = 10000;
   if (SpreadShortPreriodTicks > 200) SpreadShortPreriodTicks = 200;
   gi_728 = SpreadLongPreriodTicks;
   gi_676 = SpreadShortPreriodTicks;
   if (TR_1 > 99.0) TR_1 = 99;
   if (TR_2 > 99.0) TR_2 = 99;
   if (TR_3 > 99.0) TR_3 = 99;
   if (TR_4 > 99.0) TR_4 = 99;
   if (TR_5 > 99.0) TR_5 = 99;
   if (TP_1 > TP_2 || TP_2 > TP_3 || TP_3 > TP_4 || TP_4 > TP_5) {
      Alert("TP\'s must be in Ascending order!");
      gi_592 = FALSE;
   }
   if (TP_1 == 0.0 || TP_2 == 0.0 || TP_3 == 0.0 || TP_4 == 0.0 || TP_5 == 0.0) {
      Alert("TP\'s must be > 0!");
      gi_592 = FALSE;
   }
   g_y_620 = 70;
   int fontsize_68 = 9;
   if (ShowSettings == TRUE) {
      str_concat_92 = StringConcatenate("Max NbrOfOrders = ", NbrOfOrders);
      str_concat_100 = StringConcatenate("Lots = ", Lots);
      str_concat_108 = StringConcatenate("Risk = ", Risk, "%");
      str_concat_116 = StringConcatenate("R:R = 1:", Reward);
      if (Skip == TRUE) text_84 = "Skip Order";
      else text_84 = "Adjust Order";
      lsa_72[0] = StringConcatenate("PRZopen_1 = ", gd_248);
      lsa_72[1] = StringConcatenate("PRZopen_2 = ", gd_256);
      lsa_72[2] = StringConcatenate("PRZopen_3 = ", gd_264);
      lsa_72[3] = StringConcatenate("PRZopen_4 = ", gd_272);
      lsa_72[4] = StringConcatenate("PRZopen_5 = ", gd_280);
      lsa_76[0] = StringConcatenate("TP_1 at ", TP_1, "%");
      lsa_76[1] = StringConcatenate("TP_2 at ", TP_2, "%");
      lsa_76[2] = StringConcatenate("TP_3 at ", TP_3, "%");
      lsa_76[3] = StringConcatenate("TP_4 at ", TP_4, "%");
      lsa_76[4] = StringConcatenate("TP_5 at ", TP_5, "%");
      lsa_80[0] = StringConcatenate("TR_1 at ", TR_1, "%");
      lsa_80[1] = StringConcatenate("TR_2 at ", TR_2, "%");
      lsa_80[2] = StringConcatenate("TR_3 at ", TR_3, "%");
      lsa_80[3] = StringConcatenate("TR_4 at ", TR_4, "%");
      lsa_80[4] = StringConcatenate("TR_5 at ", TR_5, "%");
      text_124 = "-----------------------------";
      ObjectCreate("TextSeparator", OBJ_LABEL, 0, 0, 0);
      ObjectSet("TextSeparator", OBJPROP_CORNER, 3);
      ObjectSet("TextSeparator", OBJPROP_XDISTANCE, 10);
      ObjectSet("TextSeparator", OBJPROP_YDISTANCE, g_y_620);
      ObjectSetText("TextSeparator", text_124, fontsize_68, "Arial", TextColor);
      g_y_620 += gi_616;
      if (HighSpreadFilter == TRUE) {
         ObjectCreate("HighSpreadFilter", OBJ_LABEL, 0, 0, 0);
         ObjectSet("HighSpreadFilter", OBJPROP_CORNER, 3);
         ObjectSet("HighSpreadFilter", OBJPROP_XDISTANCE, 10);
         ObjectSet("HighSpreadFilter", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("HighSpreadFilter", "HighSpreadFilter ON", fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
      }
      if (SetBreakEven == TRUE) {
         ObjectCreate("SetBreakEven", OBJ_LABEL, 0, 0, 0);
         ObjectSet("SetBreakEven", OBJPROP_CORNER, 3);
         ObjectSet("SetBreakEven", OBJPROP_XDISTANCE, 10);
         ObjectSet("SetBreakEven", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("SetBreakEven", "SetBreakEven ON", fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
      }
      for (int li_64 = NbrOfOrders; li_64 > 0; li_64--) {
         ObjectCreate(StringConcatenate("TextTR_", li_64 - 1), OBJ_LABEL, 0, 0, 0);
         ObjectSet(StringConcatenate("TextTR_", li_64 - 1), OBJPROP_CORNER, 3);
         ObjectSet(StringConcatenate("TextTR_", li_64 - 1), OBJPROP_XDISTANCE, 10);
         ObjectSet(StringConcatenate("TextTR_", li_64 - 1), OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText(StringConcatenate("TextTR_", li_64 - 1), lsa_80[li_64 - 1], fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
      }
      for (li_64 = NbrOfOrders; li_64 > 0; li_64--) {
         ObjectCreate(StringConcatenate("TextTP_", li_64 - 1), OBJ_LABEL, 0, 0, 0);
         ObjectSet(StringConcatenate("TextTP_", li_64 - 1), OBJPROP_CORNER, 3);
         ObjectSet(StringConcatenate("TextTP_", li_64 - 1), OBJPROP_XDISTANCE, 10);
         ObjectSet(StringConcatenate("TextTP_", li_64 - 1), OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText(StringConcatenate("TextTP_", li_64 - 1), lsa_76[li_64 - 1], fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
      }
      if (Use_RiskReward == TRUE) {
         ObjectCreate("Skip", OBJ_LABEL, 0, 0, 0);
         ObjectSet("Skip", OBJPROP_CORNER, 3);
         ObjectSet("Skip", OBJPROP_XDISTANCE, 10);
         ObjectSet("Skip", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("Skip", text_84, fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
         ObjectCreate("RiskReward", OBJ_LABEL, 0, 0, 0);
         ObjectSet("RiskReward", OBJPROP_CORNER, 3);
         ObjectSet("RiskReward", OBJPROP_XDISTANCE, 10);
         ObjectSet("RiskReward", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("RiskReward", str_concat_116, fontsize_68, "Arial", TextColor);
         g_y_620 += gi_616;
      }
      if (Use_Risk == TRUE) {
         ObjectCreate("TextRisk", OBJ_LABEL, 0, 0, 0);
         ObjectSet("TextRisk", OBJPROP_CORNER, 3);
         ObjectSet("TextRisk", OBJPROP_XDISTANCE, 10);
         ObjectSet("TextRisk", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("TextRisk", str_concat_108, fontsize_68, "Arial", TextColor);
      } else {
         ObjectCreate("TextLots", OBJ_LABEL, 0, 0, 0);
         ObjectSet("TextLots", OBJPROP_CORNER, 3);
         ObjectSet("TextLots", OBJPROP_XDISTANCE, 10);
         ObjectSet("TextLots", OBJPROP_YDISTANCE, g_y_620);
         ObjectSetText("TextLots", str_concat_100, fontsize_68, "Arial", TextColor);
      }
      g_y_620 += gi_616;
      ObjectCreate("TextNbrOfOrders", OBJ_LABEL, 0, 0, 0);
      ObjectSet("TextNbrOfOrders", OBJPROP_CORNER, 3);
      ObjectSet("TextNbrOfOrders", OBJPROP_XDISTANCE, 10);
      ObjectSet("TextNbrOfOrders", OBJPROP_YDISTANCE, g_y_620);
      ObjectSetText("TextNbrOfOrders", str_concat_92, fontsize_68, "Arial", TextColor);
      g_y_620 += gi_616;
      ObjectCreate("TextSeparator4", OBJ_LABEL, 0, 0, 0);
      ObjectSet("TextSeparator4", OBJPROP_CORNER, 3);
      ObjectSet("TextSeparator4", OBJPROP_XDISTANCE, 10);
      ObjectSet("TextSeparator4", OBJPROP_YDISTANCE, g_y_620);
      ObjectSetText("TextSeparator4", text_124, fontsize_68, "Arial", TextColor);
      g_y_620 += gi_616;
      ObjectCreate("Settings", OBJ_LABEL, 0, 0, 0);
      ObjectSet("Settings", OBJPROP_CORNER, 3);
      ObjectSet("Settings", OBJPROP_XDISTANCE, 10);
      ObjectSet("Settings", OBJPROP_YDISTANCE, g_y_620);
      ObjectSetText("Settings", "SETTINGS", fontsize_68, "Arial", TextColor);
      g_y_620 += gi_616;
      ObjectCreate("TextSeparator5", OBJ_LABEL, 0, 0, 0);
      ObjectSet("TextSeparator5", OBJPROP_CORNER, 3);
      ObjectSet("TextSeparator5", OBJPROP_XDISTANCE, 10);
      ObjectSet("TextSeparator5", OBJPROP_YDISTANCE, g_y_620);
      ObjectSetText("TextSeparator5", text_124, fontsize_68, "Arial", TextColor);
      g_y_620 += gi_616;
   }
   if (Enabled == TRUE) {
      text_132 = "ENABLED";
      color_140 = Lime;
   } else {
      text_132 = "DISABLED";
      color_140 = Red;
   }
   ObjectCreate("Enabled", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Enabled", OBJPROP_CORNER, 1);
   ObjectSet("Enabled", OBJPROP_XDISTANCE, 10);
   ObjectSet("Enabled", OBJPROP_YDISTANCE, 40);
   ObjectSetText("Enabled", text_132, 10, "Arial", color_140);
   return (0);
}

int deinit() {
   if (ShowSettings == TRUE) {
      ObjectDelete("TextSeparator");
      ObjectDelete("TextSeparator4");
      ObjectDelete("TextSeparator5");
      ObjectDelete("TextLots");
      ObjectDelete("TextRisk");
      ObjectDelete("RiskReward");
      ObjectDelete("Skip");
      for (int li_0 = NbrOfOrders; li_0 > 0; li_0--) {
         ObjectDelete(StringConcatenate("TextTR_", li_0 - 1));
         ObjectDelete(StringConcatenate("TextTP_", li_0 - 1));
      }
      ObjectDelete("Settings");
      ObjectDelete("SetBreakEven");
      ObjectDelete("TextNbrOfOrders");
      ObjectDelete("HighSpreadFilter");
   }
   ObjectDelete("magicNumber");
   ObjectDelete("Enabled");
   ObjectDelete("totGroups");
   ObjectDelete("totPending");
   ObjectDelete("totPositions");
   ObjectDelete("objdesc");
   ObjectDelete("ProfitThis");
   ObjectDelete("ProfitSymb");
   ObjectDelete("ProfitTot");
   ObjectDelete("This");
   ObjectDelete("Symb");
   ObjectDelete("Tot");
   ObjectDelete("OrderValue");
   return (0);
}

int start() {
   double ld_8;
   string name_16;
   string ls_24;
   string str_concat_32;
   string ls_40;
   string str_concat_48;
   string ls_unused_56;
   int li_64;
   int li_68;
   int li_unused_72;
   int li_unused_76;
   int li_unused_80;
   double ld_84;
   double ld_92;
   double ld_100;
   double ld_108;
   double ld_116;
   double ld_124;
   double ld_132;
   double ld_140;
   double ld_148;
   double ld_156;
   double lda_172[5];
   double lda_176[5];
   double ld_180;
   double ld_192;
   string ls_220;
   string ls_228;
   color color_240;
   color color_244;
   color color_248;
   color color_252;
   color color_280;
   color color_284;
   color color_288;
   if (gi_592 == FALSE) Comment("Critical error. EA not working.");
   if (HighSpreadFilter == TRUE) {
      if (gi_680 == FALSE) gi_684 = gi_672;
      else {
         gi_684 = gi_676;
         gd_648 -= gda_636[gi_672 - 1];
      }
      gda_636[gi_672 - 1] = Ask - Bid;
      gd_648 += gda_636[gi_672 - 1];
      gd_640 = NormalizeDouble(gd_648 / gi_684, Digits);
      gi_672++;
      if (gi_672 == gi_676 + 1) {
         gi_672 = 1;
         gi_680 = TRUE;
      }
      if (gi_732 == FALSE) gi_632 = gi_724;
      else {
         gi_632 = gi_728;
         gd_700 -= gda_688[gi_724 - 1];
      }
      gda_688[gi_724 - 1] = Ask - Bid;
      gd_700 += gda_688[gi_724 - 1];
      gd_692 = gd_700 / gi_632;
      gi_724++;
      if (gi_724 == gi_728 + 1) {
         gi_724 = 1;
         gi_732 = TRUE;
      }
      if (gd_640 > gd_692 + gd_692 / 100.0 * PercShortHigherThanLong) {
         gi_736 = TRUE;
         Print("Spread too High! - Temporarily placing no new Orders.");
      } else gi_736 = FALSE;
   }
   bool li_188 = FALSE;
   li_188 = li_188 + MathAbs(StringGetChar(Symbol(), 0) * StringGetChar(Symbol(), 1) / StringGetChar(Symbol(), 2) * (StringGetChar(Symbol(), 3) * StringGetChar(Symbol(),
      4) / StringGetChar(Symbol(), 5)) + Period());
   li_188 = li_188 + MathAbs(StringGetChar(Symbol(), 0) * StringGetChar(Symbol(), 5) / StringGetChar(Symbol(), 3) * (StringGetChar(Symbol(), 2) * StringGetChar(Symbol(),
      1) / StringGetChar(Symbol(), 5)) + Period());
   ObjectCreate("magicNumber", OBJ_LABEL, 0, 0, 0);
   ObjectSet("magicNumber", OBJPROP_CORNER, 1);
   ObjectSet("magicNumber", OBJPROP_XDISTANCE, 10);
   ObjectSet("magicNumber", OBJPROP_YDISTANCE, 20);
   ObjectSetText("magicNumber", StringConcatenate("MagicNumber = ", DoubleToStr(li_188, 0)), 8, "Arial", TextColor);
   double icustom_0 = iCustom(NULL, 0, "iVAR", 5, 1000, 0, 0);
   for (g_objs_total_596 = ObjectsTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      name_16 = ObjectName(g_objs_total_596);
      if (StringFind(name_16, NameTriangle2) > -1) {
         if (StringFind(name_16, "Bull") > -1) {
            ls_24 = StringSubstr(name_16, StringFind(name_16, "Bull"));
            ls_24 = StringConcatenate("Bull ", StringSubstr(ls_24, 8));
         }
         if (StringFind(name_16, "Bear") > -1) {
            ls_24 = StringSubstr(name_16, StringFind(name_16, "Bear"));
            ls_24 = StringConcatenate("Bear ", StringSubstr(ls_24, 8));
         }
         gs_744 = ls_24;
         if (gs_752 != gs_744) g_count_740 = 0;
         gs_752 = gs_744;
      }
      if (StringFind(name_16, NameTriangle1) > -1) ld_192 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE1), Digits);
      if (StringFind(name_16, NamePRZ) > -1) {
         li_64 = ObjectGet(name_16, OBJPROP_TIME1);
         ld_84 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE1), Digits);
         li_68 = ObjectGet(name_16, OBJPROP_TIME2);
         ld_92 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE2), Digits);
         if (StringFind(ls_24, "Bull") > -1) {
            lda_172[0] = ld_92 - (ld_92 - ld_84) / 100.0 * gd_248;
            lda_172[1] = ld_92 - (ld_92 - ld_84) / 100.0 * gd_256;
            lda_172[2] = ld_92 - (ld_92 - ld_84) / 100.0 * gd_264;
            lda_172[3] = ld_92 - (ld_92 - ld_84) / 100.0 * gd_272;
            lda_172[4] = ld_92 - (ld_92 - ld_84) / 100.0 * gd_280;
            ld_124 = POC(ld_84, ld_92, ld_192, 1);
            ld_124 -= gd_640;
         }
         if (StringFind(ls_24, "Bear") > -1) {
            lda_172[0] = ld_84 + (ld_92 - ld_84) / 100.0 * gd_248;
            lda_172[1] = ld_84 + (ld_92 - ld_84) / 100.0 * gd_256;
            lda_172[2] = ld_84 + (ld_92 - ld_84) / 100.0 * gd_264;
            lda_172[3] = ld_84 + (ld_92 - ld_84) / 100.0 * gd_272;
            lda_172[4] = ld_84 + (ld_92 - ld_84) / 100.0 * gd_280;
            ld_124 = POC(ld_84, ld_92, ld_192, 2);
            ld_124 += gd_640;
         }
      }
      if (StringFind(name_16, NameTriangle2) > -1) {
         if (ObjectGet(name_16, OBJPROP_TIME3) < ObjectGet(name_16, OBJPROP_TIME2)) {
            li_unused_76 = ObjectGet(name_16, OBJPROP_TIME3);
            ld_108 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE3), Digits);
            li_unused_72 = ObjectGet(name_16, OBJPROP_TIME2);
            ld_100 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE2), Digits);
         } else {
            if (ObjectGet(name_16, OBJPROP_TIME3) > ObjectGet(name_16, OBJPROP_TIME2)) {
               li_unused_72 = ObjectGet(name_16, OBJPROP_TIME3);
               ld_100 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE3), Digits);
               li_unused_76 = ObjectGet(name_16, OBJPROP_TIME2);
               ld_108 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE2), Digits);
            }
         }
         li_unused_80 = ObjectGet(name_16, OBJPROP_TIME1);
         ld_116 = NormalizeDouble(ObjectGet(name_16, OBJPROP_PRICE1), Digits);
         if (StringFind(name_16, "Bull") > -1) {
            ld_156 = ld_108 - ld_100;
            lda_176[0] = ld_100 + ld_156 / 100.0 * TP_1;
            lda_176[1] = ld_100 + ld_156 / 100.0 * TP_2;
            lda_176[2] = ld_100 + ld_156 / 100.0 * TP_3;
            lda_176[3] = ld_100 + ld_156 / 100.0 * TP_4;
            lda_176[4] = ld_100 + ld_156 / 100.0 * TP_5;
            continue;
         }
         if (StringFind(name_16, "Bear") > -1) {
            ld_156 = ld_100 - ld_108;
            lda_176[0] = ld_100 - ld_156 / 100.0 * TP_1;
            lda_176[1] = ld_100 - ld_156 / 100.0 * TP_2;
            lda_176[2] = ld_100 - ld_156 / 100.0 * TP_3;
            lda_176[3] = ld_100 - ld_156 / 100.0 * TP_4;
            lda_176[4] = ld_100 - ld_156 / 100.0 * TP_5;
         }
      }
   }
   if (icustom_0 > 0.5 && NbrOfOrders > 3) gi_612 = 3;
   else gi_612 = NbrOfOrders;
   for (gi_600 = g_count_740 + 0; gi_600 < gi_612; gi_600++) {
      RefreshRates();
      ls_40 = StringSubstr(StringConcatenate(ls_24, ":::::::::::::::::::::::::::::"), 0, 14);
      str_concat_32 = StringConcatenate(gs_624, ls_40, "_", gi_600 - g_count_740);
      str_concat_48 = StringConcatenate(gs_624, ls_40);
      if (StringFind(ls_24, "Bull") > -1 && POC2(Bid, lda_172[gi_600], ld_84, TimeCurrent(), li_64, li_68, Period(), 1) == 1 && f0_3(str_concat_32, li_188) == 0 && Enabled == TRUE &&
         gi_736 == FALSE) {
         if (HedgingAllowed == FALSE && f0_1() == 1) break;
         ld_148 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point;
         ld_140 = ld_92 + 10.0 * Point + gd_640;
         if (Ask + ld_148 >= ld_140) ld_140 = Ask + ld_148 + 10.0 * Point;
         if (ld_140 - ld_124 <= ld_148) ld_124 = ld_140 - ld_148 - 30.0 * Point;
         if (Use_RiskReward == TRUE) {
            if ((lda_176[gi_600] - ld_140) / Reward < ld_140 - ld_124) {
               if (Skip == TRUE) {
                  g_count_740++;
                  continue;
               }
               lda_176[gi_600] = ld_140 + (ld_140 - ld_124) * Reward;
               if (lda_176[gi_600] > lda_176[gi_612 - 1]) break;
            }
         }
         if (gi_600 - g_count_740 > 0) {
            ld_180 = f0_6(str_concat_32, li_188);
            if (lda_176[gi_600] < ld_180) lda_176[gi_600] = ld_180 + 1.0 * Point;
         }
         if (lda_176[gi_600] - ld_140 <= ld_148) lda_176[gi_600] = ld_140 + ld_148 + 10.0 * Point + gd_640;
         switch (gi_600) {
         case 0:
            if (TR_1 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_1);
            else ld_132 = 0;
            break;
         case 1:
            if (TR_2 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_2);
            else ld_132 = 0;
            break;
         case 2:
            if (TR_3 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_3);
            else ld_132 = 0;
            break;
         case 3:
            if (TR_4 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_4);
            else ld_132 = 0;
            break;
         case 4:
            if (TR_5 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_5);
            else ld_132 = 0;
         }
         ld_8 = f0_10(MathRound((ld_140 - ld_124) / Point), gi_612 - g_count_740);
         if (ld_8 == 0.0) {
            ObjectCreate("OrderValue", OBJ_LABEL, 0, 0, 0);
            ObjectSet("OrderValue", OBJPROP_CORNER, 0);
            ObjectSet("OrderValue", OBJPROP_XDISTANCE, 10);
            ObjectSet("OrderValue", OBJPROP_YDISTANCE, 20);
            if (Use_Risk == TRUE) {
               ObjectSetText("OrderValue", StringConcatenate("NOT ENOUGH MONEY FOR ", Risk, " %!"), 16, "Arial", Red);
               break;
            }
            ObjectSetText("OrderValue", StringConcatenate("NOT ENOUGH MONEY FOR ", Lots, " LOTS!"), 16, "Arial", Red);
            break;
         }
         ObjectDelete("OrderValue");
         str_concat_32 = StringConcatenate(str_concat_32, "_", DoubleToStr(ld_132, Digits));
         f0_4(Symbol(), ld_8, ld_140, ld_124, lda_176[gi_600], str_concat_32, li_188, li_68 + 60 * Period() + 60);
      }
      if (StringFind(ls_24, "Bear") > -1 && POC2(Bid, lda_172[gi_600], ld_92, TimeCurrent(), li_64, li_68, Period(), 2) == 1 && f0_3(str_concat_32, li_188) == 0 && Enabled == TRUE &&
         gi_736 == FALSE) {
         if (HedgingAllowed == FALSE && f0_8() == 1) break;
         ld_148 = MarketInfo(Symbol(), MODE_STOPLEVEL) * Point;
         ld_140 = ld_84 - 10.0 * Point - gd_640;
         if (Bid - ld_148 <= ld_140) ld_140 = Bid - ld_148 - 10.0 * Point;
         if (ld_124 - ld_140 <= ld_148) ld_124 = ld_140 + ld_148 + 30.0 * Point;
         if (Use_RiskReward == TRUE) {
            if ((ld_140 - lda_176[gi_600]) / Reward < ld_124 - ld_140) {
               if (Skip == TRUE) {
                  g_count_740++;
                  continue;
               }
               lda_176[gi_600] = ld_140 - (ld_124 - ld_140) * Reward;
               if (lda_176[gi_600] < lda_176[gi_612 - 1]) break;
            }
         }
         if (gi_600 - g_count_740 > 0) {
            ld_180 = f0_6(str_concat_32, li_188);
            if (lda_176[gi_600] > ld_180) lda_176[gi_600] = ld_180 - 1.0 * Point;
         }
         if (ld_140 - lda_176[gi_600] <= ld_148) lda_176[gi_600] = ld_140 - ld_148 - 10.0 * Point - gd_640;
         switch (gi_600) {
         case 0:
            if (TR_1 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_1);
            else ld_132 = 0;
            break;
         case 1:
            if (TR_2 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_2);
            else ld_132 = 0;
            break;
         case 2:
            if (TR_3 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_3);
            else ld_132 = 0;
            break;
         case 3:
            if (TR_4 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_4);
            else ld_132 = 0;
            break;
         case 4:
            if (TR_5 > 0.0) ld_132 = MathAbs(ld_140 - lda_176[gi_600]) - MathAbs(ld_140 - lda_176[gi_600]) / 100.0 * (100 - TR_5);
            else ld_132 = 0;
         }
         ld_8 = f0_10(MathRound((ld_124 - ld_140) / Point), gi_612 - g_count_740);
         if (ld_8 == 0.0) {
            ObjectCreate("OrderValue", OBJ_LABEL, 0, 0, 0);
            ObjectSet("OrderValue", OBJPROP_CORNER, 0);
            ObjectSet("OrderValue", OBJPROP_XDISTANCE, 10);
            ObjectSet("OrderValue", OBJPROP_YDISTANCE, 20);
            if (Use_Risk == TRUE) {
               ObjectSetText("OrderValue", StringConcatenate("NOT ENOUGH MONEY FOR ", Risk, " %!"), 16, "Arial", Red);
               break;
            }
            ObjectSetText("OrderValue", StringConcatenate("NOT ENOUGH MONEY FOR ", Lots, " LOTS!"), 16, "Arial", Red);
            break;
         }
         ObjectDelete("OrderValue");
         str_concat_32 = StringConcatenate(str_concat_32, "_", DoubleToStr(ld_132, Digits));
         f0_0(Symbol(), ld_8, ld_140, ld_124, lda_176[gi_600], str_concat_32, li_188, li_68 + 60 * Period() + 60);
      }
   }
   if (SetBreakEven == TRUE) f0_11(li_188);
   f0_2(li_188);
   int count_208 = 0;
   int count_212 = 0;
   int count_216 = 0;
   for (int li_236 = 1; li_236 <= OrdersTotal(); li_236++) {
      if (OrderSelect(li_236 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == li_188) {
            if (OrderSymbol() == Symbol()) {
               if (OrderType() > OP_SELL) count_212++;
               if (OrderType() == OP_BUY || OrderType() == OP_SELL) count_216++;
               ls_220 = StringSubstr(OrderComment(), 0, 18);
               if (StringFind(ls_220, str_concat_48) != 0 || TimeCurrent() > li_68 + 60 * Period() + 60) {
                  f0_5(ls_220, li_188);
                  g_count_740 = 0;
               }
               if (ls_228 != ls_220) count_208++;
               ls_228 = ls_220;
            }
         }
      }
   }
   if (f0_13(str_concat_32, li_188) == 0) g_count_740 = 0;
   if (count_208 > 0) color_244 = Lime;
   else color_244 = TextColor;
   if (count_212 > 0) color_240 = Lime;
   else color_240 = TextColor;
   if (count_216 > 0) color_248 = Lime;
   else color_248 = TextColor;
   ObjectCreate("totGroups", OBJ_LABEL, 0, 0, 0);
   ObjectSet("totGroups", OBJPROP_CORNER, 3);
   ObjectSet("totGroups", OBJPROP_XDISTANCE, 10);
   ObjectSet("totGroups", OBJPROP_YDISTANCE, 50);
   ObjectSetText("totGroups", StringConcatenate("Groups ", count_208), 10, "Arial", color_244);
   ObjectCreate("totPending", OBJ_LABEL, 0, 0, 0);
   ObjectSet("totPending", OBJPROP_CORNER, 3);
   ObjectSet("totPending", OBJPROP_XDISTANCE, 10);
   ObjectSet("totPending", OBJPROP_YDISTANCE, 30);
   ObjectSetText("totPending", StringConcatenate("Pending ", count_212), 10, "Arial", color_240);
   ObjectCreate("totPositions", OBJ_LABEL, 0, 0, 0);
   ObjectSet("totPositions", OBJPROP_CORNER, 3);
   ObjectSet("totPositions", OBJPROP_XDISTANCE, 10);
   ObjectSet("totPositions", OBJPROP_YDISTANCE, 10);
   ObjectSetText("totPositions", StringConcatenate("Positions ", count_216), 10, "Arial", color_248);
   if (StringFind(ls_24, "Bull") > -1) color_252 = Lime;
   if (StringFind(ls_24, "Bear") > -1) color_252 = Red;
   ObjectCreate("objdesc", OBJ_LABEL, 0, 0, 0);
   ObjectSet("objdesc", OBJPROP_CORNER, 3);
   ObjectSet("objdesc", OBJPROP_XDISTANCE, 10);
   ObjectSet("objdesc", OBJPROP_YDISTANCE, g_y_620);
   ObjectSetText("objdesc", ls_24, 12, "Arial", color_252);
   double ld_256 = 0;
   double ld_264 = 0;
   double ld_272 = 0;
   for (li_236 = OrdersTotal(); li_236 >= 0; li_236--) {
      if (OrderSelect(li_236 - 1, SELECT_BY_POS) == TRUE) {
         ld_272 = ld_272 + OrderProfit() + OrderCommission() + OrderSwap();
         if (OrderSymbol() == Symbol()) {
            ld_264 = ld_264 + OrderProfit() + OrderCommission() + OrderSwap();
            if (OrderMagicNumber() == li_188) ld_256 = ld_256 + OrderProfit() + OrderCommission() + OrderSwap();
         }
      }
   }
   if (ld_256 > 0.0) color_280 = Lime;
   else {
      if (ld_256 < 0.0) color_280 = Red;
      else color_280 = TextColor;
   }
   if (ld_264 > 0.0) color_284 = Lime;
   else {
      if (ld_264 < 0.0) color_284 = Red;
      else color_284 = TextColor;
   }
   if (ld_272 > 0.0) color_288 = Lime;
   else {
      if (ld_272 < 0.0) color_288 = Red;
      else color_288 = TextColor;
   }
   string dbl2str_292 = DoubleToStr(ld_256, 2);
   string dbl2str_300 = DoubleToStr(ld_264, 2);
   string dbl2str_308 = DoubleToStr(ld_272, 2);
   ObjectCreate("This", OBJ_LABEL, 0, 0, 0);
   ObjectSet("This", OBJPROP_CORNER, 2);
   ObjectSet("This", OBJPROP_XDISTANCE, 10);
   ObjectSet("This", OBJPROP_YDISTANCE, 50);
   ObjectSetText("This", "This:", 10, "Arial", color_280);
   ObjectCreate("ProfitThis", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ProfitThis", OBJPROP_CORNER, 2);
   ObjectSet("ProfitThis", OBJPROP_XDISTANCE, 55);
   ObjectSet("ProfitThis", OBJPROP_YDISTANCE, 50);
   ObjectSetText("ProfitThis", dbl2str_292, 10, "Arial", color_280);
   ObjectCreate("Symb", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Symb", OBJPROP_CORNER, 2);
   ObjectSet("Symb", OBJPROP_XDISTANCE, 10);
   ObjectSet("Symb", OBJPROP_YDISTANCE, 30);
   ObjectSetText("Symb", "Symb:", 10, "Arial", color_284);
   ObjectCreate("ProfitSymb", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ProfitSymb", OBJPROP_CORNER, 2);
   ObjectSet("ProfitSymb", OBJPROP_XDISTANCE, 55);
   ObjectSet("ProfitSymb", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ProfitSymb", dbl2str_300, 10, "Arial", color_284);
   ObjectCreate("Tot", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Tot", OBJPROP_CORNER, 2);
   ObjectSet("Tot", OBJPROP_XDISTANCE, 10);
   ObjectSet("Tot", OBJPROP_YDISTANCE, 10);
   ObjectSetText("Tot", "Tot:", 10, "Arial", color_288);
   ObjectCreate("ProfitTot", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ProfitTot", OBJPROP_CORNER, 2);
   ObjectSet("ProfitTot", OBJPROP_XDISTANCE, 55);
   ObjectSet("ProfitTot", OBJPROP_YDISTANCE, 10);
   ObjectSetText("ProfitTot", dbl2str_308, 10, "Arial", color_288);
   return (0);
}

double f0_10(double ad_0, int ai_8) {
   double ld_28;
   double ld_12 = 0;
   double ld_ret_20 = Lots;
   if (Use_Risk == TRUE) {
      ld_28 = AccountEquity() * (Risk / 100.0 / ai_8);
      if (MarketInfo(Symbol(), MODE_TICKSIZE) != 0.0 && ad_0 != 0.0) ld_12 = MarketInfo(Symbol(), MODE_TICKVALUE) * (MarketInfo(Symbol(), MODE_POINT) / MarketInfo(Symbol(), MODE_TICKSIZE));
      if (ld_12 == 0.0) Print("Money Management Temporarily Disabled Due To Division By: ", ld_12);
      else ld_ret_20 = ld_28 / ld_12 / ad_0;
   }
   ld_ret_20 = MathMax(ld_ret_20, MarketInfo(Symbol(), MODE_MINLOT));
   ld_ret_20 = MathMin(ld_ret_20, MarketInfo(Symbol(), MODE_MAXLOT));
   if (MarketInfo(Symbol(), MODE_MARGINREQUIRED) != 0.0) ld_ret_20 = MathMin(ld_ret_20, 0.85 * (AccountEquity() / MarketInfo(Symbol(), MODE_MARGINREQUIRED)));
   if (ld_ret_20 < MarketInfo(Symbol(), MODE_MINLOT)) return (0);
   ld_ret_20 = MathCeil(ld_ret_20 / MarketInfo(Symbol(), MODE_LOTSTEP)) * MarketInfo(Symbol(), MODE_LOTSTEP);
   return (ld_ret_20);
}

void f0_4(string a_symbol_0, double a_lots_8, double a_price_16, double a_price_24, double a_price_32, string a_comment_40, int a_magic_48, int a_datetime_52) {
   int ticket_56;
   while (true) {
      RefreshRates();
      if (a_datetime_52 - TimeCurrent() < 680) a_datetime_52 = TimeCurrent() + 680;
      ticket_56 = OrderSend(a_symbol_0, OP_BUYSTOP, a_lots_8, a_price_16, 15, a_price_24, a_price_32, a_comment_40, a_magic_48, a_datetime_52, Blue);
      if (ticket_56 > 0) {
         if (Sound != TRUE) return;
         PlaySound("news.wav");
         return;
      }
      if (f0_7(GetLastError()) != 1) continue;
      break;
   }
   Print("Error with parameters: price = ", DoubleToStr(a_price_16, 5), " SL = ", DoubleToStr(a_price_24, 5), " TP = ", DoubleToStr(a_price_32, 5));
}

void f0_0(string a_symbol_0, double a_lots_8, double a_price_16, double a_price_24, double a_price_32, string a_comment_40, int a_magic_48, int a_datetime_52) {
   int ticket_56;
   while (true) {
      RefreshRates();
      if (a_datetime_52 - TimeCurrent() < 680) a_datetime_52 = TimeCurrent() + 680;
      ticket_56 = OrderSend(a_symbol_0, OP_SELLSTOP, a_lots_8, a_price_16, 15, a_price_24, a_price_32, a_comment_40, a_magic_48, a_datetime_52, Red);
      if (ticket_56 > 0) {
         if (Sound != TRUE) return;
         PlaySound("news.wav");
         return;
      }
      if (f0_7(GetLastError()) != 1) continue;
      break;
   }
   Print("Error with parameters: price = ", DoubleToStr(a_price_16, 5), " SL = ", DoubleToStr(a_price_24, 5), " TP = ", DoubleToStr(a_price_32, 5));
}

void f0_2(int a_magic_0) {
   int ticket_16;
   double order_takeprofit_20;
   double order_stoploss_28;
   double price_36;
   double order_open_price_44;
   bool li_52;
   double str2dbl_56;
   int cmd_12 = -1;
   for (g_objs_total_596 = 1; g_objs_total_596 <= OrdersTotal(); g_objs_total_596++) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_0) {
            if (OrderSymbol() == Symbol()) {
               ticket_16 = OrderTicket();
               cmd_12 = OrderType();
               order_open_price_44 = OrderOpenPrice();
               order_takeprofit_20 = OrderTakeProfit();
               order_stoploss_28 = OrderStopLoss();
               li_52 = FALSE;
               str2dbl_56 = StrToDouble(StringSubstr(OrderComment(), 21));
               if (str2dbl_56 != 0.0) {
                  switch (cmd_12) {
                  case OP_BUY:
                     if (!(NormalizeDouble(order_stoploss_28, Digits) < NormalizeDouble(Bid - str2dbl_56, Digits) && Bid >= order_open_price_44 + str2dbl_56)) break;
                     price_36 = Bid - str2dbl_56;
                     li_52 = TRUE;
                     break;
                  case OP_SELL:
                     if (!(NormalizeDouble(order_stoploss_28, Digits) > NormalizeDouble(Ask + str2dbl_56, Digits) && Ask <= order_open_price_44 - str2dbl_56)) break;
                     price_36 = Ask + str2dbl_56;
                     li_52 = TRUE;
                  }
                  if (li_52 != FALSE) {
                     OrderModify(ticket_16, order_open_price_44, price_36, order_takeprofit_20, 0);
                     if (GetLastError() > 0/* NO_ERROR */) Print("Error ", GetLastError(), " while Trailing Ticket ", ticket_16);
                  }
               }
            }
         }
      }
   }
}

void f0_11(int a_magic_0) {
   int ticket_16;
   double order_takeprofit_20;
   double order_stoploss_28;
   double price_36;
   double order_open_price_44;
   bool li_52;
   double str2dbl_56;
   string ls_64;
   string ls_72;
   int cmd_12 = -1;
   bool li_80 = FALSE;
   for (g_objs_total_596 = 1; g_objs_total_596 <= OrdersTotal(); g_objs_total_596++) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_0) {
            if (OrderSymbol() == Symbol()) {
               if (StrToDouble(StringSubstr(OrderComment(), 19, 1)) == 0.0) {
                  ls_64 = StringSubstr(OrderComment(), 0, 18);
                  str2dbl_56 = StrToDouble(StringSubstr(OrderComment(), 21));
                  if (str2dbl_56 != 0.0) li_80 = TRUE;
               }
            }
         }
      }
   }
   if (li_80 != FALSE) {
      for (g_objs_total_596 = 1; g_objs_total_596 <= OrdersTotal(); g_objs_total_596++) {
         if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
            if (OrderMagicNumber() == a_magic_0) {
               if (OrderSymbol() == Symbol()) {
                  ticket_16 = OrderTicket();
                  cmd_12 = OrderType();
                  order_open_price_44 = OrderOpenPrice();
                  order_takeprofit_20 = OrderTakeProfit();
                  order_stoploss_28 = OrderStopLoss();
                  li_52 = FALSE;
                  ls_72 = StringSubstr(OrderComment(), 0, 18);
                  if (ls_72 != ls_64) break;
                  switch (cmd_12) {
                  case OP_BUY:
                     if (!(NormalizeDouble(order_stoploss_28, Digits) < NormalizeDouble(Bid - str2dbl_56, Digits) && Bid >= order_open_price_44 + str2dbl_56)) break;
                     price_36 = Bid - str2dbl_56;
                     li_52 = TRUE;
                     break;
                  case OP_SELL:
                     if (!(NormalizeDouble(order_stoploss_28, Digits) > NormalizeDouble(Ask + str2dbl_56, Digits) && Ask <= order_open_price_44 - str2dbl_56)) break;
                     price_36 = Ask + str2dbl_56;
                     li_52 = TRUE;
                  }
                  if (li_52 != FALSE) {
                     OrderModify(ticket_16, order_open_price_44, price_36, order_takeprofit_20, 0);
                     if (GetLastError() > 0/* NO_ERROR */) Print("Error ", GetLastError(), " while Trailing Ticket ", ticket_16);
                  }
               }
            }
         }
      }
   }
}

int f0_3(string as_0, int a_magic_8) {
   int count_12 = 0;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_8) {
            if (OrderSymbol() == Symbol())
               if (StringSubstr(OrderComment(), 0, 20) == as_0) count_12++;
         }
      }
   }
   if (count_12 > 0) return (1);
   return (0);
}

int f0_8() {
   int count_0 = 0;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderSymbol() == Symbol())
            if (OrderType() == OP_BUY) count_0++;
      }
   }
   if (count_0 > 0) return (1);
   return (0);
}

int f0_1() {
   int count_0 = 0;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderSymbol() == Symbol())
            if (OrderType() == OP_SELL) count_0++;
      }
   }
   if (count_0 > 0) return (1);
   return (0);
}

double f0_6(string as_0, int a_magic_8) {
   double order_takeprofit_12;
   int str2dbl_20 = StrToDouble(StringSubstr(as_0, 19, 1));
   int li_24 = str2dbl_20 - 1;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_8) {
            if (OrderSymbol() == Symbol()) {
               if (StringSubstr(OrderComment(), 0, 19) == StringSubstr(as_0, 0, 19))
                  if (StrToDouble(StringSubstr(OrderComment(), 19, 1)) == li_24) order_takeprofit_12 = OrderTakeProfit();
            }
         }
      }
   }
   return (order_takeprofit_12);
}

void f0_5(string as_0, int a_magic_8) {
   int error_12;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_8) {
            if (OrderSymbol() == Symbol()) {
               if (StringFind(OrderComment(), as_0) != -1) {
                  if (OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP) {
                     OrderDelete(OrderTicket());
                     error_12 = GetLastError();
                     if (error_12 == 145/* TRADE_MODIFY_DENIED */) {
                        Sleep(5000);
                        RefreshRates();
                        OrderDelete(OrderTicket());
                     }
                     if (error_12 > 0/* NO_ERROR */) Print("Close Pending Error: ", error_12);
                  }
               }
            }
         }
      }
   }
}

int f0_7(int ai_0) {
   switch (ai_0) {
   case 4:
      Print("Trade server is busy. Trying once again..");
      Sleep(3000);
      return (1);
   case 130:
      Print("Wrong stops. Retrying.");
      RefreshRates();
      return (1);
   case 135:
      Print("Price changed. Trying once again..");
      RefreshRates();
      return (1);
   case 136:
      Print("No prices. Waiting for a new tick..");
      while (RefreshRates() == FALSE) Sleep(1);
      return (1);
   case 137:
      Print("Broker is busy. Trying once again........");
      Sleep(3000);
      return (1);
   case 146:
      Print("Trading subsystem is busy. Trying once again..");
      Sleep(500);
      return (1);
   case 2:
      Alert("Common error.");
      return (0);
   case 5:
      Alert("Old terminal version.");
      gi_592 = FALSE;
      return (0);
   case 64:
      Alert("Account blocked.");
      gi_592 = FALSE;
      return (0);
   case 133:
      Alert("Trading forbidden.");
      return (0);
   case 134:
      Alert("Not enough money to execute operation.");
      return (0);
   }
   Alert("Error occurred: ", ai_0);
   return (0);
}

int f0_9(string as_0, string &a_str_concat_8) {
   int li_16 = InternetOpenA("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)", 0, "0", "0", 0);
   int li_20 = InternetOpenUrlA(li_16, as_0, "0", 0, -2080374528, 0);
   if (li_20 == 0) return (0);
   int lia_24[] = {1};
   string ls_28 = "";
   while (true) {
      if (InternetReadFile(li_20, ls_28, 128, lia_24) <= 0 || lia_24[0] == 0) break;
      a_str_concat_8 = StringConcatenate(a_str_concat_8, StringSubstr(ls_28, 0, lia_24[0]));
   }
   InternetCloseHandle(li_20);
   InternetCloseHandle(li_16);
   return (1);
}

string f0_12(string as_0, string as_8, string as_16) {
   int li_28;
   string ls_32;
   string ls_40;
   int str_len_24 = StringLen(as_8);
   string ls_ret_48 = as_0;
   while (true) {
      li_28 = StringFind(ls_ret_48, as_8);
      if (li_28 == -1) break;
      if (li_28 == 0) ls_32 = "";
      else ls_32 = StringSubstr(ls_ret_48, 0, li_28);
      ls_40 = StringSubstr(ls_ret_48, li_28 + str_len_24);
      ls_ret_48 = ls_32 + as_16 + ls_40;
   }
   return (ls_ret_48);
}

int f0_13(string as_0, int a_magic_8) {
   int count_12 = 0;
   for (g_objs_total_596 = OrdersTotal(); g_objs_total_596 >= 0; g_objs_total_596--) {
      if (OrderSelect(g_objs_total_596 - 1, SELECT_BY_POS) == TRUE) {
         if (OrderMagicNumber() == a_magic_8) {
            if (OrderSymbol() == Symbol())
               if (StringSubstr(OrderComment(), 0, 18) == StringSubstr(as_0, 0, 18)) count_12++;
         }
      }
   }
   if (count_12 > 0) return (1);
   return (0);
}

Recommend