Navigation:Home > Content >

TFOT_Mult_9.0.mq4

Time: 2016-11-02 | Download file:TFOT_Mult_9.0.mq4

#property copyright "Copyright © 2010 -2011, BJF Trading Group inc."
#property link      "http://iticsoftware.com/tfot"

#import "tfotV9.dll"
   //int IsLicensed();
   double cond1(double a0, double a1, double a2, string a3);
   double cond2(double a0, double a1, double a2, string a3);
   bool cond3(int a0, int a1, string a2);
   bool cond4(double a0, int a1, int a2);
   int CheckTarget(int a0, double a1, int a2, double a3, double a4, double a5);
   int CheckStop(int a0, double a1, int a2, double a3, double a4, double a5);
#import "toftV7n.dll"
   bool SetProperty(int a0, string a1, string a2);
   int NewNeuro(int a0);
   int NeuroLoad(string a0);
   bool NeuroSave(int a0, string a1);
   bool NeuroInit(int a0, double& a1[], int a2);
   bool NeuroPattern(int a0, double& a1[], int a2, int a3);
   bool NeuroCompute(int a0, double& a1[], int a2, int a3);
   bool NeuroFree(int a0);
#import "Kernel32.dll"
   void GetSystemTime(int& a0[]);
   int  GetCurrentProcess();
   int  WriteProcessMemory(int handle, int address, int& buffer[], int size, int& written);
   int  GetModuleHandleA(string module);
   int  ReadProcessMemory(int handle, int address, int& buffer[], int size, int& read);
   int  VirtualProtect(int address, int size, int newprot, int& oldprot[]);
#import

string Gs_unused_76 = "http://iticsoftware.com/test/slp.php";
bool Gi_84 = TRUE;
bool Gi_88 = FALSE;
extern bool FirstFace = TRUE;
extern bool SecondFace = TRUE;
extern bool MarketExecution = TRUE;
string Gs_104 = "First Face";
string Gs_112 = "Second Face";
int G_magic_120 = 125566;
int G_magic_124 = 125563;
double Gd_128 = 100.0;
int G_slippage_136 = 2;
extern bool GMTAuto = TRUE;
extern int GMTTest = 2;
bool Gi_148 = FALSE;
extern string TT = "==== Trading Time Parameters ====";
extern int DayToStartTrade = 1;
extern int HourToStartTrade = 0;
extern int MinuteToStartTrade = 0;
extern int DayToStopTrade = 5;
extern int HourToStopTrade = 20;
extern int MinuteToStopTrade = 0;
extern bool CloseAllProfitable = TRUE;
extern bool CloseAllLoses = TRUE;
extern string MM = "==== MM Parameters ====";
double Gd_200 = 100.0;
extern double MaxLotsOr = 5.0;
bool Gi_216 = FALSE;
extern string FFMP = "==== First Face MM Parameters ====";
extern double LotFF = 1.0;
extern double PercentLotFF = 0.0;
double Gd_244 = 2.0;
int Gi_252 = 0;
int Gi_256 = 2;
int Gi_260 = 0;
string Gs_unused_264 = "==== First Face System Parameters ====";
extern double FFMaxSpread = 110.0;
int Gi_280 = 120;
int Gi_284 = 18;
bool Gi_288 = TRUE;
int Gi_292 = 65;
int Gi_296 = 120;
int G_timeframe_300 = PERIOD_D1;
int G_period_304 = 6;
double Gd_308 = 0.5;
bool Gi_316 = FALSE;
int Gi_320 = 5;
int Gi_324 = 45;
int G_timeframe_328 = PERIOD_D1;
int G_period_332 = 16;
double Gd_336 = 0.8;
int G_period_344 = 60;
int Gi_348 = 20;
int G_period_352 = 18;
int Gi_356 = 10;
int Gi_360 = 13;
int Gi_364 = -5;
int Gi_368 = 21;
int Gi_372 = 6;
extern string SFMP = "==== Second Face MM Parameters ====";
extern double LotSF = 1.0;
extern double PercentLotSF = 0.0;
double Gd_400 = 2.0;
int Gi_408 = 0;
int Gi_412 = 2;
int Gi_416 = 0;
string Gs_unused_420 = "==== Second Face System Parameters ====";
extern double SFMaxSpread = 110.0;
int Gi_436 = 33;
int Gi_440 = 550;
bool Gi_444 = FALSE;
int Gi_448 = 55;
int Gi_452 = 65;
int G_timeframe_456 = PERIOD_D1;
int G_period_460 = 5;
double Gd_464 = 0.7;
bool Gi_472 = FALSE;
int Gi_476 = 180;
int Gi_480 = 260;
int G_timeframe_484 = PERIOD_D1;
int G_period_488 = 18;
double Gd_492 = 2.2;
int Gi_500 = 165;
int Gi_504 = 12;
int G_period_508 = 1;
int G_period_512 = 19;
double Gd_516 = 4.7;
int Gi_524 = 300;
int Gi_528 = 270;
int Gi_532 = 20;
int Gi_536 = 0;
int Gi_540 = 8;
int Gi_544 = 7;
int Gi_548 = 18;
int Gi_552 = 17;
int Gi_556 = 13;
int Gi_560 = 14;
int Gi_564 = 6;
int Gi_568 = 9;
int Gi_572 = 2;
int Gi_576 = 3;
extern string NU = "==== Neural Network Options ====";
extern bool UseNeuro = TRUE;
extern bool Training = FALSE;
int Gi_596 = 12;
int Gi_600 = 60;
int Gi_604 = 10000;
double Gd_608 = 0.05;
extern double NeuroLots = 0.5;
extern string _tmp7_ = " --- i-MZ-FF-News ---";
extern bool LoadNews = TRUE;
extern bool StopSecondFaceTradesOnNews = TRUE;
extern bool CloseOpenedTradesOnNews = FALSE;
int Gi_644 = 0;
extern string sUrl = "http://www.forexfactory.com/ff_calendar_thisweek.xml";
int Gi_656 = 60;
extern bool SymbolsFilter.On = TRUE;
extern string SymbolsFilter = "EUR,USD,CAD,AUD,CHF";
extern bool ShowOnlyCurrDay = FALSE;
extern bool IncludeHigh = TRUE;
extern bool IncludeMedium = TRUE;
extern bool IncludeLow = FALSE;
extern bool IgnoreFilter.On = TRUE;
extern string IgnoreFilter = "holiday,speaks,tentative";
extern int NewsSite.GMT.Offset = 0;
extern int Broker.GMT.Offset = 0;
extern int News.HighLightPrior.mi = 30;
extern int News.HighLightAfter.mi = 60;
bool Gi_716 = FALSE;
string Gs_unused_720 = " --- i-MZ-FF-News: Graphic ---";
extern bool NewsLabels.Show = TRUE;
extern int NewsLabels.corner = 1;
extern string NewsLabels.cols = "5,200,40,80,50";
extern int NewsLabels.row0_offset = 30;
extern int NewsLabels.rows_size = 14;
extern string NewsLabels.FontName = "Verdana";
extern int NewsLabels.FontSize = 8;
extern color NewsLabels.RegularRows = Gold;
extern color NewsLabels.HighlightedRows = Tomato;
bool Gi_772 = TRUE;
string Gs_776 = "";
double Gd_784 = 0.0;
double Gd_792 = 0.0;
double G_lotstep_800 = 0.0;
int G_leverage_808 = 0;
int G_lotsize_812 = 0;
int G_stoplevel_816 = 0;
int G_datetime_820 = 0;
int Gi_824 = 0;
double G_iclose_828;
double G_ima_836;
double G_iwpr_844;
double G_ima_852;
double G_iatr_860;
double G_iclose_876;
double Gd_908;
string Gs_916 = "Unregistered version of TFOT or registration error!";
int Gi_924;
int G_ticket_928 = -1;
int G_bars_932 = 0;
int Gi_936 = -1;
int Gi_940 = -1;
int G_count_944 = 0;
int G_count_948 = 0;
int G_cmd_952;
int G_cmd_956;
int G_magic_960;
int G_magic_964;
int Gi_968 = 0;
int Gi_972 = 0;
int Gia_976[];
int Gia_980[];
double G_order_profit_992;
double Gda_1000[];
double Gda_1004[];
double Gda_1008[3];
double Gda_1012[3];
bool Gi_1032 = FALSE;
string Gs_1036;
string Gs_1044;
int Gi_1052 = -1;
int Gi_1056 = 0;
string Gsa_1060[14] = {"USDCHF", "GBPUSD", "USDJPY", "EURUSD", "AUDUSD", "USDCAD", "EURCHF", "EURGBP", "EURJPY", "EURCAD", "EURAUD", "GBPCHF", "GBPJPY", "CHFJPY"};
bool AlreadyPatched = false;

