Navigation:Home > Content >

PipStrider_edu_nodll.mq4

Time: 2016-01-15 | Download file:PipStrider_edu_nodll.mq4

/*
   Generated by EX4-TO-MQ4 decompiler LITE V4.0.432.1 [-]
   Website: https://purebeam.biz
   E-mail : [email protected]
*/
#property copyright "Copyright © 2010-2011 Forex-Goldmine, Inc."
#property link      "http://www.pipstrider.com"

/*
#import "PipStrider.dll"
   int get_req(int a0, int a1);
#import
*/

bool gi_76 = TRUE;
// int gi_80 = D'19.04.2001 12:25:21';
string gs_84 = "PipStrider v_1.33 ";
extern string version2 = "PipStrider v_1.33 ";
extern string OWN = "Copyright © 2010-2011, Forex-Goldmine, Inc.";
bool gi_108 = TRUE;
extern string _Comment = "PipStrider ";
extern bool DoTrades = TRUE;
extern bool MonitorAndClose = FALSE;
extern bool StealthMode = FALSE;
extern bool AutoStealthMode = TRUE;
extern bool AllowLotsBeyondMaxSize = FALSE;
extern bool ModifyMartingale = TRUE;
bool gi_144 = TRUE;
int gi_148 = 2;
extern int TradeDirection = 3;
extern int TradeRange = 40;
bool gi_160 = TRUE;
bool gi_164 = FALSE;
double gd_168 = 5.0;
extern int WaitPips = 0;
bool gi_180 = TRUE;
extern int StopLoss = 0;
extern string a1 = "----------------------------------------------";
extern string a2 = " Martingale Disrupter (tm) Technology";
extern bool UseMartingaleDisrupter = TRUE;
extern bool AdjustTakeProfit = FALSE;
extern double DisrupterClose = 0.75;
extern double DisrupterClose2 = 0.75;
double gd_228 = -10.0;
bool gi_236 = TRUE;
bool gi_240 = TRUE;
bool gi_244 = FALSE;
extern int OnlyAfterLevel = 5;
extern int OnlyAfterLevel2 = 6;
int gi_256 = 0;
extern int MaxBuyMartingaleLevel = 6;
extern int MaxSellMartingaleLevel = 6;
extern bool CloseBuyBeyondMax = FALSE;
extern bool CloseSellBeyondMax = FALSE;
extern double MaxDrawDownPct = 100.0;
extern bool LimitToThisPair = FALSE;
extern bool UseGridExpander = TRUE;
extern int ExpandPips = 0;
extern int ExpandPips2 = 0;
int gi_300 = 100;
int gi_304 = 0;
int gi_308 = 0;
extern string a3 = "----------------------------------------------";
extern double TradeLots = 0.0;
extern double BalanceFactor = 3000.0;
extern double ControlBalance = 0.0;
extern double LockInProfits = 0.0;
extern bool StopWhenProfitReached = FALSE;
extern string a4 = "Set to -1 to set 0 or a positive number to set actual value";
extern double ResetFundsWithdrawn = 0.0;
extern double MaxLots = 1000.0;
extern int MagicNumber = 734775;
extern bool Send_Email = FALSE;
extern int Send_Frequency = 0;
extern int Send_Minute = 0;
extern bool SUNDAY = TRUE;
extern bool MONDAY = TRUE;
extern bool TUESDAY = TRUE;
extern bool WEDNESDAY = TRUE;
extern bool THURSDAY = TRUE;
extern bool FRIDAY = TRUE;
extern bool ResetMaximums = FALSE;
extern int LookBackDays = 5;
extern int LookBackMinimumPips = 125;
double gd_432 = 2.0;
bool gi_440 = TRUE;
int gi_444 = 7;
extern string note1 = "---- Caution! For Emergency Closing of Trades ---";
extern bool CloseAllBuyTrades = FALSE;
extern bool CloseAllSellTrades = FALSE;
int gi_464 = 40;
int gi_468 = 40;
int gi_472 = 40;
int gi_476 = 30;
int gi_480 = 0;
double gd_484 = 20.0;
double gd_492 = 0.01;
bool gi_500 = FALSE;
bool gi_504 = FALSE;
string gs_508 = " ";
double gd_516 = 0.0;
double gd_524 = 0.0;
double gd_532 = 0.0;
double gd_540 = 0.0;
double gd_548 = 0.0;
double gd_556 = 0.0;
double gd_564 = 0.0;
int gi_572 = 0;
int gi_576 = 0/* NO_ERROR */;
double gd_580 = 0.0;
double gd_588 = 0.0;
int gi_596 = 0;
int gi_600 = 0;
string gs_604 = " ";
int gi_612 = 3;
int gi_616 = CLR_NONE;
int gi_620 = CLR_NONE;
bool gi_624 = FALSE;
double gd_628 = 0.0;
double gd_636 = 0.0;
string gs_644 = " ";
int gi_652 = 0;
int gi_656 = 0;
int gi_660 = 0;
double gd_664 = 0.0;
int gi_672 = 0;
int gi_676 = 0;
int gi_680 = 0;
double gd_684 = 0.0;
int gi_692 = 0;
int gi_696 = 0;
int gi_700 = 0;
int gi_704 = 0;
int gi_708 = 0;
int gi_712 = 0;
int gi_716 = 0;
int gi_720 = 0;
double gd_724 = 98765.43;
double gd_732 = 98765.43;
int gi_740 = 2;
int gi_744 = 10;
double gd_748 = 0.0;
double gd_756 = 0.0;
bool gi_764 = TRUE;
double gd_768 = 0.0;
double gd_776 = 0.0;
int gi_784 = 0;
int gi_788 = 0;
int gi_792 = 0;
int gi_796 = 0;
int gi_800 = 0;
int gi_804 = 0;
int gi_808 = 0;
int gi_812 = 0;
string gs_816 = "";
double gd_824 = 0.0;
double gd_832 = 0.0;
double gd_840 = 0.0;
double gd_848 = 0.0;
double gd_856 = 0.0;
double gd_864 = 0.0;
bool gi_872 = FALSE;
double gd_876 = 0.0;
double gd_884 = 0.0;
double gd_892 = 0.0;
double gda_900[3];
double gda_904[3];
double gda_908[3];
double gda_912[3];
double gd_916 = 0.0;
double gd_924 = 0.0;
double gd_932 = 0.0;
double gd_940 = 0.0;
double gd_948 = 0.0;
double gd_956 = 0.0;
int gi_964 = 0;
double gd_968 = 0.0;
double gd_976 = 0.0;
bool gi_984 = FALSE;
int gi_988 = 0;
int gi_992 = 30;
int gi_996 = 0;
int gi_1000 = 0;
int gi_1004 = 0;
int gi_1008 = 0;
double gd_1012 = 0.0;
int gi_1020 = 0;
double gd_1024 = 0.0;
double gd_1032 = 0.0;
int gi_1040 = 0;
int gi_1044 = 0;
double gd_1048 = 0.0;
double gd_1056 = 0.0;
double gd_1064 = 0.0;
string gs_1072 = " ";
int gi_1080 = 0;
int gi_1084 = 0;
int gi_1088 = 0;
int gi_1092 = 0;
int gi_1096 = 0;
int gi_1100 = 0;
int gi_1104 = 0;
int gi_1108 = 0;
double gd_1112 = 0.0;
double gd_1120 = 0.0;
int gi_1128 = 0;
double gd_1132 = 0.0;
double gd_1140 = 0.0;
bool gi_1148 = FALSE;
int gi_1152 = 0;
int gi_1156 = 0;
int gi_1160 = 0;
int gi_1164 = 7;
int gi_1168 = 0;
int gi_1172 = 0;