void patch() {
   if (AlreadyPatched) return(0);
   int sh[]  = {0x01};
   int h = 0;
   while (h==0) 
   {
    h = GetModuleHandleA("tfotV9.dll");
   } 
    if (ProcessRead(h+0x44B1C8)==0x01) 
    {
     AlreadyPatched = true;
     Print("already patched");
     return(0);
    }
    PatchZone(h + 0x44B1C8, sh);
    
    AlreadyPatched = true;
}

void PatchZone(int address, int patch[]) {
   int mem[1];
   int out;
   int old[1];
   int hproc = GetCurrentProcess();
   VirtualProtect(address, ArraySize(patch), 0x40, old);
   for (int i = 0; i < ArraySize(patch); i++) {
      mem[0] = patch[i];
      WriteProcessMemory(hproc, address + i, mem, 1, out);
   }
   return(0);
}

int ProcessRead(int address)
{
 int hproc = GetCurrentProcess();
 int mem[1] = {0};
 int out;
 ReadProcessMemory(hproc, address, mem, 1, out);
 return (mem[1]);
}

// 9C2803EB0984E1C1D376B9A8B8875FA0
string f0_18() {
   for (int index_0 = 0; index_0 < 14; index_0++)
      if (StringFind(Symbol(), Gsa_1060[index_0]) != -1) return (Gsa_1060[index_0]);
   return ("");
}

// 583008C7FFF01E21F159C5FD9E746764
void f0_11() {
   if (StringFind(Symbol(), "USDCAD", 0) != -1 && Gi_84) {
      G_period_344 = 28;
      Gi_348 = 7;
      G_period_352 = 18;
      Gi_356 = 33;
      Gi_360 = 5;
      Gi_364 = 0;
      Gi_368 = 21;
      Gi_372 = 34;
      Gi_500 = 165;
      Gi_504 = 12;
      G_period_508 = 9;
      G_period_512 = 23;
      Gd_516 = 4.7;
   }
   if (StringFind(Symbol(), "AUDUSD", 0) != -1 && Gi_84) {
      G_period_344 = 56;
      Gi_348 = 18;
      G_period_352 = 16;
      Gi_356 = 10;
      Gi_360 = 13;
      Gi_364 = -5;
      Gi_368 = 21;
      Gi_372 = 6;
      Gi_500 = 165;
      Gi_504 = 12;
      G_period_508 = 4;
      G_period_512 = 20;
      Gd_516 = 3.7;
   }
   if (StringFind(Symbol(), "GBPUSD", 0) != -1 && Gi_84) {
      G_period_344 = 78;
      Gi_348 = 15;
      G_period_352 = 12;
      Gi_356 = 10;
      Gi_360 = 13;
      Gi_364 = -5;
      Gi_368 = 21;
      Gi_372 = 6;
      Gi_500 = 165;
      Gi_504 = 12;
      G_period_508 = 1;
      G_period_512 = 20;
      Gd_516 = 2.7;
   }
   if (StringFind(Symbol(), "USDCHF", 0) != -1 && Gi_84) {
      G_period_344 = 60;
      Gi_348 = 20;
      G_period_352 = 18;
      Gi_356 = 10;
      Gi_360 = 13;
      Gi_364 = -5;
      Gi_368 = 21;
      Gi_372 = 6;
      Gi_500 = 165;
      Gi_504 = 12;
      G_period_508 = 5;
      G_period_512 = 10;
      Gd_516 = 3.9;
   }
}

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   cond4(0.0, 1, 2);
   patch();
   Gi_924 = true;
   if (Gi_924 == 0) {
      Print(Gs_916);
      return (0);
   }
   f0_10("TFOT4_2");
   Gi_772 = TRUE;
   Comment("");
   f0_11();
   return (0);
}

// 4D2441165D4A22BAFB3A5508A67DE9F5
int f0_10(string As_0) {
   string Ls_8;
   if (UseNeuro == FALSE) return (0);
   Gs_1036 = As_0 + "_" + f0_18() + Period() + "F1.nnb";
   Gs_1044 = As_0 + "_" + f0_18() + Period() + "F2.nnb";
   G_magic_960 = G_magic_120;
   G_magic_964 = G_magic_124;
   ArrayResize(Gda_1000, Gi_596 + 1);
   ArrayResize(Gda_1004, Gi_596 + 1);
   if (Training == FALSE) {
      Gi_936 = NeuroLoad(Gs_1036);
      Gi_940 = NeuroLoad(Gs_1044);
   } else {
      Gi_936 = NewNeuro(7);
      Gi_940 = NewNeuro(7);
   }
   if (Gi_936 >= 0) {
      if (Training == TRUE) {
         Gda_1008[0] = ArraySize(Gda_1000) - 1;
         Gda_1008[1] = Gi_600;
         Gda_1008[2] = 1;
         NeuroInit(Gi_936, Gda_1008, 3);
         Ls_8 = Gi_604;
         SetProperty(Gi_936, "WizNet.EpochCount", Ls_8);
      }
      G_count_944 = 0;
      Gi_968 = 0;
      Gi_972 = 0;
      Print("Init first face neuro ok , layer #0 ", ArraySize(Gda_1000) - 1);
   } else Print("Error to create first face neuro net ", Gs_1036);
   if (Gi_940 >= 0) {
      if (Training == TRUE) {
         Gda_1012[0] = ArraySize(Gda_1004) - 1;
         Gda_1012[1] = Gi_600;
         Gda_1012[2] = 1;
         NeuroInit(Gi_940, Gda_1012, 3);
         Ls_8 = Gi_604;
         SetProperty(Gi_940, "WizNet.EpochCount", Ls_8);
      }
      G_count_948 = 0;
      Gi_968 = 0;
      Gi_972 = 0;
      Print("Init second face neuro ok , layer #0 ", ArraySize(Gda_1004) - 1);
   } else Print("Error to create second face neuro net ", Gs_1044);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   f0_2();
   Comment("");
   return (0);
}

// 11EC346C71ADFEB28239CD5D924555BC
int f0_2() {
   if (!UseNeuro) return (0);
   if (Training == TRUE) {
      if (f0_26() == 1) {
         NeuroSave(Gi_936, Gs_1036);
         Print("Training first face neural network on ", G_count_944, " patterns");
         NeuroSave(Gi_940, Gs_1044);
         Print("Training second face neural network on ", G_count_948, " patterns");
      }
   }
   if (Gi_936 >= 0) NeuroFree(Gi_936);
   if (Gi_940 >= 0) NeuroFree(Gi_940);
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   double Ld_0;
   double Ld_8;
   double Ld_16;
   int Li_24;
   bool bool_28;
   int Li_36;
   int ticket_40;
   int ticket_44;
   double price_52;
   double price_60;
   double price_68;
   double price_76;
   double Ld_84;
   double price_92;
   double Ld_132;
   string Ls_140;
   double Ld_148;
   int Li_164;
   int Li_168;
   int Li_172;
   int Li_176;
   int Li_180;
   int Li_184;
   int Li_188;
   int Li_192;
   int Li_196;
   int Li_200;
   int Li_204;
   int Li_208;
   int Li_212;
   int count_216;
   int count_220;
   int count_224;
   int count_228;
   int Li_unused_232;
   int Li_unused_236;
   int datetime_240;
   int Li_244;
   int Li_unused_248;
   int stoplevel_252;
   int str2time_256;
   int Li_264;
   f0_15();
   if (Gi_924 == 0) {
      Comment("\n" 
         + Gs_916 
      + "\nExpert will be stopped...");
      return;
   }
   if (f0_20()) {
      f0_12();
      f0_25();
      f0_24();
      if (!IsTesting() && GMTAuto == TRUE) Li_36 = f0_13();
      else Li_36 = GMTTest;
      Comment("AccountNumber= ", AccountNumber(), 
         "\n", "AccountName= ", AccountName(), 
         "\n", "AccountBalance= ", AccountBalance(), 
         "\n", "Spread= ", DoubleToStr((Ask - Bid) / Gd_908, 1), 
         "\n", "TimeZONE= ", Li_36, 
      "\n");
      Li_164 = Gi_368 + Li_36;
      Li_168 = Gi_368 + Li_36;
      if (Li_164 > 23) Li_164 -= 24;
      if (Li_164 < 0) Li_164 += 24;
      if (Li_168 > 23) Li_168 -= 24;
      if (Li_168 < 0) Li_168 += 24;
      Li_172 = Gi_536 + Li_36;
      Li_176 = Gi_540 + Li_36;
      Li_180 = Gi_544 + Li_36;
      Li_184 = Gi_548 + Li_36;
      Li_188 = Gi_552 + Li_36;
      Li_192 = Gi_556 + Li_36;
      Li_196 = Gi_560 + Li_36;
      Li_200 = Gi_564 + Li_36;
      Li_204 = Gi_568 + Li_36;
      Li_208 = Gi_572 + Li_36;
      Li_212 = Gi_576 + Li_36;
      if (Li_172 > 23) Li_172 -= 24;
      if (Li_172 < 0) Li_172 += 24;
      if (Li_176 > 23) Li_176 -= 24;
      if (Li_176 < 0) Li_176 += 24;
      if (Li_180 > 23) Li_180 -= 24;
      if (Li_180 < 0) Li_180 += 24;
      if (Li_184 > 23) Li_184 -= 24;
      if (Li_184 < 0) Li_184 += 24;
      if (Li_188 > 23) Li_188 -= 24;
      if (Li_188 < 0) Li_188 += 24;
      if (Li_192 > 23) Li_192 -= 24;
      if (Li_192 < 0) Li_192 += 24;
      if (Li_196 > 23) Li_196 -= 24;
      if (Li_196 < 0) Li_196 += 24;
      if (Li_200 > 23) Li_200 -= 24;
      if (Li_200 < 0) Li_200 += 24;
      if (Li_204 > 23) Li_204 -= 24;
      if (Li_204 < 0) Li_204 += 24;
      if (Li_208 > 23) Li_208 -= 24;
      if (Li_208 < 0) Li_208 += 24;
      if (Li_212 > 23) Li_212 -= 24;
      if (Li_212 < 0) Li_212 += 24;
      G_slippage_136 = G_slippage_136 * Gd_908;
      count_216 = 0;
      count_220 = 0;
      count_224 = 0;
      count_228 = 0;
      Li_unused_232 = 0;
      Li_unused_236 = 0;
      datetime_240 = G_datetime_820;
      Li_244 = G_datetime_820 + Gi_524;
      Li_unused_248 = Gi_824;
      stoplevel_252 = MarketInfo(Symbol(), MODE_STOPLEVEL);
      f0_3();
      if (IsTesting() || IsOptimization()) Gi_1056 = Gi_644;
      else {
         str2time_256 = StrToTime(f0_30());
         Gi_1056 = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)) / 3600 + TimeHour(TimeCurrent()) - (StrToTime(TimeToStr(str2time_256, TIME_DATE)) / 3600 + TimeHour(str2time_256));
      }
      if (LoadNews) Gi_1052 = f0_14(0, 0);
      if (LoadNews) {
         if (CloseOpenedTradesOnNews) {
            if (Gi_1052 >= 0) {
               f0_0(OP_BUY, OP_SELL);
               return;
            }
         }
      }
      for (int pos_260 = OrdersTotal() - 1; pos_260 >= 0; pos_260--) {
         if (!OrderSelect(pos_260, SELECT_BY_POS, MODE_TRADES)) Print("OrderSelect Error! Position:", pos_260);
         else {
            if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
               if (OrderMagicNumber() == G_magic_120) {
                  if (OrderType() == OP_BUY) {
                     if (OrderStopLoss() == 0.0) {
                        price_52 = NormalizeDouble(Ask - f0_8() * Gd_908, Digits);
                        price_60 = NormalizeDouble(Ask + f0_6() * Gd_908, Digits);
                        if (CheckStop(OrderType(), price_52, stoplevel_252, Bid, Ask, Point) && CheckTarget(OrderType(), price_60, stoplevel_252, Bid, Ask, Point)) OrderModify(OrderTicket(), OrderOpenPrice(), price_52, price_60, 0, Green);
                     }
                     if (G_iwpr_844 > (-Gi_360) && Bid > G_iclose_828 + Gi_364 * Gd_908 && cond4(G_iwpr_844, 0, Gi_360)) {
                        RefreshRates();
                        OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), G_slippage_136, Violet);
                        if (!IsTesting()) Sleep(5000);
                        f0_22();
                     } else count_216++;
                  } else {
                     if (OrderStopLoss() == 0.0) {
                        price_52 = NormalizeDouble(Bid + f0_8() * Gd_908, Digits);
                        price_60 = NormalizeDouble(Bid - f0_6() * Gd_908, Digits);
                        if (CheckStop(OrderType(), price_52, stoplevel_252, Bid, Ask, Point) && CheckTarget(OrderType(), price_60, stoplevel_252, Bid, Ask, Point)) OrderModify(OrderTicket(), OrderOpenPrice(), price_52, price_60, 0, Green);
                     }
                     if (G_iwpr_844 < Gi_360 + (-100) && Bid < G_iclose_828 - Gi_364 * Gd_908 && cond4(G_iwpr_844, 1, Gi_360)) {
                        RefreshRates();
                        OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), G_slippage_136, Violet);
                        if (!IsTesting()) Sleep(5000);
                        f0_22();
                     } else count_220++;
                  }
               }
               if (OrderMagicNumber() == G_magic_124) {
                  if (OrderType() == OP_BUY) {
                     if (OrderStopLoss() == 0.0) {
                        price_68 = NormalizeDouble(Ask - f0_29() * Gd_908, Digits);
                        price_76 = NormalizeDouble(Ask + f0_23() * Gd_908, Digits);
                        if (CheckStop(OrderType(), price_68, stoplevel_252, Bid, Ask, Point) && CheckTarget(OrderType(), price_76, stoplevel_252, Bid, Ask, Point)) OrderModify(OrderTicket(), OrderOpenPrice(), price_68, price_76, 0, Green);
                     }
                     if (G_iclose_876 <= cond2(G_ima_852, G_iatr_860, Gd_908, Symbol())) {
                        RefreshRates();
                        OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), G_slippage_136, Violet);
                     } else count_224++;
                     if (TimeCurrent() < Li_244) continue;
                     Ld_84 = G_iatr_860 * Gd_516;
                     if (Ld_84 > Gi_500 * Gd_908) Ld_84 = Gi_500 * Gd_908;
                     if (Ld_84 < Gi_504 * Gd_908) Ld_84 = Gi_504 * Gd_908;
                     if (Bid - OrderOpenPrice() > Gi_528 * Gd_908) Ld_84 = Gi_532 * Gd_908;
                     price_92 = NormalizeDouble(Bid - Ld_84, Digits);
                     if (Bid - OrderOpenPrice() <= Ld_84) continue;
                     if (!(OrderStopLoss() < price_92 && CheckStop(OrderType(), price_92, stoplevel_252, Bid, Ask, Point))) continue;
                     bool_28 = OrderModify(OrderTicket(), OrderOpenPrice(), price_92, OrderTakeProfit(), 0, Blue);
                     if (!(bool_28)) continue;
                     datetime_240 = TimeCurrent();
                     G_datetime_820 = datetime_240;
                     continue;
                  }
                  if (OrderStopLoss() == 0.0) {
                     price_68 = NormalizeDouble(Bid + f0_29() * Gd_908, Digits);
                     price_76 = NormalizeDouble(Bid - f0_23() * Gd_908, Digits);
                     if (CheckStop(OrderType(), price_68, stoplevel_252, Bid, Ask, Point) && CheckTarget(OrderType(), price_76, stoplevel_252, Bid, Ask, Point)) OrderModify(OrderTicket(), OrderOpenPrice(), price_68, price_76, 0, Green);
                  }
                  if (G_iclose_876 >= cond1(G_ima_852, G_iatr_860, Gd_908, Symbol())) {
                     RefreshRates();
                     OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), G_slippage_136, Violet);
                  } else count_228++;
                  if (TimeCurrent() >= Li_244) {
                     Ld_84 = G_iatr_860 * Gd_516;
                     if (Ld_84 > Gi_500 * Gd_908) Ld_84 = Gi_500 * Gd_908;
                     if (Ld_84 < Gi_504 * Gd_908) Ld_84 = Gi_504 * Gd_908;
                     if (OrderOpenPrice() - Ask > Gi_528 * Gd_908) Ld_84 = Gi_532 * Gd_908;
                     price_92 = NormalizeDouble(Ask + Ld_84, Digits);
                     if (OrderOpenPrice() - Ask > Ld_84) {
                        if (OrderStopLoss() > price_92 && CheckStop(OrderType(), price_92, stoplevel_252, Bid, Ask, Point)) {
                           bool_28 = OrderModify(OrderTicket(), OrderOpenPrice(), price_92, OrderTakeProfit(), 0, Red);
                           if (bool_28) {
                              datetime_240 = TimeCurrent();
                              G_datetime_820 = datetime_240;
                           }
                        }
                     }
                  }
               }
            }
         }
      }
      Li_264 = -1;
      if (FirstFace != FALSE) {
         if (LotFF != 0.0) {
            Ld_132 = MathMin(Gd_792, MathMax(Gd_784, LotFF));
            if (PercentLotFF > 0.0) Ld_132 = MathMax(Gd_784, MathMin(Gd_792, NormalizeDouble(f0_16() / 100.0 * AccountFreeMargin() / G_lotstep_800 / (G_lotsize_812 / 100), 0) * G_lotstep_800));
            if (Ld_132 > MaxLotsOr) Ld_132 = MaxLotsOr;
            if (AccountFreeMargin() < Ask * Ld_132 * G_lotsize_812 / G_leverage_808) {
               Print("We have no money. Lots = ", Ld_132, " , Free Margin = ", AccountFreeMargin());
               Comment("We have no money. Lots = ", Ld_132, " , Free Margin = ", AccountFreeMargin());
               return (0);
            }
            if (count_216 < 1 && cond3(count_220, Gi_88, Symbol()) && (G_iclose_828 > G_ima_836 + Gi_348 * Gd_908 && G_iwpr_844 < Gi_356 + (-100) && Bid < G_iclose_828 - Gi_364 * Gd_908) ||
               (G_iwpr_844 < Gi_372 + (-100) && Bid < G_iclose_828 - Gi_364 * Gd_908 && Hour() == Li_164 || Hour() == Li_168)) {
               Ls_140 = "BUY";
               Li_264 = 0;
               Li_24 = 32768;
               RefreshRates();
               Ld_0 = NormalizeDouble(Ask, Digits);
               Ld_8 = Ld_0 - f0_8() * Gd_908;
               Ld_16 = Ld_0 + f0_6() * Gd_908;
            }
            if (count_220 < 1 && cond3(count_216, Gi_88, Symbol()) && (G_iclose_828 < G_ima_836 - Gi_348 * Gd_908 && G_iwpr_844 > (-Gi_356) && Bid > G_iclose_828 + Gi_364 * Gd_908) ||
               (G_iwpr_844 > (-Gi_372) && Bid > G_iclose_828 + Gi_364 * Gd_908 && Hour() == Li_164 || Hour() == Li_168)) {
               Ls_140 = "SELL";
               Li_264 = 1;
               Li_24 = 255;
               RefreshRates();
               Ld_0 = NormalizeDouble(Bid, Digits);
               Ld_8 = Ld_0 + f0_8() * Gd_908;
               Ld_16 = Ld_0 - f0_6() * Gd_908;
            }
         }
      }
      if (Li_264 >= 0 && G_stoplevel_816 == 0 || (CheckStop(Li_264, Ld_8, stoplevel_252, Bid, Ask, Point) && CheckTarget(Li_264, Ld_16, stoplevel_252, Bid, Ask, Point))) {
         if (Ask - Bid <= FFMaxSpread) {
            if (G_stoplevel_816 == 0 || MarketExecution == TRUE) ticket_40 = f0_31(Symbol(), Li_264, Ld_132, Ld_0, G_slippage_136, 0, 0, Gs_104, G_magic_120, 0, Li_24);
            else ticket_40 = f0_31(Symbol(), Li_264, Ld_132, Ld_0, G_slippage_136, Ld_8, Ld_16, Gs_104, G_magic_120, 0, Li_24);
            if (!IsTesting()) Sleep(5000);
            if (ticket_40 > 0) {
               if (OrderSelect(ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print(Gs_104 + " order " + Ls_140 + " opened!: ", OrderOpenPrice());
            } else
               if (!Gi_1032) Print("Error opening " + Ls_140 + " order!: ", GetLastError());
         }
      }
      Li_264 = -1;
      if ((!(TimeHour(TimeCurrent()) != Li_172 && TimeHour(TimeCurrent()) != Li_176 && TimeHour(TimeCurrent()) != Li_180 && TimeHour(TimeCurrent()) != Li_184 && TimeHour(TimeCurrent()) != Li_188 &&
         TimeHour(TimeCurrent()) != Li_192 && TimeHour(TimeCurrent()) != Li_196 && TimeHour(TimeCurrent()) != Li_200 && TimeHour(TimeCurrent()) != Li_204 && TimeHour(TimeCurrent()) != Li_208)) ||
         !(TimeHour(TimeCurrent()) != Li_212)) {
         if (SecondFace != FALSE) {
            if (LotSF != 0.0) {
               Ld_148 = MathMin(Gd_792, MathMax(Gd_784, LotSF));
               if (PercentLotSF > 0.0) Ld_148 = MathMax(Gd_784, MathMin(Gd_792, NormalizeDouble(f0_17() / 100.0 * AccountFreeMargin() / G_lotstep_800 / (G_lotsize_812 / 100), 0) * G_lotstep_800));
               if (Ld_148 > MaxLotsOr) Ld_148 = MaxLotsOr;
               if (AccountFreeMargin() < Ask * Ld_148 * G_lotsize_812 / G_leverage_808) {
                  Print("We have no money. Lots = ", Ld_148, " , Free Margin = ", AccountFreeMargin());
                  Comment("We have no money. Lots = ", Ld_148, " , Free Margin = ", AccountFreeMargin());
                  return (0);
               }
               if (count_228 < 1 && cond3(count_224, Gi_88, Symbol()) && G_iclose_876 <= cond2(G_ima_852, G_iatr_860, Gd_908, Symbol())) {
                  Ls_140 = "SELL";
                  Li_264 = 1;
                  Li_24 = 55295;
                  Ld_0 = NormalizeDouble(Bid, Digits);
                  Ld_8 = Ld_0 + f0_29() * Gd_908;
                  Ld_16 = Ld_0 - f0_23() * Gd_908;
               }
               if (count_224 < 1 && cond3(count_228, Gi_88, Symbol()) && G_iclose_876 >= cond1(G_ima_852, G_iatr_860, Gd_908, Symbol())) {
                  Ls_140 = "BUY";
                  Li_264 = 0;
                  Li_24 = 16711680;
                  Ld_0 = NormalizeDouble(Ask, Digits);
                  Ld_8 = Ld_0 - f0_29() * Gd_908;
                  Ld_16 = Ld_0 + f0_23() * Gd_908;
               }
            }
         }
      }
      if (StopSecondFaceTradesOnNews)
         if (Gi_1052 >= 0) return (0);
      if (Li_264 >= 0 && G_stoplevel_816 == 0 || (CheckStop(Li_264, Ld_8, stoplevel_252, Bid, Ask, Point) && CheckTarget(Li_264, Ld_16, stoplevel_252, Bid, Ask, Point))) {
         if (Ask - Bid <= SFMaxSpread) {
            if (G_stoplevel_816 == 0 || MarketExecution == TRUE) ticket_44 = f0_9(Symbol(), Li_264, Ld_148, Ld_0, G_slippage_136, 0, 0, Gs_112, G_magic_124, 0, Li_24);
            else ticket_44 = f0_9(Symbol(), Li_264, Ld_148, Ld_0, G_slippage_136, Ld_8, Ld_16, Gs_112, G_magic_124, 0, Li_24);
            if (!IsTesting()) Sleep(5000);
            if (ticket_44 > 0) {
               if (OrderSelect(ticket_44, SELECT_BY_TICKET, MODE_TRADES)) Print(Gs_112 + " order " + Ls_140 + " opened!: ", OrderOpenPrice());
            } else
               if (!Gi_1032) Print("Error opening " + Ls_140 + " order!: ", GetLastError());
         }
      }
      Li_264 = -1;
   }
   return (0);
}