int init() {
   if (Send_Frequency != 0 && Send_Frequency != 60 && Send_Frequency != 240 && Send_Frequency != 480 && Send_Frequency != 720 && Send_Frequency != 1440) {
      Comment("Send_Frequency setting can only be 0, 60, 240, 480, 720 or 1440");
      return (-1);
   }
   if (Send_Minute < 0 || Send_Minute > 59) {
      Comment("Send_Minute must be between 0 and 59");
      return (-1);
   }
   gi_1156 = FALSE;
   gi_1156 = f0_1();
   if (gi_1156 != TRUE) {
      Comment("This EA is not licensed for this account");
      return (-1);
   }
   f0_20();
   gi_1108 = FALSE;
   gi_692 = TradeRange;
   gi_696 = TradeRange;
   gi_700 = TradeRange;
   gd_884 = 0.0;
   gd_892 = 0.0;
   gi_1004 = 30;
   gi_988 = FALSE;
   gi_256 = 0;
   gi_300 = 100;
   gd_228 = -10.0;
   gi_984 = StealthMode;
   gi_1044 = 10000;
   gi_1040 = 0;
   gd_1048 = 0.0;
   gd_1056 = 0.0;
   gi_1080 = 0;
   gi_1084 = 0;
   gi_1088 = 0;
   gi_1092 = 0;
   gi_1096 = 0;
   gi_1100 = 0;
   gi_1104 = 0;
   double ld_0 = MarketInfo(Symbol(), MODE_LOTSIZE);
   DisrupterClose /= 100000 / ld_0;
   DisrupterClose2 /= 100000 / ld_0;
   gd_228 /= 100000 / ld_0;
   ArrayInitialize(gda_900, 0.0);
   ArrayInitialize(gda_904, 0.0);
   ArrayInitialize(gda_908, 0.0);
   ArrayInitialize(gda_912, 0.0);
   if (StringSubstr(a1, 0, 1) == "3") {
      gi_256 = 6;
      gi_300 = 100;
      gd_228 = -10.0;
   }
   gs_816 = DoubleToStr(MagicNumber, 0);
   gs_816 = StringSubstr(gs_816, 0, 2);
   if (!GlobalVariableCheck("GVMaxBuyLevel" + gs_816 + Symbol())) GlobalVariableSet("GVMaxBuyLevel" + gs_816 + Symbol(), 0);
   if (!GlobalVariableCheck("GVMaxSellLevel" + gs_816 + Symbol())) GlobalVariableSet("GVMaxSellLevel" + gs_816 + Symbol(), 0);
   if (!GlobalVariableCheck("GVFundsWithdrawn" + gs_816 + Symbol())) GlobalVariableSet("GVFundsWithdrawn" + gs_816 + Symbol(), 0.0);
   if (!GlobalVariableCheck("GVStealthMode" + gs_816 + Symbol())) GlobalVariableSet("GVStealthMode" + gs_816 + Symbol(), StealthMode);
   f0_9();
   gd_856 = AccountBalance() - gd_864;
   if (gd_856 < ControlBalance) gd_856 += gd_864;
   if (ResetFundsWithdrawn > 0.0) {
      gd_864 = ResetFundsWithdrawn;
      GlobalVariableSet("GVFundsWithdrawn" + gs_816 + Symbol(), ResetFundsWithdrawn);
      ResetFundsWithdrawn = 0.0;
      f0_21();
   }
   if (ResetFundsWithdrawn < 0.0) {
      gd_864 = 0.0;
      GlobalVariableSet("GVFundsWithdrawn" + gs_816 + Symbol(), 0.0);
      ResetFundsWithdrawn = 0.0;
      f0_21();
   }
   gd_856 = AccountBalance() - gd_864;
   if (gd_856 < ControlBalance) gd_856 += gd_864;
   gi_764 = DoTrades;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 1.0) gi_740 = 1;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.1) gi_740 = 2;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.01) gi_740 = 3;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.001) gi_740 = 4;
   if (MarketInfo(Symbol(), MODE_MINLOT) < 0.0001) gi_740 = 5;
   gi_992 = 30;
   f0_27();
   if (Digits == 5 || Digits == 3) {
      StopLoss = 10 * StopLoss;
      ExpandPips = 10 * ExpandPips;
      ExpandPips2 = 10 * ExpandPips2;
      gi_300 = 10 * gi_300;
      gi_992 = 300;
      WaitPips = 10 * WaitPips;
      gd_168 = 10.0 * gd_168;
      LookBackMinimumPips = 10 * LookBackMinimumPips;
   }
   gi_1020 = gi_692;
   gi_464 = gi_692;
   gi_468 = gi_692;
   gi_472 = gi_692;
   gi_476 = gi_692;
   f0_29();
   f0_28();
   gd_724 = 98765.43;
   gd_732 = 98765.43;
   f0_4();
   f0_20();
   if (ResetMaximums) {
      gi_804 = 0;
      gi_800 = 0;
      f0_21();
   }
   if (gi_480 >= 0) {
      gd_492 = gd_524 * gi_148;
      if (ModifyMartingale && gi_788 == 1) gd_492 = gd_556;
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gi_468 = gi_696;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_788 >= OnlyAfterLevel) gi_468 = gi_696 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_788 >= OnlyAfterLevel2) gi_468 = gi_696 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_788 >= gi_256) gi_468 = gi_696 + gi_300;
      gd_768 = gd_492;
      gd_748 = gd_540 - gi_468 * Point;
   }
   if (gi_480 <= 0) {
      gd_492 = gd_516 * gi_148;
      if (ModifyMartingale && gi_792 == 1) gd_492 = gd_556;
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gi_472 = gi_700;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_792 >= OnlyAfterLevel) gi_472 = gi_700 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_792 >= OnlyAfterLevel2) gi_472 = gi_700 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_792 >= gi_256) gi_472 = gi_700 + gi_300;
      gd_776 = gd_492;
      gd_756 = gd_532 + gi_472 * Point;
   }
   if (gd_516 == 0.0) gi_792 = 0;
   if (gd_524 == 0.0) gi_788 = 0;
   if (gi_792 > gi_804) gi_804 = gi_792;
   if (gi_788 > gi_800) gi_800 = gi_788;
   f0_24();
   f0_21();
   if (gi_504 || StringSubstr(a1, 0, 1) == "m") f0_18();
   if (!IsTesting()) f0_2();
   return (0);
}

int deinit() {
   gd_856 = AccountBalance() - gd_864;
   if (gd_856 < ControlBalance / 10.0 || gd_856 < 0.0) gd_856 = AccountBalance();
   Print("Min TradeRange Was " + gi_1044);
   Print("Max TradeRange Was " + gi_1040);
   Print("Max DrawDown Percent For Past Day = " + DoubleToStr(100.0 * gd_1132, 2));
   Print("Max Margin Utilization Percentage vs. Equity For Latest Trade Sequence = " + DoubleToStr(100.0 * gd_1140, 2));
   Print("Max DrawDown Percent Ever Reached Was " + DoubleToStr(100.0 * gd_1032, 2));
   Print("Max Buy Martingale Level Reached Was " + gi_800);
   Print("Max Sell Martingale Level Reached Was " + gi_804);
   if (gi_1080 > 0) Print("Level 4 Counter = " + gi_1080);
   if (gi_1084 > 0) Print("Level 5 Counter = " + gi_1084);
   if (gi_1088 > 0) Print("Level 6 Counter = " + gi_1088);
   if (gi_1092 > 0) Print("Level 7 Counter = " + gi_1092);
   if (gi_1096 > 0) Print("Level 8 Counter = " + gi_1096);
   if (gi_1100 > 0) Print("Level 9 Counter = " + gi_1100);
   Print("Working Balance Was " + DoubleToStr(gd_856, 2));
   Print("Funds Withdrawn Was " + DoubleToStr(gd_864, 2));
   f0_17();
   return (0);
}

int start() {
   double ld_0;
   int li_8;
   bool li_12;
   if (Send_Frequency != 0 && Send_Frequency != 60 && Send_Frequency != 240 && Send_Frequency != 480 && Send_Frequency != 720 && Send_Frequency != 1440) {
      Comment("Send_Frequency setting can only be 0, 60, 240, 480, 720 or 1440");
      return (-1);
   }
   if (Send_Minute < 0 || Send_Minute > 59) {
      Comment("Send_Minute must be between 0 and 59");
      return (-1);
   }
   if (gi_1156 != TRUE) {
      Comment("This EA is not licensed for this account");
      return (-1);
   }
   f0_9();
   f0_19();
   if (StopWhenProfitReached && ControlBalance > 0.0 && LockInProfits > 0.0 && gd_864 > 0.0) {
      if (AccountEquity() >= ControlBalance + LockInProfits) {
         Print("Close of all trades due to profit target reached");
         f0_25(OP_BUY);
         f0_25(OP_SELL);
         return (0);
      }
   }
   gi_764 = FALSE;
   if (DoTrades == TRUE && (DayOfWeek() == 1 && MONDAY) || (DayOfWeek() == 2 && TUESDAY) || (DayOfWeek() == 3 && WEDNESDAY) || (DayOfWeek() == 4 && THURSDAY) || (DayOfWeek() == 5 &&
      FRIDAY) || (DayOfWeek() == 0 && SUNDAY)) gi_764 = TRUE;
   f0_29();
   f0_28();
   if (!UseMartingaleDisrupter) f0_0();
   if (UseMartingaleDisrupter) f0_5();
   if (CloseAllBuyTrades) f0_25(OP_BUY);
   if (CloseAllSellTrades) f0_25(OP_SELL);
   if (!gi_440) f0_27();
   if (gi_440) {
      ld_0 = gi_692;
      f0_27();
      if (gi_160 && gi_692 < ld_0) gi_692 = ld_0;
   }
   f0_4();
   if (gi_792 > gi_804) gi_804 = gi_792;
   if (gi_788 > gi_800) gi_800 = gi_788;
   f0_24();
   f0_20();
   if (gi_480 >= 0) {
      gd_492 = gd_524 * gi_148;
      if (ModifyMartingale && gi_788 == 1) gd_492 = gd_556;
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gi_468 = gi_696;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_788 >= OnlyAfterLevel) gi_468 = gi_696 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_788 >= OnlyAfterLevel2) gi_468 = gi_696 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_788 >= gi_256) gi_468 = gi_696 + gi_300;
      gd_768 = gd_492;
      gd_748 = gd_540 - gi_468 * Point;
   }
   if (gi_480 <= 0) {
      gd_492 = gd_516 * gi_148;
      if (ModifyMartingale && gi_792 == 1) gd_492 = gd_556;
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gi_472 = gi_700;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_792 >= OnlyAfterLevel) gi_472 = gi_700 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_792 >= OnlyAfterLevel2) gi_472 = gi_700 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_792 >= gi_256) gi_472 = gi_700 + gi_300;
      gd_776 = gd_492;
      gd_756 = gd_532 + gi_472 * Point;
   }
   if (gd_524 == 0.0 && gi_480 >= 0 && WaitPips > 0 && gd_1112 == 0.0) gd_1112 = Ask - WaitPips * Point;
   if (gi_764 == TRUE && MonitorAndClose == FALSE && gi_480 >= 0 && gd_524 == 0.0 && WaitPips == 0 || Ask <= gd_1112) {
      if (gd_1140 != 0.0) {
         Print("Max Margin Utilization Percentage vs. Equity For Last Trade Sequence = " + DoubleToStr(100.0 * gd_1140, 2));
         gd_1140 = 0.0;
      }
      f0_27();
      gi_1020 = gi_696;
      if (!IsTesting()) {
         gi_1156 = FALSE;
         gi_1156 = f0_1();
         if (gi_1156 != TRUE) {
            if (Send_Email && gi_1108 == FALSE) f0_15();
            gi_1108 = TRUE;
            Comment("This EA is not licensed for this account");
            return (-1);
         }
      }
      if (f0_10() == 1) f0_7(gd_556, MagicNumber);
      gi_1108 = FALSE;
      gd_1112 = 0.0;
      ArrayInitialize(gda_900, 0.0);
      ArrayInitialize(gda_904, 0.0);
      ArrayInitialize(gda_908, 0.0);
      ArrayInitialize(gda_912, 0.0);
      gi_996 = FALSE;
      gi_1104 = 0;
      gi_1004 = 30;
   }
   if (gd_516 == 0.0 && gi_480 <= 0 && WaitPips > 0 && gd_1120 == 0.0) gd_1120 = Bid + WaitPips * Point;
   if (gi_764 == TRUE && MonitorAndClose == FALSE && gi_480 <= 0 && gd_516 == 0.0 && WaitPips == 0 || Bid >= gd_1120) {
      if (gd_1140 != 0.0) {
         Print("Max Margin Utilization Percentage vs. Equity For Last Trade Sequence = " + DoubleToStr(100.0 * gd_1140, 2));
         gd_1140 = 0.0;
      }
      f0_27();
      gi_1020 = gi_700;
      if (!IsTesting()) {
         gi_1156 = FALSE;
         gi_1156 = f0_1();
         if (gi_1156 != TRUE) {
            if (Send_Email && gi_1108 == FALSE) f0_15();
            gi_1108 = TRUE;
            Comment("This EA is not licensed for this account");
            return (-1);
         }
      }
      if (f0_10() == 1) f0_22(gd_556, MagicNumber);
      gd_1120 = 0;
      gi_1108 = FALSE;
      ArrayInitialize(gda_900, 0.0);
      ArrayInitialize(gda_904, 0.0);
      ArrayInitialize(gda_908, 0.0);
      ArrayInitialize(gda_912, 0.0);
      gi_1000 = FALSE;
      gi_1104 = 0;
      gi_1004 = 30;
   }
   if (gi_764 == TRUE || MonitorAndClose == TRUE && gi_480 >= 0 && gd_524 > 0.0) {
      if ((!gi_164 && Ask <= gd_748) || (gi_164 && Ask <= gd_748 && Ask >= gd_748 - gd_168 * Point)) {
         gi_788 = f0_6(2);
         gi_788++;
         f0_14(gd_768);
         if (gi_784 > gi_788) gi_788 = gi_784;
         if (MaxBuyMartingaleLevel == 0 || (gi_788 <= MaxBuyMartingaleLevel && MaxBuyMartingaleLevel > 0)) {
            if (f0_10() == 1) f0_7(gd_768, MagicNumber);
            if (gi_788 == 2) gi_1148 = TRUE;
            ArrayInitialize(gda_900, 0.0);
            ArrayInitialize(gda_904, 0.0);
            ArrayInitialize(gda_908, 0.0);
            ArrayInitialize(gda_912, 0.0);
            if (gi_788 == 4) gi_1080++;
            if (gi_788 == 5) gi_1084++;
            if (gi_788 == 6) gi_1088++;
            if (gi_788 == 7) gi_1092++;
            if (gi_788 == 8) gi_1096++;
            if (gi_788 == 9) gi_1100++;
            gi_996 = FALSE;
            gi_1104 = 0;
            gi_1004 = 30;
         }
         if (UseMartingaleDisrupter && MaxBuyMartingaleLevel > 0 && gi_788 > MaxBuyMartingaleLevel && CloseBuyBeyondMax) {
            Print("Close of all buy trades due to max martingale level surpassed.");
            f0_25(OP_BUY);
         }
      }
   }
   if (gi_764 == TRUE || MonitorAndClose == TRUE && gi_480 <= 0 && gd_516 > 0.0) {
      if ((!gi_164 && Bid >= gd_756) || (gi_164 && Bid >= gd_756 && Bid <= gd_756 + gd_168 * Point)) {
         gi_792 = f0_6(1);
         gi_792++;
         f0_14(gd_776);
         if (gi_784 > gi_792) gi_792 = gi_784;
         if (MaxSellMartingaleLevel == 0 || (gi_792 <= MaxSellMartingaleLevel && MaxSellMartingaleLevel > 0)) {
            if (f0_10() == 1) f0_22(gd_776, MagicNumber);
            if (gi_792 == 2) gi_1148 = TRUE;
            ArrayInitialize(gda_900, 0.0);
            ArrayInitialize(gda_904, 0.0);
            ArrayInitialize(gda_908, 0.0);
            ArrayInitialize(gda_912, 0.0);
            if (gi_792 == 4) gi_1080++;
            if (gi_792 == 5) gi_1084++;
            if (gi_792 == 6) gi_1088++;
            if (gi_792 == 7) gi_1092++;
            if (gi_792 == 8) gi_1096++;
            if (gi_792 == 9) gi_1100++;
            gi_1000 = FALSE;
            gi_1104 = 0;
            gi_1004 = 30;
         }
         if (UseMartingaleDisrupter && MaxSellMartingaleLevel > 0 && gi_792 > MaxSellMartingaleLevel && CloseSellBeyondMax) {
            Print("Close of all sell trades due to max martingale level surpassed.");
            f0_25(OP_SELL);
         }
      }
   }
   gi_1004 += 1;
   if (gd_884 == 0.0 || gd_892 == 0.0) gi_1004 = 30;
   if (gi_1004 >= 2) {
      f0_3();
      gi_1004 = 0;
   }
   f0_26();
   f0_21();
   if (Send_Email) {
      li_8 = Send_Minute + 15;
      if (li_8 > 59) li_8 -= 60;
      if (Minute() > li_8) gi_796 = FALSE;
      if (gi_796 == FALSE) {
         li_12 = FALSE;
         if (Send_Frequency == 60 && Minute() >= Send_Minute && Minute() < li_8) li_12 = TRUE;
         if (Send_Frequency == 240 && Minute() >= Send_Minute && Minute() < li_8 && Hour() == 0 || Hour() == 4 || Hour() == 8 || Hour() == 12 || Hour() == 16 || Hour() == 20) li_12 = TRUE;
         if (Send_Frequency == 480 && Minute() >= Send_Minute && Minute() < li_8 && Hour() == 0 || Hour() == 8 || Hour() == 16) li_12 = TRUE;
         if (Send_Frequency == 720 && Minute() >= Send_Minute && Minute() < li_8 && Hour() == 0 || Hour() == 12) li_12 = TRUE;
         if (Send_Frequency == 1440 && Minute() >= Send_Minute && Minute() < li_8 && Hour() == 0) li_12 = TRUE;
         if (gi_796 == TRUE) li_12 = FALSE;
         if (li_12) {
            f0_18();
            gi_796 = TRUE;
         }
      }
   }
   if (IsTesting()) {
      if (Day() != gi_812) gi_808 = FALSE;
      if (gi_808 == FALSE) {
         f0_23();
         Print("Min TradeRange Used = " + gi_1044);
         Print("Max TradeRange Used = " + gi_1040);
         Print("Max DrawDown Percent For Past Day = " + DoubleToStr(100.0 * gd_1132, 2));
         Print("Max DrawDown Percent Ever Reached is " + DoubleToStr(100.0 * gd_1032, 2));
         Print("Max Buy Martingale Level Reached is " + gi_800);
         Print("Max Sell Martingale Level Reached is " + gi_804);
         Print(gs_1072 + DoubleToStr(100.0 * gd_1064, 2));
         Print("Current Buy TradeRange = " + gi_696);
         Print("Current Sell TradeRange = " + gi_700);
         Print("Current Buy Martingale Level is " + gi_788);
         Print("Current Sell Martingale Level is " + gi_792);
         if (gi_1080 > 0) Print("Level 4 Counter = " + gi_1080);
         if (gi_1084 > 0) Print("Level 5 Counter = " + gi_1084);
         if (gi_1088 > 0) Print("Level 6 Counter = " + gi_1088);
         if (gi_1092 > 0) Print("Level 7 Counter = " + gi_1092);
         if (gi_1096 > 0) Print("Level 8 Counter = " + gi_1096);
         if (gi_1100 > 0) Print("Level 9 Counter = " + gi_1100);
         Print("Working Balance is " + DoubleToStr(gd_856, 2));
         Print("Funds Withdrawn is " + DoubleToStr(gd_864, 2));
         gi_808 = TRUE;
         gi_812 = Day();
         gd_1132 = 0.0;
      }
   }
   if (!IsTesting()) f0_2();
   return (0);
}

double f0_11(string as_0, int ai_8) {
   double ld_12 = 0.0;
   gi_572 = OrdersTotal();
   for (int li_20 = gi_572 - 1; li_20 >= 0; li_20--) {
      if (!OrderSelect(li_20, SELECT_BY_POS, MODE_TRADES)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_20, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderSymbol() == as_0) {
            if (OrderMagicNumber() == MagicNumber) {
               if (ai_8 == 1 && OrderType() == OP_BUY) continue;
               if (ai_8 == 2 && OrderType() == OP_SELL) continue;
               if (OrderCloseTime() == 0) ld_12 += OrderLots();
            }
         }
      }
   }
   return (ld_12);
}

double f0_30(int ai_0) {
   double ld_4 = 0.0;
   bool li_12 = FALSE;
   gi_572 = OrdersTotal();
   for (int li_16 = 0; li_16 <= gi_572 - 1; li_16++) {
      if (!OrderSelect(li_16, SELECT_BY_POS, MODE_TRADES)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_16, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == MagicNumber) {
               if (ai_0 == 1 && OrderType() == OP_BUY) continue;
               if (ai_0 == 2 && OrderType() == OP_SELL) continue;
               if (OrderCloseTime() == 0) {
                  li_12 = FALSE;
                  if (gi_236 && ai_0 == 2) li_12 = TRUE;
                  if (gi_240 && ai_0 == 1) li_12 = TRUE;
                  if (gi_244 && ai_0 == 2 && gi_788 >= OnlyAfterLevel2 && OrderSwap() < 0.0) li_12 = FALSE;
                  if (gi_244 && ai_0 == 1 && gi_792 >= OnlyAfterLevel2 && OrderSwap() < 0.0) li_12 = FALSE;
                  ld_4 += OrderProfit();
                  if (li_12) ld_4 += OrderSwap();
               }
            }
         }
      }
   }
   return (ld_4);
}