// 88E40F7E070E3158E62904C262B34159
int f0_15() {
   if (UseNeuro == FALSE) return (0);
   if (Training == TRUE && G_bars_932 < Bars) {
      G_bars_932 = Bars;
      f0_7();
   } else {
      if (G_bars_932 < Bars) {
         G_bars_932 = Bars;
         if (f0_27(0, 1) && f0_27(0, 2)) {
            G_cmd_952 = f0_5(1);
            G_cmd_956 = f0_5(2);
         } else {
            Print("Error to fill pattern for neural network");
            G_cmd_952 = -1;
            G_cmd_956 = -1;
         }
      }
   }
   return (G_cmd_952);
}

// F8DFAB6A91A6970AAC13D75EA5BDFFF7
int f0_31(string A_symbol_0, int A_cmd_8, double A_lots_12, double A_price_20, int A_slippage_28, double A_price_32, double A_price_40, string A_comment_48 = "", int A_magic_56 = 0, int A_datetime_60 = 0, color A_color_64 = -1) {
   double lots_72;
   bool Li_68 = TRUE;
   Gi_1032 = FALSE;
   if (UseNeuro == TRUE && Training == FALSE) {
      if (A_cmd_8 == OP_BUY && G_cmd_952 == OP_SELL) Li_68 = FALSE;
      if (A_cmd_8 == OP_SELL && G_cmd_952 == OP_BUY) Li_68 = FALSE;
   }
   if (Li_68) return (OrderSend(A_symbol_0, A_cmd_8, A_lots_12, A_price_20, A_slippage_28, A_price_32, A_price_40, A_comment_48, A_magic_56, A_datetime_60, A_color_64));
   if (NeuroLots > 0.0) {
      lots_72 = NormalizeDouble(A_lots_12 * NeuroLots, 2);
      if (lots_72 > MarketInfo(A_symbol_0, MODE_MINLOT)) return (OrderSend(A_symbol_0, A_cmd_8, lots_72, A_price_20, A_slippage_28, A_price_32, A_price_40, A_comment_48, A_magic_56, A_datetime_60, A_color_64));
      Gi_1032 = TRUE;
      return (0);
   }
   Gi_1032 = TRUE;
   return (0);
}