void f0_24() {
   int li_0 = LookBackDays;
   double ld_4 = iHigh(Symbol(), PERIOD_D1, iHighest(Symbol(), PERIOD_D1, MODE_HIGH, li_0, 0));
   double ld_12 = iLow(Symbol(), PERIOD_D1, iLowest(Symbol(), PERIOD_D1, MODE_LOW, li_0, 0));
   gd_548 = (ld_4 + ld_12) / 2.0;
   for (gd_548 = NormalizeDouble(gd_548, Digits); (ld_4 - ld_12) / Point < LookBackMinimumPips && li_0 < 365; gd_548 = NormalizeDouble(gd_548, Digits)) {
      li_0++;
      ld_4 = iHigh(Symbol(), PERIOD_D1, iHighest(Symbol(), PERIOD_D1, MODE_HIGH, li_0, 0));
      ld_12 = iLow(Symbol(), PERIOD_D1, iLowest(Symbol(), PERIOD_D1, MODE_LOW, li_0, 0));
      gd_548 = (ld_4 + ld_12) / 2.0;
   }
}

void f0_17() {
   string ls_4;
   int li_0 = ObjectsTotal();
   for (int li_12 = 0; li_12 < li_0; li_12++) {
      ls_4 = ObjectName(li_12);
      if (ls_4 != "") ObjectDelete(ls_4);
   }
   ObjectDelete("FLP_txt");
   ObjectDelete("P_txt");
}

void f0_25(int ai_0) {
   int li_16;
   int li_20;
   double ld_24;
   string ls_32;
   int li_4 = OrdersTotal();
   for (int li_8 = 0; li_8 < 5; li_8++) {
      for (int li_12 = 0; li_12 < li_4; li_12++) {
         while (!IsTradeAllowed()) {
         }
         OrderSelect(li_12, SELECT_BY_POS, MODE_TRADES);
         li_16 = OrderType();
         li_20 = OrderTicket();
         ld_24 = OrderLots();
         ls_32 = OrderSymbol();
         if (ls_32 == Symbol() && li_16 == OP_BUY && li_16 == ai_0 && OrderMagicNumber() == MagicNumber) OrderClose(li_20, ld_24, MarketInfo(ls_32, MODE_BID), 3, CLR_NONE);
         if (ls_32 == Symbol() && li_16 == OP_SELL && li_16 == ai_0 && OrderMagicNumber() == MagicNumber) OrderClose(li_20, ld_24, MarketInfo(ls_32, MODE_ASK), 3, CLR_NONE);
      }
   }
}

double f0_8(int ai_0) {
   double ld_4 = 0.0;
   double ld_12 = 0.0;
   gi_572 = OrdersTotal();
   double ld_20 = 0.0;
   double ld_28 = 0.0;
   double ld_36 = MathFloor(gi_696 / 2) * Point;
   if (ai_0 == 1) ld_36 = MathFloor(gi_700 / 2) * Point;
   bool li_44 = FALSE;
   bool li_48 = FALSE;
   if (ai_0 == 1) gd_832 = 0.0;
   if (ai_0 == 2) gd_824 = 0.0;
   if (ai_0 == 1) gd_848 = 0.0;
   if (ai_0 == 2) gd_840 = 0.0;
   int li_52 = 0;
   for (int li_56 = gi_572 - 1; li_56 >= 0; li_56--) {
      if (!OrderSelect(li_56, SELECT_BY_POS, MODE_TRADES)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_56, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == MagicNumber) {
               if (OrderCloseTime() == 0) {
                  if (ai_0 == 1 && OrderType() == OP_BUY) continue;
                  if (ai_0 == 2 && OrderType() == OP_SELL) continue;
                  if (ai_0 == 2 && ld_12 != 0.0 && OrderOpenPrice() > ld_12 + ld_36 || (!AllowLotsBeyondMaxSize)) {
                     if (li_48 == FALSE) gd_824 = OrderOpenPrice();
                     gd_824 = NormalizeDouble(gd_824, Digits);
                     gd_840 = OrderLots();
                     li_48 = TRUE;
                     continue;
                  }
                  if (ai_0 == 1 && ld_12 != 0.0 && OrderOpenPrice() < ld_12 - ld_36 || (!AllowLotsBeyondMaxSize)) {
                     if (li_44 == FALSE) gd_832 = OrderOpenPrice();
                     gd_832 = NormalizeDouble(gd_832, Digits);
                     gd_848 = OrderLots();
                     li_44 = TRUE;
                     continue;
                  }
                  if (MathAbs(ld_12 - OrderOpenPrice()) > ld_36 || (!AllowLotsBeyondMaxSize)) ld_4 = OrderLots();
                  if (MathAbs(ld_12 - OrderOpenPrice()) < ld_36 && AllowLotsBeyondMaxSize) ld_4 += OrderLots();
                  gd_580 = OrderOpenPrice();
                  ld_12 = OrderOpenPrice();
               }
            }
         }
      }
   }
   return (ld_4);
}

void f0_16(int ai_0, double ad_4) {
   double ld_12 = 0.0;
   gi_572 = OrdersTotal();
   double ld_20 = 0.0;
   double ld_28 = 0.0;
   for (int li_36 = gi_572 - 1; li_36 >= 0; li_36--) {
      if (!OrderSelect(li_36, SELECT_BY_POS, MODE_TRADES)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_36, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == MagicNumber) {
               if (OrderCloseTime() == 0) {
                  if (ai_0 == 1 && OrderType() == OP_BUY) continue;
                  if (ai_0 == 2 && OrderType() == OP_SELL) continue;
                  if (ai_0 == 2 && ad_4 != 0.0) ld_20 = NormalizeDouble(ad_4, Digits);
                  if (ai_0 == 1 && ad_4 != 0.0) ld_20 = NormalizeDouble(ad_4, Digits);
                  if (ai_0 == 2 && StopLoss != 0) ld_28 = NormalizeDouble(gd_540 - StopLoss * Point, Digits);
                  if (ai_0 == 1 && StopLoss != 0) ld_28 = NormalizeDouble(gd_532 + StopLoss * Point, Digits);
                  if (gi_984 == FALSE) {
                     if (OrderTakeProfit() != ld_20 && ld_20 != 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(ld_20, Digits), 0, CLR_NONE);
                     if (StopLoss != 0 && OrderStopLoss() != ld_28 && ld_28 != 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(ld_28, Digits), OrderTakeProfit(), 0, CLR_NONE);
                  }
                  if (gi_984 == TRUE) {
                     if (OrderTakeProfit() != 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 0.0, 0, CLR_NONE);
                     if (OrderStopLoss() != 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), 0.0, OrderTakeProfit(), 0, CLR_NONE);
                     if (ld_28 != 0.0 && StopLoss != 0 && ai_0 == 2 && Bid <= ld_28) OrderClose(OrderTicket(), OrderLots(), MarketInfo(Symbol(), MODE_BID), 3, CLR_NONE);
                     if (ld_28 != 0.0 && StopLoss != 0 && ai_0 == 1 && Ask >= ld_28) OrderClose(OrderTicket(), OrderLots(), MarketInfo(Symbol(), MODE_ASK), 3, CLR_NONE);
                  }
               }
            }
         }
      }
   }
}

int f0_10() {
   int li_4;
   int li_0 = 30;
   if (!IsTradeAllowed()) {
      li_4 = GetTickCount();
      Print("Trade context is busy! Wait until it is free...");
      while (true) {
         if (IsStopped()) {
            Print("The expert was terminated by the user!");
            return (-1);
         }
         if (GetTickCount() - li_4 > 1000 * li_0) {
            Print("The waiting limit exceeded (" + li_0 + " ???.)!");
            return (-2);
         }
         if (IsTradeAllowed()) {
            Print("Trade context has become free!");
            RefreshRates();
            return (1);
         }
         Sleep(100);
      }
   }
   return (1);
}

int f0_7(double ad_0, int ai_8) {
   int li_44;
   int li_48;
   int li_52;
   double ld_56;
   double ld_12 = MarketInfo(Symbol(), MODE_MAXLOT);
   double ld_20 = MarketInfo(Symbol(), MODE_MINLOT);
   double ld_28 = ad_0;
   double ld_36 = 0.0;
   if (!AllowLotsBeyondMaxSize && ld_28 > ld_12) ld_28 = ld_12;
   ld_36 = 0.0;
   ld_36 = NormalizeDouble(ld_36, Digits);
   while (true) {
      while (ld_28 > 0.0) {
         ad_0 = ld_28;
         if (ad_0 > ld_12) ad_0 = ld_12;
         if (ad_0 < ld_20) ad_0 = ld_20;
         ad_0 = NormalizeDouble(ad_0, gi_740);
         ld_28 -= ad_0;
         li_44 = gi_744;
         li_48 = 0;
         li_52 = -1;
         ld_56 = 0.0;
         if (gi_144 == TRUE && gi_596 != 0) {
            ld_56 = Ask + gi_596 * Point;
            ld_56 = NormalizeDouble(ld_56, Digits);
         }
         if (gi_144 == FALSE && gi_600 != 0 && gi_596 != 0) {
            ld_56 = Ask + (gi_596 + gi_600) * Point;
            ld_56 = NormalizeDouble(ld_56, Digits);
         }
         ld_56 = 0.0;
         ld_56 = NormalizeDouble(ld_56, Digits);
         gs_604 = _Comment + " " + DoubleToStr(ai_8, 0);
         while (li_52 == -1 && li_48 <= gi_612) {
            li_52 = OrderSend(Symbol(), OP_BUY, ad_0, Ask, li_44, ld_36, ld_56, gs_604, ai_8, 0, gi_616);
            li_48++;
            if (li_52 >= 0) break;
            if (li_48 > gi_612) break;
            Sleep(1000);
         }
         if (li_52 != 0) {
            gi_576 = GetLastError();
            if (gi_624 == TRUE) Alert("Error OrderSend # ", gi_576);
         }
         if (ld_28 > 0.0) continue;
      }
      break;
   }
   return (0);
}