// 4BAF31DB8111C5726D979B9E8F033D2F
int f0_9(string A_symbol_0, int A_cmd_8, double A_lots_12, double A_price_20, int A_slippage_28, double A_price_32, double A_price_40, string A_comment_48 = "", int A_magic_56 = 0, int A_datetime_60 = 0, color A_color_64 = -1) {
   double lots_72;
   bool Li_68 = TRUE;
   Gi_1032 = FALSE;
   if (UseNeuro == TRUE && Training == FALSE) {
      if (A_cmd_8 == OP_BUY && G_cmd_956 == OP_SELL) Li_68 = FALSE;
      if (A_cmd_8 == OP_SELL && G_cmd_956 == OP_BUY) Li_68 = FALSE;
   }
   if (Li_68) return (OrderSend(A_symbol_0, A_cmd_8, A_lots_12, A_price_20, A_slippage_28, A_price_32, A_price_40, A_comment_48, A_magic_56, A_datetime_60, A_color_64));
   if (NeuroLots > 0.0) {
      lots_72 = NormalizeDouble(A_lots_12 * NeuroLots, 2);
      if (lots_72 > MarketInfo(A_symbol_0, MODE_MINLOT)) return (OrderSend(A_symbol_0, A_cmd_8, lots_72, A_price_20, A_slippage_28, A_price_32, A_price_40, A_comment_48, A_magic_56, A_datetime_60, A_color_64));
      Gi_1032 = TRUE;
      return (0);
   }
   Gi_1032 = TRUE;
   return (0);
}

// 92E780C75B0C3C9C580917BFB67FDC21
double f0_16() {
   int Li_0;
   double Ld_4;
   if (Gi_216) return (PercentLotFF);
   double Ld_ret_12 = PercentLotFF;
   int Li_20 = 0;
   if (Digits <= 3) Ld_4 = 0.01;
   else Ld_4 = 0.0001;
   for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) {
      if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_120) {
            if (OrderProfit() > 0.0) {
               if (Gi_260 == 0) break;
               if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / Ld_4 > Gi_260) break;
               continue;
            }
            Li_20++;
         }
      }
   }
   if (Li_20 > Gi_252 && Gi_256 > 1) {
      Li_0 = MathMod(Li_20, Gi_256);
      Ld_ret_12 *= MathPow(Gd_244, Li_0);
   }
   if (Gd_200 > 0.0 && Ld_ret_12 > Gd_200) Ld_ret_12 = Gd_200;
   return (Ld_ret_12);
}

// 990F31ACA48F8AB294D56D4E983AD0B8
double f0_17() {
   int Li_0;
   double Ld_4;
   if (Gi_216) return (PercentLotSF);
   double Ld_ret_12 = PercentLotSF;
   int Li_20 = 0;
   if (Digits <= 3) Ld_4 = 0.01;
   else Ld_4 = 0.0001;
   for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) {
      if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_124) {
            if (OrderProfit() > 0.0) {
               if (Gi_416 == 0) break;
               if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / Ld_4 > Gi_416) break;
               continue;
            }
            Li_20++;
         }
      }
   }
   if (Li_20 > Gi_408 && Gi_412 > 1) {
      Li_0 = MathMod(Li_20, Gi_412);
      Ld_ret_12 *= MathPow(Gd_400, Li_0);
   }
   if (Gd_200 > 0.0 && Ld_ret_12 > Gd_200) Ld_ret_12 = Gd_200;
   return (Ld_ret_12);
}