int f0_22(double ad_0, int ai_8) {
   int li_44;
   int li_48;
   int li_52;
   double ld_56;
   double ld_12 = MarketInfo(Symbol(), MODE_MAXLOT);
   double ld_20 = MarketInfo(Symbol(), MODE_MINLOT);
   double ld_28 = ad_0;
   double ld_36 = 0.0;
   if (!AllowLotsBeyondMaxSize && ld_28 > ld_12) ld_28 = ld_12;
   ld_36 = 0.0;
   ld_36 = NormalizeDouble(ld_36, Digits);
   while (true) {
      while (ld_28 > 0.0) {
         ad_0 = ld_28;
         if (ad_0 > ld_12) ad_0 = ld_12;
         if (ad_0 < ld_20) ad_0 = ld_20;
         ad_0 = NormalizeDouble(ad_0, gi_740);
         ld_28 -= ad_0;
         li_44 = gi_744;
         li_48 = 0;
         li_52 = -1;
         ld_56 = 0.0;
         if (gi_144 == TRUE && gi_596 != 0) {
            ld_56 = Bid - gi_596 * Point;
            ld_56 = NormalizeDouble(ld_56, Digits);
         }
         if (gi_144 == FALSE && gi_600 != 0 && gi_596 != 0) {
            ld_56 = Bid - (gi_596 + gi_600) * Point;
            ld_56 = NormalizeDouble(ld_56, Digits);
         }
         ld_56 = 0.0;
         ld_56 = NormalizeDouble(ld_56, Digits);
         gs_604 = _Comment + " " + DoubleToStr(ai_8, 0);
         while (li_52 == -1 && li_48 <= gi_612) {
            li_52 = OrderSend(Symbol(), OP_SELL, ad_0, Bid, li_44, ld_36, ld_56, gs_604, ai_8, 0, gi_620);
            li_48++;
            if (li_52 >= 0) break;
            if (li_48 > gi_612) break;
            Sleep(1000);
         }
         if (li_52 != 0) {
            gi_576 = GetLastError();
            if (gi_624 == TRUE) Alert("Error OrderSend # ", gi_576);
         }
         if (ld_28 > 0.0) continue;
      }
      break;
   }
   return (0);
}

void f0_2() {
   string ls_0 = "TRUE";
   if (DoTrades == FALSE) ls_0 = "FALSE";
   string ls_8 = "False";
   if (gi_1156 == TRUE) ls_8 = "True";
   string ls_16 = "False";
   if (MonitorAndClose) ls_16 = "True";
   int li_24 = gi_788;
   int li_28 = gi_792;
   if (gd_516 == 0.0) gi_792 = 0;
   if (gd_524 == 0.0) gi_788 = 0;
   string ls_32 = "False";
   if (UseGridExpander) ls_32 = "True";
   string ls_40 = "True ";
   if (!CloseBuyBeyondMax) ls_40 = "False";
   string ls_48 = "True ";
   if (!CloseSellBeyondMax) ls_48 = "False";
   f0_23();
   string ls_56 = "Buy and Sell";
   if (TradeDirection == -1) ls_56 = "Sell Only";
   if (TradeDirection == 1) ls_56 = "Buy Only";
   if (TradeDirection == 2) ls_56 = "Alternate Between Buy and Sell";
   if (TradeDirection == 3) ls_56 = "Buy or Sell Determined by CounterTrend Calculation";
   if (TradeDirection == 4) ls_56 = "Buy or Sell Determined by Trend Calculation";
   int li_64 = MathFloor(gd_1012 / gd_432);
   if (Digits == 3 || Digits == 5) li_64 /= 10;
   int li_68 = gd_1012;
   if (Digits == 3 || Digits == 5) li_68 /= 10;
   if (OnlyAfterLevel2 != 0 && gi_256 != 0) {
      Comment("\n" 
         + gs_84, 
         "\n" 
         + "\nCurrent Server Time = " + TimeToStr(TimeCurrent(), TIME_SECONDS) 
         + "\nAccount Leverage =", AccountLeverage() 
         + "\nSpread = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) 
         + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) 
         + "\n" 
         + gs_1072 + DoubleToStr(100.0 * gd_1064, 2) 
         + "\n\nTradeLots = " + DoubleToStr(TradeLots, gi_740) 
         + "\nBase Lots = " + DoubleToStr(gd_556, gi_740) 
         + "\nMagic Number = " + MagicNumber 
         + "\nTrade Direction = " + ls_56 
         + "\nPrice Where Trade Direction Changes = " + DoubleToStr(gd_548, Digits) 
         + "\nSet TradeRange = " + TradeRange 
         + "\nAverage True Range = " + DoubleToStr(li_68, 0) 
         + "\nCalculated Trade Range = " + DoubleToStr(li_64, 0) 
         + "\n\nNext Buy Price = " + DoubleToStr(gd_748, Digits) 
         + "\nBuy Side TakeProfit = " + DoubleToStr(gd_884, Digits) 
         + "\nCalculated Buy Disrupter Price = " + DoubleToStr(gd_932, Digits) 
         + "\nNext Buy Lots = " + DoubleToStr(gd_768, gi_740) 
         + "\n\nNext Sell Price = " + DoubleToStr(gd_756, Digits) 
         + "\nSell Side TakeProfit = " + DoubleToStr(gd_892, Digits) 
         + "\nCalculated Sell Disrupter Price = " + DoubleToStr(gd_956, Digits) 
         + "\nNext Sell Lots = " + DoubleToStr(gd_776, gi_740) 
         + "\n\nCurrent Buy Level = " + li_24 
         + "\nCurrent Buy Side Profit = " + DoubleToStr(f0_30(2), 2) 
         + "\n\nCurrent Sell Level = " + li_28 
         + "\nCurrent Sell Side Profit = " + DoubleToStr(f0_30(1), 2) 
         + "\n\nMaximum Sell Level Reached = " + gi_804 
         + "\nMaximum Buy Level Reached = " + gi_800 
         + "\n\nAccount Authorized = " + ls_8 
         + "\n\nMonitor And Close = " + ls_16 
      + "\nDoTrades = " + ls_0);
   }
   if (OnlyAfterLevel2 != 0 && gi_256 == 0) {
      Comment("\n" 
         + gs_84, 
         "\n" 
         + "\nCurrent Server Time = " + TimeToStr(TimeCurrent(), TIME_SECONDS) 
         + "\nAccount Leverage =", AccountLeverage() 
         + "\nSpread = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) 
         + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) 
         + "\n" 
         + gs_1072 + DoubleToStr(100.0 * gd_1064, 2) 
         + "\n\nTradeLots = " + DoubleToStr(TradeLots, gi_740) 
         + "\nBase Lots = " + DoubleToStr(gd_556, gi_740) 
         + "\nMagic Number = " + MagicNumber 
         + "\nTrade Direction = " + ls_56 
         + "\nPrice Where Trade Direction Changes = " + DoubleToStr(gd_548, Digits) 
         + "\nSet TradeRange = " + TradeRange 
         + "\nAverage True Range = " + DoubleToStr(li_68, 0) 
         + "\nCalculated Trade Range = " + DoubleToStr(li_64, 0) 
         + "\nMaximum Allowed Buy Level = " + MaxBuyMartingaleLevel 
         + "\nMaximum Allowed Sell Level = " + MaxSellMartingaleLevel 
         + "\n\nNext Buy Price = " + DoubleToStr(gd_748, Digits) 
         + "\nBuy Side TakeProfit = " + DoubleToStr(gd_884, Digits) 
         + "\nCalculated Buy Disrupter Price = " + DoubleToStr(gd_932, Digits) 
         + "\nNext Buy Lots = " + DoubleToStr(gd_768, gi_740) 
         + "\n\nNext Sell Price = " + DoubleToStr(gd_756, Digits) 
         + "\nSell Side TakeProfit = " + DoubleToStr(gd_892, Digits) 
         + "\nCalculated Sell Disrupter Price = " + DoubleToStr(gd_956, Digits) 
         + "\nNext Sell Lots = " + DoubleToStr(gd_776, gi_740) 
         + "\n\nCurrent Buy Level = " + li_24 
         + "\nCurrent Buy Side Profit = " + DoubleToStr(f0_30(2), 2) 
         + "\n\nCurrent Sell Level = " + li_28 
         + "\nCurrent Sell Side Profit = " + DoubleToStr(f0_30(1), 2) 
         + "\n\nMaximum Sell Level Reached = " + gi_804 
         + "\nMaximum Buy Level Reached = " + gi_800 
         + "\n\nAccount Authorized = " + ls_8 
         + "\n\nMonitor And Close = " + ls_16 
      + "\nDoTrades = " + ls_0);
   }
   if (OnlyAfterLevel2 == 0 && gi_256 == 0) {
      Comment("\n" 
         + gs_84, 
         "\n" 
         + "\nCurrent Server Time = " + TimeToStr(TimeCurrent(), TIME_SECONDS) 
         + "\nAccount Leverage =", AccountLeverage() 
         + "\nSpread = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) 
         + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) 
         + "\n" 
         + gs_1072 + DoubleToStr(100.0 * gd_1064, 2) 
         + "\n\nTradeLots = " + DoubleToStr(TradeLots, gi_740) 
         + "\nBase Lots = " + DoubleToStr(gd_556, gi_740) 
         + "\nMagic Number = " + MagicNumber 
         + "\nTrade Direction = " + ls_56 
         + "\nPrice Where Trade Direction Changes = " + DoubleToStr(gd_548, Digits) 
         + "\nSet TradeRange = " + TradeRange 
         + "\nAverage True Range = " + DoubleToStr(li_68, 0) 
         + "\nCalculated Trade Range = " + DoubleToStr(li_64, 0) 
         + "\nMaximum Allowed Buy Level = " + MaxBuyMartingaleLevel 
         + "\nMaximum Allowed Sell Level = " + MaxSellMartingaleLevel 
         + "\n\nNext Buy Price = " + DoubleToStr(gd_748, Digits) 
         + "\nBuy Side TakeProfit = " + DoubleToStr(gd_884, Digits) 
         + "\nCalculated Buy Disrupter Price = " + DoubleToStr(gd_932, Digits) 
         + "\nNext Buy Lots = " + DoubleToStr(gd_768, gi_740) 
         + "\n\nNext Sell Price = " + DoubleToStr(gd_756, Digits) 
         + "\nSell Side TakeProfit = " + DoubleToStr(gd_892, Digits) 
         + "\nCalculated Sell Disrupter Price = " + DoubleToStr(gd_956, Digits) 
         + "\nNext Sell Lots = " + DoubleToStr(gd_776, gi_740) 
         + "\n\nCurrent Buy Level = " + li_24 
         + "\nCurrent Buy Side Profit = " + DoubleToStr(f0_30(2), 2) 
         + "\n\nCurrent Sell Level = " + li_28 
         + "\nCurrent Sell Side Profit = " + DoubleToStr(f0_30(1), 2) 
         + "\n\nMaximum Sell Level Reached = " + gi_804 
         + "\nMaximum Buy Level Reached = " + gi_800 
         + "\n\nAccount Authorized = " + ls_8 
         + "\n\nMonitor And Close = " + ls_16 
      + "\nDoTrades = " + ls_0);
   }
}

double f0_12(int ai_0) {
   gi_572 = OrdersHistoryTotal();
   int li_4 = 0;
   bool li_8 = FALSE;
   int li_12 = 0;
   int li_16 = 0;
   for (int li_20 = gi_572 - 1; li_20 >= 0; li_20--) {
      if (!OrderSelect(li_20, SELECT_BY_POS, MODE_HISTORY)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_20, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderMagicNumber() == MagicNumber) {
            if (OrderSymbol() == Symbol()) {
               if (OrderCloseTime() != 0) {
                  if (ai_0 == 1 && OrderType() == OP_BUY) continue;
                  if (ai_0 == 2 && OrderType() == OP_SELL) continue;
                  if (OrderCloseTime() > li_4) {
                     li_4 = OrderCloseTime();
                     li_12 = OrderTicket();
                     li_8 = TRUE;
                  }
               }
            }
         }
      }
   }
   if (li_8 == TRUE) {
      for (li_20 = gi_572 - 1; li_20 >= 0; li_20--) {
         if (!OrderSelect(li_20, SELECT_BY_POS, MODE_HISTORY)) {
            gi_576 = GetLastError();
            Print("OrderSelect( ", li_20, ", SELECT_BY_POS ) - Error #", gi_576);
         } else {
            if (OrderSymbol() == Symbol())
               if (OrderTicket() == li_12) return (OrderProfit());
         }
      }
   }
   return (0.0);
}

void f0_28() {
   double ld_8;
   double ld_0 = MarketInfo(Symbol(), MODE_LOTSIZE);
   if (TradeLots != 0.0) {
      gd_492 = TradeLots;
      if (gd_492 < MarketInfo(Symbol(), MODE_MINLOT)) gd_492 = MarketInfo(Symbol(), MODE_MINLOT);
      if (gd_492 > MarketInfo(Symbol(), MODE_MAXLOT)) gd_492 = MarketInfo(Symbol(), MODE_MAXLOT);
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gd_556 = NormalizeDouble(gd_492, gi_740);
   }
   if (TradeLots == 0.0) {
      ld_8 = BalanceFactor;
      ld_8 /= 100000 / ld_0;
      gd_492 = MathFloor(gd_856 / ld_8) / 100.0;
      if (gd_492 > MaxLots) gd_492 = MaxLots;
      if (gd_492 < MarketInfo(Symbol(), MODE_MINLOT)) gd_492 = MarketInfo(Symbol(), MODE_MINLOT);
      if (gd_492 > MarketInfo(Symbol(), MODE_MAXLOT)) gd_492 = MarketInfo(Symbol(), MODE_MAXLOT);
      gd_492 = NormalizeDouble(gd_492, gi_740);
      gd_556 = NormalizeDouble(gd_492, gi_740);
   }
}

void f0_14(double ad_0) {
   gi_784 = 0;
   if (ad_0 == gd_556) gi_784 = 0;
   if (ad_0 == gd_556 * gi_148) gi_784 = 1;
   if (ad_0 == gd_556 * MathPow(gi_148, 2)) gi_784 = 2;
   if (ad_0 == gd_556 * MathPow(gi_148, 3)) gi_784 = 3;
   if (ad_0 == gd_556 * MathPow(gi_148, 4)) gi_784 = 4;
   if (ad_0 == gd_556 * MathPow(gi_148, 5)) gi_784 = 5;
   if (ad_0 == gd_556 * MathPow(gi_148, 6)) gi_784 = 6;
   if (ad_0 == gd_556 * MathPow(gi_148, 7)) gi_784 = 7;
   if (ad_0 == gd_556 * MathPow(gi_148, 8)) gi_784 = 8;
   if (ad_0 == gd_556 * MathPow(gi_148, 9)) gi_784 = 9;
   if (ad_0 == gd_556 * MathPow(gi_148, 10)) gi_784 = 10;
   if (ad_0 == gd_556 * MathPow(gi_148, 11)) gi_784 = 11;
   if (ad_0 == gd_556 * MathPow(gi_148, 12)) gi_784 = 12;
   if (ad_0 == gd_556 * MathPow(gi_148, 13)) gi_784 = 13;
   if (ad_0 == gd_556 * MathPow(gi_148, 14)) gi_784 = 14;
   if (ad_0 == gd_556 * MathPow(gi_148, 15)) gi_784 = 15;
   if (ad_0 == gd_556 * MathPow(gi_148, 16)) gi_784 = 16;
   if (ad_0 == gd_556 * MathPow(gi_148, 17)) gi_784 = 17;
   gi_784++;
}

double f0_6(int ai_0) {
   gi_572 = OrdersTotal();
   int li_4 = 0;
   double ld_8 = MathFloor(gi_696 / 2) * Point;
   if (ai_0 == 1) ld_8 = MathFloor(gi_700 / 2) * Point;
   double ld_16 = 0.0;
   for (int li_24 = gi_572 - 1; li_24 >= 0; li_24--) {
      if (!OrderSelect(li_24, SELECT_BY_POS, MODE_TRADES)) {
         gi_576 = GetLastError();
         Print("OrderSelect( ", li_24, ", SELECT_BY_POS ) - Error #", gi_576);
      } else {
         if (OrderSymbol() == Symbol()) {
            if (OrderMagicNumber() == MagicNumber) {
               if (OrderCloseTime() == 0) {
                  if (ai_0 == 1 && OrderType() == OP_BUY) continue;
                  if (ai_0 == 2 && OrderType() == OP_SELL) continue;
                  if (AllowLotsBeyondMaxSize && ld_16 == 0.0 || MathAbs(ld_16 - OrderOpenPrice()) >= ld_8) li_4++;
                  if (!AllowLotsBeyondMaxSize) li_4++;
                  ld_16 = OrderOpenPrice();
               }
            }
         }
      }
   }
   return (li_4);
}

void f0_18() {
   if (gi_500) {
      SendMail("PipStrider Report", " " + Symbol() + " account = " + DoubleToStr(AccountNumber(), 0) + " BuyLevel = " + DoubleToStr(gi_788, 0) + " SellLevel = " + DoubleToStr(gi_792,
         0) + " BuySide = " + DoubleToStr(f0_30(2), 2) + " SellSide = " + DoubleToStr(f0_30(1), 2));
      Sleep(5000);
      SendMail("PipStrider Report-2", " " + Symbol() + " account = " + DoubleToStr(AccountNumber(), 0) + " MaxBuyLevel Reached = " + DoubleToStr(gi_800, 0) + " MaxSellLevel Reached = " +
         DoubleToStr(gi_804, 0) + " Balance = " + DoubleToStr(AccountBalance(), 2) + " Equity = " + DoubleToStr(AccountEquity(), 2));
   }
   if (!gi_500) {
      SendMail("PipStrider Rpt.", " " + Symbol() + " account = " + DoubleToStr(AccountNumber(), 0) + " BuyLevel = " + DoubleToStr(gi_788, 0) + ", " + DoubleToStr(gi_800,
         0) + " SellLevel = " + DoubleToStr(gi_792, 0) + ", " + DoubleToStr(gi_804, 0) + " BuySide = " + DoubleToStr(f0_30(2), 2) + " SellSide = " + DoubleToStr(f0_30(1),
         2) + " Balance = " + DoubleToStr(AccountBalance(), 2) + " Equity = " + DoubleToStr(AccountEquity(), 2));
   }
}

void f0_13() {
   SendMail("PipStrider Rpt.", " " + Symbol() + " account = " + DoubleToStr(AccountNumber(), 0) + " Your profit goal has been reached and you have money waiting to withdraw from your account. " +
      " Balance = " + DoubleToStr(AccountBalance(), 2) + " Equity = " + DoubleToStr(AccountEquity(), 2));
}

void f0_15() {
   SendMail("PipStrider Notice:", " " + Symbol() + " account = " + DoubleToStr(AccountNumber(), 0) + " Something has happened. This account is not enabled for the PipStrider." +
      " Please restart the EA.");
}