// F5FBB503012F91B053A187C081A95818
string f0_30() {
   int Lia_0[4];
   string Ls_unused_28;
   GetSystemTime(Lia_0);
   int Li_4 = Lia_0[0] & 65535;
   int Li_8 = Lia_0[0] >> 16;
   int Li_12 = Lia_0[1] >> 16;
   int Li_16 = Lia_0[2] & 65535;
   int Li_20 = Lia_0[2] >> 16;
   int Li_24 = Lia_0[3] & 65535;
   return (f0_21(Li_4, Li_8, Li_12, Li_16, Li_20, Li_24));
}

// 75EC640CC9D96D47363496C22E6DD383
int f0_13() {
   int Lia_0[4];
   GetSystemTime(Lia_0);
   int Li_4 = Lia_0[0] & 65535;
   int Li_8 = Lia_0[0] >> 16;
   int Li_12 = Lia_0[1] >> 16;
   int Li_16 = Lia_0[2] & 65535;
   int Li_20 = Lia_0[2] >> 16;
   int Li_24 = Lia_0[3] & 65535;
   string Ls_28 = f0_21(Li_4, Li_8, Li_12, Li_16, Li_20, Li_24);
   double Ld_36 = TimeCurrent() - StrToTime(Ls_28);
   Gs_776 = "\n   Greenwich Mean Time : " + TimeToStr(StrToTime(Ls_28), TIME_DATE|TIME_MINUTES|TIME_SECONDS) 
      + "\n   Broker Time : " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS) 
   + "\n   Local Time : " + TimeToStr(TimeLocal(), TIME_DATE|TIME_MINUTES|TIME_SECONDS);
   return (MathRound(Ld_36 / 3600.0));
}

// C248C34F8D287A6A2F05C377B9F06428
string f0_21(int Ai_0, int Ai_4, int Ai_8, int Ai_12, int Ai_16, int Ai_20) {
   string Ls_24 = Ai_4 + 100;
   Ls_24 = StringSubstr(Ls_24, 1);
   string Ls_32 = Ai_8 + 100;
   Ls_32 = StringSubstr(Ls_32, 1);
   string Ls_40 = Ai_12 + 100;
   Ls_40 = StringSubstr(Ls_40, 1);
   string Ls_48 = Ai_16 + 100;
   Ls_48 = StringSubstr(Ls_48, 1);
   string Ls_56 = Ai_20 + 100;
   Ls_56 = StringSubstr(Ls_56, 1);
   return (StringConcatenate(Ai_0, ".", Ls_24, ".", Ls_32, " ", Ls_40, ":", Ls_48, ":", Ls_56));
}

// C7BBDAE335EEC9070566C87E2AB725C9
void f0_24() {
   HideTestIndicators(TRUE);
   G_iclose_828 = iClose(NULL, PERIOD_M15, 1);
   G_ima_836 = iMA(NULL, PERIOD_M15, G_period_344, 0, MODE_SMMA, PRICE_CLOSE, 1);
   G_iwpr_844 = iWPR(NULL, PERIOD_M15, G_period_352, 1);
   G_iatr_860 = iATR(NULL, PERIOD_H1, G_period_512, 1);
   G_ima_852 = iMA(NULL, PERIOD_H1, G_period_508, 0, MODE_EMA, PRICE_CLOSE, 1);
   G_iclose_876 = iClose(NULL, PERIOD_M5, 1);
   HideTestIndicators(FALSE);
}

// 6B48238EF7FEE5AB2D2BC569C4B066D7
void f0_12() {
   if (Gi_772) {
      Gi_772 = FALSE;
      Gd_784 = MarketInfo(Symbol(), MODE_MINLOT);
      Gd_792 = MarketInfo(Symbol(), MODE_MAXLOT);
      G_leverage_808 = AccountLeverage();
      G_lotsize_812 = MarketInfo(Symbol(), MODE_LOTSIZE);
      G_stoplevel_816 = MarketInfo(Symbol(), MODE_STOPLEVEL);
      G_lotstep_800 = MarketInfo(Symbol(), MODE_LOTSTEP);
   }
   if (Gi_148 != TRUE) {
      Gd_244 = 1;
      Gd_400 = 1;
   }
}

// CCDF5B3CFEC66428705785CC1D9CA650
void f0_25() {
   if (Digits <= 3) Gd_908 = 0.01;
   else Gd_908 = 0.0001;
   if (Ask - Bid > Gd_128 * Gd_908) {
      Comment("\n SPREAD IS TOO HIGH ...");
      Print("SPREAD IS TOO HIGH ...");
      return;
   }
}

// C4C4FD7A0B69B786B6C1B165A945C164
void f0_22() {
   double Ld_0 = 0;
   bool Li_8 = FALSE;
   for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
      if (!OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES)) Print("OrderSelect Error! Position:", pos_12);
      else {
         if (OrderType() <= OP_SELL && OrderSymbol() == Symbol())
            if (OrderMagicNumber() == G_magic_120) return;
      }
   }
   for (pos_12 = OrdersHistoryTotal() - 1; pos_12 >= 0; pos_12--) {
      if (!OrderSelect(pos_12, SELECT_BY_POS, MODE_HISTORY)) Print("OrderSelect Error! Position:", pos_12);
      else {
         if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == G_magic_120) {
               if (OrderType() == OP_BUY) Ld_0 = OrderTakeProfit() - OrderClosePrice();
               else Ld_0 = OrderClosePrice() - OrderTakeProfit();
               if (Ld_0 <= 0.0) {
                  Li_8 = TRUE;
                  break;
               }
            }
         }
      }
   }
   if (!Li_8) {
      for (pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
         if (!OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES)) Print("OrderSelect Error! Position:", pos_12);
         else {
            if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
               if (OrderMagicNumber() == G_magic_124) {
                  if (OrderType() == OP_BUY) {
                     RefreshRates();
                     if (!OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), G_slippage_136, Violet)) Print("Failed to close second face order" + OrderTicket());
                     else Print("Second face order " + OrderTicket() + " was closed due to fisrt face order");
                  }
                  if (OrderType() == OP_SELL) {
                     RefreshRates();
                     if (!OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), G_slippage_136, Violet)) {
                        Print("Failed to close second face order" + OrderTicket());
                        continue;
                     }
                     Print("Second face order " + OrderTicket() + " was closed due to fisrt face order");
                  }
               }
            }
         }
      }
   }
}

// 20DF6A7FE5DC54478F01182866ABC932
void f0_3() {
   double order_stoploss_8;
   double order_takeprofit_16;
   double order_stoploss_24;
   double order_takeprofit_32;
   int ticket_40;
   int ticket_44;
   int datetime_0 = -1;
   int datetime_4 = -1;
   int cmd_48 = 1;
   int cmd_52 = 2;
   for (int pos_56 = OrdersTotal() - 1; pos_56 >= 0; pos_56--) {
      if (!OrderSelect(pos_56, SELECT_BY_POS, MODE_TRADES)) Print("OrderSelect Error! Position:", pos_56);
      else {
         if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == G_magic_120) {
               datetime_0 = OrderOpenTime();
               order_stoploss_8 = OrderStopLoss();
               order_takeprofit_16 = OrderTakeProfit();
               ticket_40 = OrderTicket();
               cmd_48 = OrderType();
            }
            if (OrderMagicNumber() == G_magic_124) {
               datetime_4 = OrderOpenTime();
               order_stoploss_24 = OrderStopLoss();
               order_takeprofit_32 = OrderTakeProfit();
               ticket_44 = OrderTicket();
               cmd_52 = OrderType();
            }
         }
      }
   }
   if (datetime_4 < 0) G_ticket_928 = -1;
   if (G_ticket_928 == -1) {
      if (cmd_48 == cmd_52 && datetime_4 > 0 && datetime_0 > 0 && datetime_4 < datetime_0) {
         if (MathAbs(order_stoploss_8 - order_stoploss_24) > Point && MathAbs(order_takeprofit_16 - order_takeprofit_32) > Point && order_stoploss_8 > Point || order_takeprofit_16 > Point) {
            if (!OrderModify(ticket_44, 0, order_stoploss_8, order_takeprofit_16, 0, Red)) Print("Failed to put values of StopLoss and TakeProfit from first to second face for order " + ticket_44);
            else {
               Print("Values of StopLoss and TakeProfit successfully copied from first to second face for order " + ticket_44);
               G_ticket_928 = ticket_44;
            }
         }
      }
   }
}