void f0_5() {
   if (!LimitToThisPair) {
      gd_1024 = (AccountBalance() - AccountEquity()) / AccountBalance();
      if (100.0 * gd_1024 > MaxDrawDownPct) {
         f0_25(OP_BUY);
         f0_25(OP_SELL);
         f0_28();
      }
   }
   if (LimitToThisPair) {
      gd_1024 = (AccountBalance() - (AccountBalance() + f0_30(1) + f0_30(2))) / AccountBalance();
      if (100.0 * gd_1024 > MaxDrawDownPct) {
         f0_25(OP_BUY);
         f0_25(OP_SELL);
         f0_28();
      }
   }
   if (gd_1024 > gd_1032) gd_1032 = gd_1024;
   if (gd_1024 > gd_1132) gd_1132 = gd_1024;
   double ld_0 = AccountMargin() / AccountEquity();
   if (ld_0 > gd_1140) gd_1140 = ld_0;
   gi_872 = FALSE;
   if (DisrupterClose != 0.0 && gi_788 >= OnlyAfterLevel && gi_788 < OnlyAfterLevel2 && f0_30(2) >= DisrupterClose) gi_872 = TRUE;
   if (DisrupterClose2 != 0.0 && gi_788 >= OnlyAfterLevel2 && f0_30(2) >= DisrupterClose2) gi_872 = TRUE;
   if (gi_872) {
      f0_25(OP_BUY);
      gi_872 = FALSE;
   }
   gi_872 = FALSE;
   if (DisrupterClose != 0.0 && gi_792 >= OnlyAfterLevel && gi_792 < OnlyAfterLevel2 && f0_30(1) >= DisrupterClose) gi_872 = TRUE;
   if (DisrupterClose2 != 0.0 && gi_792 >= OnlyAfterLevel2 && f0_30(1) >= DisrupterClose2) gi_872 = TRUE;
   if (gi_872) {
      f0_25(OP_SELL);
      gi_872 = FALSE;
   }
}

void f0_4() {
   gd_524 = f0_8(2);
   gi_788 = f0_6(2);
   f0_14(gd_524);
   if (gi_784 > gi_788) gi_788 = gi_784;
   if (gd_524 == 0.0) gi_788 = 0;
   gd_540 = gd_580;
   gd_516 = f0_8(1);
   gi_792 = f0_6(1);
   f0_14(gd_516);
   if (gi_784 > gi_792) gi_792 = gi_784;
   if (gd_516 == 0.0) gi_792 = 0;
   gd_532 = gd_580;
}

void f0_3() {
   f0_4();
   if (gi_480 >= 0 && gd_524 > gd_840 || (gi_788 == 2 && gi_1148)) {
      gi_1148 = FALSE;
      gi_468 = gi_1020;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_788 >= OnlyAfterLevel) gi_468 = gi_1020 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_788 >= OnlyAfterLevel2) gi_468 = gi_1020 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_788 >= gi_256) gi_468 = gi_1020 + gi_300;
      gd_876 = 0.0;
      gi_476 = gi_468;
      gd_876 = gd_540 + gi_476 * Point;
      if (gi_180 && gi_788 > 1 && gd_824 != 0.0) gd_876 = gd_824;
      if (gd_932 != 0.0 && gd_876 < gd_932 && gd_932 > gd_884 && MathAbs(gd_932 - gd_876) < gi_992 * Point && AdjustTakeProfit) gd_876 = gd_932;
      gd_876 = NormalizeDouble(gd_876, Digits);
      if (gi_788 == 0) gd_884 = 0.0;
      if (AdjustTakeProfit && gi_788 > 0 && gi_996 == FALSE || gd_884 == 0.0 || gd_876 > gd_884) gd_884 = gd_876;
      if (!AdjustTakeProfit && gi_788 > 0) gd_884 = gd_876;
      if (gi_984) gd_1056 = 0.0;
      if (gi_788 > 0) {
         if (gd_884 != gd_1056) f0_16(2, gd_884);
         gd_1056 = gd_884;
         gi_996 = TRUE;
      }
   }
   if (gi_480 <= 0 && gd_516 > gd_848 || (gi_792 == 2 && gi_1148)) {
      gi_1148 = FALSE;
      gi_472 = gi_1020;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_792 >= OnlyAfterLevel) gi_472 = gi_1020 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_792 >= OnlyAfterLevel2) gi_472 = gi_1020 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_792 >= gi_256) gi_472 = gi_1020 + gi_300;
      gd_876 = 0.0;
      gi_476 = gi_472;
      gd_876 = gd_532 - gi_476 * Point;
      if (gi_180 && gi_792 > 1 && gd_832 != 0.0) gd_876 = gd_832;
      if (gd_956 != 0.0 && gd_876 > gd_956 && gd_956 < gd_892 && MathAbs(gd_876 - gd_956) < gi_992 * Point && AdjustTakeProfit) gd_876 = gd_956;
      gd_876 = NormalizeDouble(gd_876, Digits);
      if (gi_792 == 0) gd_892 = 0.0;
      if (AdjustTakeProfit && gi_792 > 0 && gi_1000 == FALSE || gd_892 == 0.0 || gd_876 < gd_892) gd_892 = gd_876;
      if (!AdjustTakeProfit && gi_792 > 0) gd_892 = gd_876;
      if (gi_984) gd_1048 = 0.0;
      if (gi_792 > 0) {
         if (gd_892 != gd_1048) f0_16(1, gd_892);
         gd_1048 = gd_892;
         gi_1000 = TRUE;
      }
   }
   if (gi_984 && gd_884 != 0.0 && Bid >= gd_884) {
      f0_25(OP_BUY);
      gi_1104 = 1;
      gi_788 = 0;
   }
   if (gi_984 && gd_892 != 0.0 && Ask <= gd_892) {
      f0_25(OP_SELL);
      gi_792 = 0;
      gi_1104 = 1;
   }
   if (gd_884 != 0.0 && Bid >= gd_884) {
      f0_25(OP_BUY);
      gi_788 = 0;
      gi_1104 = 1;
   }
   if (gd_892 != 0.0 && Ask <= gd_892) {
      f0_25(OP_SELL);
      gi_792 = 0;
      gi_1104 = 1;
   }
}

void f0_19() {
   double ld_0;
   if (ControlBalance != 0.0 && LockInProfits != 0.0) {
      ld_0 = AccountEquity() - gd_864;
      if (ld_0 >= ControlBalance + LockInProfits) {
         if (AccountEquity() - ControlBalance < 2.0 * LockInProfits) {
            Print("All trades being closed due to Profit Target Reached.");
            f0_25(OP_BUY);
            f0_25(OP_SELL);
            gi_788 = 0;
            gi_792 = 0;
            Print("All trades were closed due to Profit Target Reached.");
            if (Send_Email) f0_13();
         }
         gd_864 += LockInProfits;
      }
   }
   gd_856 = AccountBalance() - gd_864;
   if (gd_856 < ControlBalance) gd_856 += gd_864;
}

void f0_9() {
   gi_800 = GlobalVariableGet("GVMaxBuyLevel" + gs_816 + Symbol());
   gi_804 = GlobalVariableGet("GVMaxSellLevel" + gs_816 + Symbol());
   gd_864 = GlobalVariableGet("GVFundsWithdrawn" + gs_816 + Symbol());
}

void f0_21() {
   GlobalVariableSet("GVMaxBuyLevel" + gs_816 + Symbol(), gi_800);
   GlobalVariableSet("GVMaxSellLevel" + gs_816 + Symbol(), gi_804);
   GlobalVariableSet("GVFundsWithdrawn" + gs_816 + Symbol(), gd_864);
}

int f0_1() {
   /*
   bool li_0 = FALSE;
   gi_1160 = AccountNumber();
   if (!IsDemo()) gi_1164 = 7;
   if (IsDemo()) gi_1164 = 8;
   li_0 = get_req(gi_1164, gi_1160);
   if (li_0 != TRUE && IsDemo()) {
      Sleep(1000);
      li_0 = get_req(gi_1164, gi_1160);
      if (li_0 != TRUE)
         if (gi_76) gi_1160 = gi_80;
   }
   if (li_0 != TRUE) {
      Sleep(1000);
      li_0 = get_req(gi_1164, gi_1160);
   }
   if (li_0 != TRUE) {
      Sleep(2000);
      li_0 = get_req(gi_1164, gi_1160);
   }
   if (li_0 != TRUE) {
      Sleep(3000);
      li_0 = get_req(gi_1164, gi_1160);
   }
   if (li_0 != TRUE && IsDemo()) {
      gi_1160 = AccountNumber();
      li_0 = get_req(gi_1164, gi_1160);
   }
   if (li_0 == TRUE) Print("Expert Authorized for Trading");
   if (li_0 == 2) Print("Expert Not Authorized for Trading. Please contact support");
   if (li_0 == -1) Print("Internet Connection problem in authorizing EA");
   */
   bool li_0 = TRUE;
   if (li_0 == TRUE) Print("Expert Authorized for Trading");
   return (li_0);
}

void f0_26() {
   double ld_0;
   int li_8;
   int li_12;
   if (gda_900[1] == 0.0 && gda_900[2] == 0.0) {
      gda_900[1] = Bid;
      gda_908[1] = f0_30(2);
   }
   if (Bid != gda_900[1] && gda_900[1] != 0.0) {
      gda_900[2] = Bid;
      gda_908[2] = f0_30(2);
   }
   gd_916 = 0.0;
   gd_924 = 0.0;
   gd_932 = 0.0;
   gi_964 = FALSE;
   gd_968 = 0.0;
   gd_976 = 0.0;
   if (gda_900[2] != 0.0 && gda_900[1] != 0.0) {
      gd_916 = MathAbs(gda_908[2] - gda_908[1]);
      gd_916 /= MathAbs(gda_900[2] / Point - gda_900[1] / Point);
   }
   gd_968 = 0.0;
   if (OnlyAfterLevel != 0 && gi_788 >= OnlyAfterLevel) gd_968 = DisrupterClose;
   if (OnlyAfterLevel2 != 0 && gi_788 >= OnlyAfterLevel2) gd_968 = DisrupterClose2;
   if (gi_256 != 0 && gi_788 >= gi_256) gd_968 = gd_228;
   if (gd_968 != 0.0 && gd_916 != 0.0) {
      ld_0 = f0_30(2);
      if (ld_0 < 0.0) gd_976 = MathAbs(gd_968 - MathAbs(ld_0));
      if (ld_0 > 0.0) gd_976 = gd_968 - ld_0;
      gi_964 = gd_976 / gd_916;
      gd_932 = Bid + gi_964 * Point;
   }
   if (gda_904[1] == 0.0 && gda_904[2] == 0.0) {
      gda_904[1] = Ask;
      gda_912[1] = f0_30(1);
   }
   if (Ask != gda_904[1] && gda_904[1] != 0.0) {
      gda_904[2] = Ask;
      gda_912[2] = f0_30(1);
   }
   gd_940 = 0.0;
   gd_948 = 0.0;
   gd_956 = 0.0;
   gi_964 = FALSE;
   gd_968 = 0.0;
   gd_976 = 0.0;
   if (gda_904[2] != 0.0 && gda_904[1] != 0.0) {
      gd_940 = MathAbs(gda_912[2] - gda_912[1]);
      gd_940 /= MathAbs(gda_904[2] / Point - gda_904[1] / Point);
   }
   gd_968 = 0.0;
   if (OnlyAfterLevel != 0 && gi_792 >= OnlyAfterLevel) gd_968 = DisrupterClose;
   if (OnlyAfterLevel2 != 0 && gi_792 >= OnlyAfterLevel2) gd_968 = DisrupterClose2;
   if (gi_256 != 0 && gi_792 >= gi_256) gd_968 = gd_228;
   if (gd_968 != 0.0 && gd_940 != 0.0) {
      ld_0 = f0_30(1);
      if (ld_0 < 0.0) gd_976 = MathAbs(gd_968 - MathAbs(ld_0));
      if (ld_0 > 0.0) gd_976 = gd_968 - ld_0;
      gi_964 = gd_976 / gd_940;
      gd_956 = Ask - gi_964 * Point;
      if (gi_988 == FALSE) gi_988 = TRUE;
   }
   if (gd_956 != 0.0) {
      li_8 = gi_700;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_792 >= OnlyAfterLevel) li_8 = gi_700 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_792 >= OnlyAfterLevel2) li_8 = gi_700 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_792 >= gi_256) li_8 = gi_700 + gi_300;
      li_8 += gi_992;
      if (MathAbs(Ask - gd_956) > li_8 * Point) {
         ArrayInitialize(gda_904, 0.0);
         ArrayInitialize(gda_912, 0.0);
      }
   }
   if (gd_932 != 0.0) {
      li_12 = gi_696;
      if (UseGridExpander && OnlyAfterLevel != 0 && gi_788 >= OnlyAfterLevel) li_12 = gi_696 + ExpandPips;
      if (UseGridExpander && OnlyAfterLevel2 != 0 && gi_788 >= OnlyAfterLevel2) li_12 = gi_696 + ExpandPips2;
      if (UseGridExpander && gi_256 != 0 && gi_788 >= gi_256) li_12 = gi_696 + gi_300;
      li_12 += gi_992;
      if (MathAbs(gd_932 - Bid) > li_12 * Point) {
         ArrayInitialize(gda_900, 0.0);
         ArrayInitialize(gda_908, 0.0);
      }
   }
}

void f0_29() {
   if (!AutoStealthMode) gi_984 = StealthMode;
   if (AutoStealthMode && DayOfWeek() == 5 && Hour() >= 16) {
      gi_984 = TRUE;
      if (gi_1008 == FALSE) gi_1004 = 30;
      gi_1008 = TRUE;
   }
   if (AutoStealthMode && (DayOfWeek() == 0 && Hour() >= 23) || (DayOfWeek() == 1 && Hour() > 1) || (DayOfWeek() > 1 && DayOfWeek() < 5) || (DayOfWeek() == 5 && Hour() < 16)) {
      if (gi_1008 == TRUE) gi_1004 = 30;
      gi_984 = FALSE;
      gi_1008 = FALSE;
   }
}

void f0_20() {
   f0_4();
   gi_480 = 9;
   if (gd_524 > 0.0 && gd_516 > 0.0 && TradeDirection == 2 || TradeDirection == 3 || TradeDirection == 4) gi_480 = 0;
   if (TradeDirection == 3) {
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 3 && Bid <= gd_548) gi_480 = 1;
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 3 && Bid >= gd_548) gi_480 = -1;
      if (gd_516 == 0.0 && TradeDirection == 3 && Bid <= gd_548 && gi_480 != 0) gi_480 = 1;
      if (gd_516 > 0.0 && TradeDirection == 3 && gi_480 != 0) gi_480 = -1;
      if (gd_524 == 0.0 && TradeDirection == 3 && Bid >= gd_548 && gi_480 != 0) gi_480 = -1;
      if (gd_524 > 0.0 && TradeDirection == 3 && gi_480 != 0) gi_480 = 1;
   }
   if (TradeDirection == 4) {
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 4 && Bid <= gd_548) gi_480 = -1;
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 4 && Bid >= gd_548) gi_480 = 1;
      if (gd_524 == 0.0 && TradeDirection == 4 && Bid <= gd_548 && gi_480 != 0) gi_480 = -1;
      if (gd_516 > 0.0 && TradeDirection == 4 && gi_480 != 0) gi_480 = -1;
      if (gd_516 == 0.0 && TradeDirection == 4 && Bid >= gd_548 && gi_480 != 0) gi_480 = 1;
      if (gd_524 > 0.0 && TradeDirection == 4 && gi_480 != 0) gi_480 = 1;
   }
   if (TradeDirection == 2) {
      if (gd_516 > 0.0 && gd_524 == 0.0 && TradeDirection == 2) {
         gi_480 = -1;
         gi_1128 = -1;
      }
      if (gd_516 == 0.0 && gd_524 > 0.0 && TradeDirection == 2) {
         gi_480 = 1;
         gi_1128 = 1;
      }
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 2 && gi_1128 == -1 || gi_1128 == 0) {
         gi_480 = 1;
         gi_1128 = 1;
      }
      if (gd_516 == 0.0 && gd_524 == 0.0 && TradeDirection == 2 && gi_1128 == 1 && gi_480 == 9) {
         gi_480 = -1;
         gi_1128 = -1;
      }
   }
   if (TradeDirection == 1) {
      gi_480 = 1;
      if (gd_516 > 0.0 && gd_524 == 0.0) gi_480 = -1;
      if (gd_524 > 0.0 && gd_516 > 0.0) gi_480 = 0;
   }
   if (TradeDirection == -1) {
      gi_480 = -1;
      if (gd_524 > 0.0 && gd_516 == 0.0) gi_480 = 1;
      if (gd_524 > 0.0 && gd_516 > 0.0) gi_480 = 0;
   }
   if (TradeDirection == 0) gi_480 = 0;
}

void f0_27() {
   double ld_0;
   gi_692 = TradeRange;
   if (TradeRange > 0 && Digits == 5 || Digits == 3) gi_692 = 10 * TradeRange;
   gd_1012 = iATR(Symbol(), PERIOD_D1, gi_444, 0);
   gd_1012 *= MathPow(10, Digits);
   if (gi_692 == 0) gi_692 = MathFloor(gd_1012 / gd_432);
   gi_696 = gi_692;
   gi_700 = gi_692;
   if (ExpandPips == 0 && ExpandPips2 == 0) {
      if (f0_8(1) > 0.0 && ExpandPips == 0 && ExpandPips2 == 0) {
         if (gd_832 > 0.0) {
            ld_0 = MathAbs(gd_580 - gd_832) / Point;
            if (gi_160 && gi_692 < ld_0) gi_692 = ld_0;
            gi_700 = gi_692;
         }
      }
      if (f0_8(2) > 0.0 && ExpandPips == 0 && ExpandPips2 == 0) {
         if (gd_824 > 0.0) {
            ld_0 = MathAbs(gd_824 - gd_580) / Point;
            if (gi_160 && gi_692 < ld_0) gi_692 = ld_0;
            gi_696 = gi_692;
         }
      }
   }
   if (gi_692 < gi_1044) gi_1044 = gi_692;
   if (gi_696 < gi_1044) gi_1044 = gi_696;
   if (gi_700 < gi_1044) gi_1044 = gi_700;
   if (gi_692 > gi_1040) gi_1040 = gi_692;
   if (gi_696 > gi_1040) gi_1040 = gi_696;
   if (gi_700 > gi_1040) gi_1040 = gi_700;
}

void f0_23() {
   if (!LimitToThisPair) gd_1064 = (AccountBalance() - AccountEquity()) / AccountBalance();
   if (LimitToThisPair) gd_1064 = (AccountBalance() - (AccountBalance() + f0_30(1) + f0_30(2))) / AccountBalance();
   if (gd_1064 >= 0.0) gs_1072 = "Current Equity DrawDown Percent = ";
   if (gd_1064 > gd_1032) gd_1032 = gd_1064;
   if (gd_1064 > gd_1132) gd_1132 = gd_1064;
   double ld_0 = AccountMargin() / AccountEquity();
   if (ld_0 > gd_1140) gd_1140 = ld_0;
   if (gd_1064 < 0.0) {
      gs_1072 = "Current Equity Profit Percent = ";
      gd_1064 = -1.0 * gd_1064;
   }
}

void f0_0() {
   if (!LimitToThisPair) {
      gd_1024 = (AccountBalance() - AccountEquity()) / AccountBalance();
      if (100.0 * gd_1024 > MaxDrawDownPct) {
         f0_25(OP_BUY);
         f0_25(OP_SELL);
         f0_28();
      }
   }
   if (LimitToThisPair) {
      gd_1024 = (AccountBalance() - (AccountBalance() + f0_30(1) + f0_30(2))) / AccountBalance();
      if (100.0 * gd_1024 > MaxDrawDownPct) {
         f0_25(OP_BUY);
         f0_25(OP_SELL);
         f0_28();
      }
   }
   if (gd_1024 > gd_1032) gd_1032 = gd_1024;
   if (gd_1024 > gd_1132) gd_1132 = gd_1024;
   double ld_0 = AccountMargin() / AccountEquity();
   if (ld_0 > gd_1140) gd_1140 = ld_0;
}

Recommend