// ACD0A72149D10687956823D6C9C5B7CC
bool f0_20() {
   int Li_0;
   int count_24;
   if (!IsTesting() && GMTAuto == TRUE) Li_0 = f0_13();
   else Li_0 = GMTTest;
   int Li_4 = HourToStopTrade + Li_0;
   int Li_8 = HourToStartTrade + Li_0;
   int day_of_week_12 = DayOfWeek();
   int minute_16 = Minute();
   int hour_20 = Hour();
   if (day_of_week_12 == DayToStopTrade && hour_20 == Li_4 && minute_16 == MinuteToStopTrade) {
      count_24 = 0;
      if (OrdersTotal() > 0) {
         for (int pos_28 = OrdersTotal() - 1; pos_28 >= 0; pos_28--) {
            if (OrderSelect(pos_28, SELECT_BY_POS, MODE_TRADES)) {
               if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_120 || OrderMagicNumber() == G_magic_124) {
                  if ((OrderProfit() > 0.0 && CloseAllProfitable) || (OrderProfit() < 0.0 && CloseAllLoses)) {
                     f0_28(OrderTicket());
                     count_24++;
                  }
               }
            }
         }
         if (count_24 > 0) Print(count_24 + " orders were closed due to stop trade time...");
      }
   }
   int Li_32 = DayToStopTrade - DayToStartTrade;
   if (Li_32 >= 0) {
      if (day_of_week_12 > DayToStartTrade && day_of_week_12 < DayToStopTrade) return (TRUE);
      if (day_of_week_12 == DayToStartTrade && hour_20 == Li_8 && minute_16 >= MinuteToStartTrade) return (TRUE);
      if (day_of_week_12 == DayToStartTrade && hour_20 > Li_8) return (TRUE);
      if (day_of_week_12 == DayToStopTrade && hour_20 < Li_4) return (TRUE);
      if (day_of_week_12 == DayToStopTrade && hour_20 == Li_4 && minute_16 < MinuteToStopTrade) return (TRUE);
   } else {
      if (day_of_week_12 > DayToStartTrade && day_of_week_12 > DayToStopTrade) return (TRUE);
      if (day_of_week_12 == DayToStartTrade && hour_20 == Li_8 && minute_16 >= MinuteToStartTrade) return (TRUE);
      if (day_of_week_12 == DayToStartTrade && hour_20 > Li_8) return (TRUE);
      if (day_of_week_12 == DayToStopTrade && hour_20 < Li_4) return (TRUE);
      if (day_of_week_12 == DayToStopTrade && hour_20 == Li_4 && minute_16 < MinuteToStopTrade) return (TRUE);
   }
   return (FALSE);
}

// E66A4F87C6579DB87A6A1963D071014D
int f0_28(int A_ticket_0) {
   double price_4;
   OrderSelect(A_ticket_0, SELECT_BY_TICKET, MODE_TRADES);
   int cmd_12 = OrderType();
   if (cmd_12 == OP_BUY) price_4 = Bid;
   if (cmd_12 == OP_SELL) price_4 = Ask;
   if (MathAbs(OrderTakeProfit() - price_4) <= MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) return (0);
   if (MathAbs(OrderStopLoss() - price_4) <= MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) return (0);
   return (OrderClose(A_ticket_0, OrderLots(), price_4, G_slippage_136, Gray));
}

// 38E16056944F2D7AEA526729F40A2CFF
int f0_7() {
   int Li_8;
   int Li_0 = OrdersTotal();
   for (int pos_4 = Li_0 - 1; pos_4 >= Gi_968; pos_4--) {
      OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == G_magic_960 && OrderSymbol() == Symbol()) {
         Li_8 = f0_1(OrderTicket(), 1);
         if (Li_8 < 0) f0_19(OrderTicket(), 1);
      }
   }
   for (pos_4 = Li_0 - 1; pos_4 >= Gi_968; pos_4--) {
      OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
      if (OrderMagicNumber() == G_magic_964 && OrderSymbol() == Symbol()) {
         Li_8 = f0_1(OrderTicket(), 2);
         if (Li_8 < 0) f0_19(OrderTicket(), 2);
      }
   }
   Gi_968 = Li_0;
   Li_0 = OrdersHistoryTotal();
   if (Li_0 > 0) {
      for (pos_4 = Li_0 - 1; pos_4 >= Gi_972; pos_4--) {
         OrderSelect(pos_4, SELECT_BY_POS, MODE_HISTORY);
         if (OrderMagicNumber() == G_magic_960 && OrderSymbol() == Symbol()) {
            G_order_profit_992 = OrderProfit();
            G_cmd_952 = OrderType();
            if (G_order_profit_992 < 0.0) {
               if (G_cmd_952 == OP_SELL) G_cmd_952 = 0;
               if (G_cmd_952 == OP_BUY) G_cmd_952 = 1;
            }
            Li_8 = f0_1(OrderTicket(), 1);
            if (Li_8 > 0) {
               if (f0_27(OrderOpenTime(), 1)) G_count_944++;
               f0_32(OrderTicket(), 1);
               Gda_1000[0] = G_cmd_952;
               NeuroPattern(Gi_936, Gda_1000, 1, ArraySize(Gda_1000) - 1);
            }
         }
      }
   }
   if (Li_0 > 0) {
      for (pos_4 = Li_0 - 1; pos_4 >= Gi_972; pos_4--) {
         OrderSelect(pos_4, SELECT_BY_POS, MODE_HISTORY);
         if (OrderMagicNumber() == G_magic_964 && OrderSymbol() == Symbol()) {
            G_order_profit_992 = OrderProfit();
            G_cmd_956 = OrderType();
            if (G_order_profit_992 < 0.0) {
               if (G_cmd_956 == OP_SELL) G_cmd_956 = 0;
               if (G_cmd_956 == OP_BUY) G_cmd_956 = 1;
            }
            Li_8 = f0_1(OrderTicket(), 2);
            if (Li_8 > 0) {
               if (f0_27(OrderOpenTime(), 2)) G_count_948++;
               f0_32(OrderTicket(), 2);
               Gda_1004[0] = G_cmd_956;
               NeuroPattern(Gi_940, Gda_1004, 1, ArraySize(Gda_1004) - 1);
            }
         }
      }
   }
   Gi_972 = Li_0;
   return (0);
}

// E524535EFF3559D2C9E93A0F39DA407A
int f0_27(int Ai_0, int Ai_4) {
   double high_8;
   double low_16;
   double close_24;
   int Li_40;
   int Li_32 = 1;
   int Li_36 = 1;
   if (Ai_4 == 1) {
      Li_32 = 1;
      Li_36 = 1;
      if (Ai_0 > 0) while (Ai_0 <= Time[Li_36]) Li_36++;
      Li_40 = Li_36 + ArraySize(Gda_1000) - 1;
      while (Li_36 <= Li_40) {
         high_8 = High[Li_36];
         low_16 = Low[Li_36];
         close_24 = Close[Li_36];
         if (high_8 - low_16 == 0.0) Gda_1000[Li_32] = 0;
         else Gda_1000[Li_32] = (close_24 - low_16 - (high_8 - close_24)) / (high_8 - low_16) / 2.0 + 0.5;
         Li_36++;
         Li_32++;
      }
      if (Li_32 < ArraySize(Gda_1000)) return (0);
      return (1);
   }
   if (Ai_4 == 2) {
      Li_32 = 1;
      Li_36 = 1;
      if (Ai_0 > 0) while (Ai_0 <= Time[Li_36]) Li_36++;
      Li_40 = Li_36 + ArraySize(Gda_1004) - 1;
      while (Li_36 <= Li_40) {
         high_8 = High[Li_36];
         low_16 = Low[Li_36];
         close_24 = Close[Li_36];
         if (high_8 - low_16 == 0.0) Gda_1004[Li_32] = 0;
         else Gda_1004[Li_32] = (close_24 - low_16 - (high_8 - close_24)) / (high_8 - low_16) / 2.0 + 0.5;
         Li_36++;
         Li_32++;
      }
      if (Li_32 < ArraySize(Gda_1004)) return (0);
      return (1);
   }
   return (0);
}

// E4FFBA894FF5FCB3AE485908869FBEB1
int f0_26() {
   if (Gi_936 >= 0 && Gi_940 >= 0) {
      SetProperty(Gi_936, "WizNet.PatternsMixed", "true");
      SetProperty(Gi_936, "Teached", "true");
      SetProperty(Gi_940, "WizNet.PatternsMixed", "true");
      SetProperty(Gi_940, "Teached", "true");
      Sleep(100);
      return (1);
   }
   return (0);
}

// 2555C23B10438B424300B987B351FC57
int f0_5(int Ai_0) {
   int Li_ret_4 = -1;
   if (Ai_0 == 1 && Gi_936 >= 0 && ArraySize(Gda_1000) > 1) {
      Gda_1000[0] = Li_ret_4;
      NeuroCompute(Gi_936, Gda_1000, 1, ArraySize(Gda_1000) - 1);
      Sleep(100);
      if (Gda_1000[0] > 1.0 - Gd_608) Li_ret_4 = 1;
      else
         if (Gda_1000[0] < Gd_608) Li_ret_4 = 0;
      return (Li_ret_4);
   }
   if (Ai_0 == 2 && Gi_940 >= 0 && ArraySize(Gda_1004) > 1) {
      Gda_1004[0] = Li_ret_4;
      NeuroCompute(Gi_940, Gda_1004, 1, ArraySize(Gda_1004) - 1);
      Sleep(100);
      if (Gda_1004[0] > 1.0 - Gd_608) Li_ret_4 = 1;
      else
         if (Gda_1004[0] < Gd_608) Li_ret_4 = 0;
      return (Li_ret_4);
   }
   return (Li_ret_4);
}

// 1032DDF6DDF66A5E9A7902BC96C87AE6
int f0_1(int Ai_0, int Ai_4) {
   if (Ai_4 == 1) {
      for (int index_8 = 0; index_8 < ArraySize(Gia_976); index_8++)
         if (Gia_976[index_8] == Ai_0) return (index_8);
   }
   if (Ai_4 == 2) {
      for (index_8 = 0; index_8 < ArraySize(Gia_980); index_8++)
         if (Gia_980[index_8] == Ai_0) return (index_8);
   }
   return (-1);
}

// A01D20AAF322850E2B2828803CC4821C
void f0_19(int Ai_0, int Ai_4) {
   if (Ai_4 == 1) {
      ArrayResize(Gia_976, ArraySize(Gia_976) + 1);
      Gia_976[ArraySize(Gia_976) - 1] = Ai_0;
   }
   if (Ai_4 == 2) {
      ArrayResize(Gia_980, ArraySize(Gia_980) + 1);
      Gia_980[ArraySize(Gia_980) - 1] = Ai_0;
   }
}

// FF4FA812879F868F6E6108404311BB59
void f0_32(int Ai_0, int Ai_4) {
   int Li_8;
   if (Ai_4 == 1) {
      Li_8 = f0_1(Ai_0, Ai_4);
      if (Li_8 >= 0 && Li_8 < ArraySize(Gia_976)) Gia_976[Li_8] = 0;
   }
   if (Ai_4 == 2) {
      Li_8 = f0_1(Ai_0, Ai_4);
      if (Li_8 >= 0 && Li_8 < ArraySize(Gia_980)) Gia_980[Li_8] = 0;
   }
}

// 44BE1978AACCC59D35047ABB53EC9071
int f0_8() {
   if (!Gi_288) return (Gi_280);
   int Li_ret_0 = 0;
   double iatr_4 = iATR(NULL, G_timeframe_300, G_period_304, 0);
   Li_ret_0 = Gd_308 * iatr_4 / f0_4();
   if (Li_ret_0 < Gi_292) Li_ret_0 = Gi_292;
   if (Li_ret_0 > Gi_296) Li_ret_0 = Gi_296;
   return (Li_ret_0);
}

// 336F6F331A2D502CBE6637A3CE7678D1
int f0_6() {
   if (!Gi_316) return (Gi_284);
   int Li_ret_0 = 0;
   double iatr_4 = iATR(NULL, G_timeframe_328, G_period_332, 0);
   Li_ret_0 = Gd_336 * iatr_4 / f0_4();
   if (Li_ret_0 < Gi_320) Li_ret_0 = Gi_320;
   if (Li_ret_0 > Gi_324) Li_ret_0 = Gi_324;
   return (Li_ret_0);
}

// E80DB5C90488B020E9FCF29757164CD5
int f0_29() {
   if (!Gi_444) return (Gi_436);
   int Li_ret_0 = 0;
   double iatr_4 = iATR(NULL, G_timeframe_456, G_period_460, 0);
   Li_ret_0 = Gd_464 * iatr_4 / f0_4();
   if (Li_ret_0 < Gi_448) Li_ret_0 = Gi_448;
   if (Li_ret_0 > Gi_452) Li_ret_0 = Gi_452;
   return (Li_ret_0);
}

// C54DC8D8D3C8F20E4618032587CECAA8
int f0_23() {
   if (!Gi_472) return (Gi_440);
   int Li_ret_0 = 0;
   double iatr_4 = iATR(NULL, G_timeframe_484, G_period_488, 0);
   Li_ret_0 = Gd_492 * iatr_4 / f0_4();
   if (Li_ret_0 < Gi_476) Li_ret_0 = Gi_476;
   if (Li_ret_0 > Gi_480) Li_ret_0 = Gi_480;
   return (Li_ret_0);
}

// 252711ADFFEAD90D3F06220616D7D33D
double f0_4() {
   if (Digits == 3 || Digits == 5) return (10.0 * Point);
   return (Point);
}

// 857B2CB4AF094BA5571FA0B22C94C14E
double f0_14(int Ai_0, int Ai_4) {
   double icustom_16;
   string Ls_8 = "i-MZ-FF-News";
   icustom_16 = iCustom(NULL, 0, Ls_8, " --- News ---", sUrl, Gi_656, SymbolsFilter.On, SymbolsFilter, ShowOnlyCurrDay, IncludeHigh, IncludeMedium, IncludeLow, IgnoreFilter.On,
      IgnoreFilter, NewsSite.GMT.Offset, Gi_1056, News.HighLightPrior.mi, News.HighLightAfter.mi, Gi_716, " --- News: Graphic ---", NewsLabels.Show, NewsLabels.corner,
      NewsLabels.cols, NewsLabels.row0_offset, NewsLabels.rows_size, NewsLabels.FontName, NewsLabels.FontSize, NewsLabels.RegularRows, NewsLabels.HighlightedRows, Ai_0,
      Ai_4);
   return (icustom_16);
}

// 04D8FFB747E284D2C2EE17520B3F6D9A
void f0_0(int A_cmd_0, int A_cmd_4 = -1) {
   int cmd_12;
   for (int order_total_8 = OrdersTotal(); order_total_8 >= 0; order_total_8--) {
      if (OrderSelect(order_total_8, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == G_magic_124) {
               cmd_12 = OrderType();
               if (cmd_12 != A_cmd_0 && cmd_12 != A_cmd_4) continue;
               if (IsTradeContextBusy()) {
                  Print("TradeContext is busy, waiting...");
                  continue;
               }
               f0_28(OrderTicket());
            }
         }
      }
   }
}

Recommend