EURO_BLASTER

#property copyright "Copyright ?2009, Forex Spiritual Team"
#property link      "http://www.euro-blaster.com"

extern string EA_Name = "EURO_BLASTER";
extern string Creator = "Copyright ?2009, Forex Spiritual Team";
extern int MagicNo = 6236;
extern string Part1 = "=== Time Management ===";
extern bool Use_Time_Mgmt = FALSE;
extern int TradeStartHour = 0;
extern int TradeStartMinutes = 0;
extern int TradeEndHour = 23;
extern int TradeEndMinutes = 0;
extern string Part2 = "=== Trading Management ===";
extern bool MM = FALSE;
extern double RiskPercent = 10.0;
extern double LotSize = 0.1;
extern double Max_Lot_Size = 100.0;
extern int MaxOrder = 1;
extern double StopTime = 0.0;
extern double TakeProfit = 25.0;
extern double StopLoss = 350.0;
extern double Slippage = 3.0;
extern double TrailingStop = 0.0;
extern bool TrailingProfit = FALSE;
extern int TrailingPips = 1;
extern bool Profit_Protection = FALSE;
extern bool ProtectAll = FALSE;
extern double Percent_Over_Balance = 10.0;
extern bool Balance_Protection = FALSE;
extern string Wish_U_Have = "=== Good Luck ===";
int g_period_240 = 10;
double gd_244 = 10.0;
double gd_unused_252 = 5.0;
double gd_unused_260 = 10.0;
double gd_unused_268 = 22.0;
double gd_unused_276 = 20.0;
double gd_unused_284 = 26.0;
double gd_unused_292 = 13.0;
double gd_unused_300 = 15.0;
double gd_unused_308 = 10.0;
double gd_316;
double g_minlot_324;
double g_lotstep_332;
double gd_340;
int gi_348;
double g_price_352;
double gd_360;
double g_point_368;
int g_slippage_376;
bool gi_380 = TRUE;
bool gi_384 = FALSE;
int gi_388 = 23;
int gi_392 = 30;
int gi_396 = 100;
int gi_400 = 0;
int gi_404 = 0;

int init() {
   if (Point == 0.00001) g_point_368 = 0.0001;
   else {
      if (Point == 0.001) g_point_368 = 0.01;
      else g_point_368 = Point;
   }
   g_slippage_376 = MarketInfo(Symbol(), MODE_SPREAD);
   return (0);
}

int deinit() {
   return (0);
}

int Crossed(double ad_0, double ad_8) {
   if (ad_0 > ad_8) gi_404 = 1;
   if (ad_0 < ad_8) gi_404 = 2;
   if (gi_404 != gi_400) {
      gi_400 = gi_404;
      return (gi_400);
   } else return (0);
}

double Predict() {
   double l_ima_4;
   double l_ima_28;
   double l_ima_36;
   double l_istddev_132;
   double ld_ret_172;
   double ld_44 = 0;
   double ld_52 = 0;
   double ld_68 = 0;
   double ld_76 = 0;
   double ld_unused_84 = 0;
   double ld_unused_92 = 0;
   double ld_100 = 0;
   double ld_108 = 0;
   double ld_116 = 0;
   double ld_124 = 0;
   double ld_140 = 0;
   double ld_unused_60 = 0;
   double ld_156 = 0;
   double ld_164 = 0;
   double ld_180 = 0;
   double ld_20 = 0;
   double l_ima_12 = iMA(NULL, 0, g_period_240, 0, MODE_SMA, PRICE_CLOSE, 0);
   for (int li_0 = 1; li_0 <= g_period_240; li_0++) {
      l_ima_4 = iMA(NULL, 0, g_period_240, 0, MODE_SMA, PRICE_CLOSE, li_0);
      l_ima_28 = iMA(NULL, 0, g_period_240, 0, MODE_SMA, PRICE_HIGH, li_0);
      l_ima_36 = iMA(NULL, 0, g_period_240, 0, MODE_SMA, PRICE_LOW, li_0);
      l_istddev_132 = iStdDev(NULL, 0, g_period_240, 0, MODE_SMA, PRICE_CLOSE, li_0);
      ld_44 += (High[li_0] + Low[li_0]) / 2.0;
      ld_52 += Close[li_0];
      ld_68 += ld_44 - ld_52;
      ld_76 += l_ima_4;
      ld_124 += l_istddev_132;
      ld_156 += Close[li_0] - Open[li_0] - (Close[li_0 - 1] - (Open[li_0 - 1]));
      ld_20 = ld_20 + (l_ima_28 - l_ima_4) + (l_ima_36 - l_ima_4);
   }
   ld_100 = ld_44 / g_period_240;
   ld_108 = ld_52 / g_period_240;
   ld_116 = ld_76 / g_period_240;
   ld_140 = ld_124 / g_period_240;
   ld_180 = ld_68 / g_period_240;
   ld_164 = ld_156 / g_period_240;
   if (ld_180 > 0.0 && l_ima_12 > ld_116 && ld_164 > 0.0 && Open[0] < l_ima_12 + ld_140 && Open[0] > l_ima_12) {
      ld_ret_172 = 1;
      gd_360 = 10000.0 * (2.0 * ld_140) + gd_244;
   }
   if (ld_180 < 0.0 && l_ima_12 < ld_116 && ld_164 < 0.0 && Open[0] > l_ima_12 - ld_140 && Open[0] < l_ima_12) {
      ld_ret_172 = 2;
      gd_360 = 10000.0 * (2.0 * ld_140) + gd_244;
   }
   if (ld_180 > 0.0 && l_ima_12 > ld_116 && ld_164 > 0.0 && Open[0] < l_ima_12 - ld_140) {
      ld_ret_172 = 3;
      gd_360 = 10000.0 * (2.0 * ld_140) + 10.0;
   }
   if (ld_180 < 0.0 && l_ima_12 < ld_116 && ld_164 < 0.0 && Open[0] > l_ima_12 + ld_140) {
      ld_ret_172 = 4;
      gd_360 = 10000.0 * (2.0 * ld_140) + 10.0;
   }
   return (ld_ret_172);
}

double Predict2() {
   double ld_ret_68;
   double ld_28 = 0;
   double ld_36 = 0;
   double ld_44 = 0;
   double ld_52 = 0;
   double ld_60 = 0;
   double ld_76 = 0;
   double ld_100 = 0;
   double ld_116 = 0;
   double ld_132 = 0;
   double l_istddev_84 = 0;
   double ld_148 = 0;
   double ld_156 = 0;
   double ld_164 = 0;
   l_istddev_84 = iStdDev(NULL, 0, 10, 0, MODE_EMA, PRICE_CLOSE, 0);
   double l_istddev_92 = iStdDev(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0);
   double l_ima_4 = iMA(NULL, PERIOD_M30, 10, 0, MODE_SMA, PRICE_CLOSE, 0);
   double l_ima_12 = iMA(NULL, PERIOD_M30, 10, 0, MODE_SMA, PRICE_CLOSE, 1);
   double l_ima_20 = iMA(NULL, PERIOD_M30, 10, 0, MODE_SMA, PRICE_CLOSE, 2);
   for (int li_0 = 1; li_0 <= 20; li_0++) {
      ld_28 += Close[li_0];
      ld_36 += High[li_0] - Low[li_0];
      ld_44 += Close[li_0] - Open[li_0];
      if (li_0 <= 10) {
         ld_148 += Close[li_0];
         ld_156 += High[li_0] - Low[li_0];
         ld_164 += Close[li_0] - Open[li_0];
      }
   }
   ld_52 = ld_28 / 20.0;
   ld_60 = ld_36 / 20.0;
   ld_76 = ld_44 / 20.0;
   double ld_172 = ld_148 / 10.0;
   double ld_180 = ld_156 / 10.0;
   double ld_188 = ld_164 / 10.0;
   ld_132 = (Open[0] - ld_172) / l_istddev_84;
   double ld_140 = (Open[0] - ld_52) / l_istddev_92;
   ld_100 = ld_172 + 0.308 * ld_180;
   double ld_108 = ld_52 + 0.18 * ld_60;
   ld_116 = ld_172 - 0.308 * ld_180;
   double ld_124 = ld_52 - 0.18 * ld_60;
   if ((l_ima_4 - l_ima_20 > l_ima_12 - l_ima_20 + 0.0002 && ld_188 > 0.0 && ld_164 > 0.0 && Open[0] > ld_116 && Open[0] <= ld_172 + ld_132 * ld_188 && ld_132 < 0.0 &&
      High[1] - Low[1] < 1.777 * ld_180) || (l_ima_4 - l_ima_20 > l_ima_12 - l_ima_20 + 0.0002 && ld_76 > 0.0 && ld_44 > 0.0 && Open[0] > ld_124 && Open[0] <= ld_52 + ld_132 * ld_76 && ld_140 < 0.0 && High[1] - Low[1] < 1.586 * ld_180)) {
      ld_ret_68 = 1;
      gd_360 = 10000.0 * l_istddev_92 + 10.0;
   }
   if ((l_ima_4 - l_ima_20 < l_ima_12 - l_ima_20 - 0.0002 && ld_188 < 0.0 && ld_164 < 0.0 && Open[0] < ld_100 && Open[0] >= ld_172 + ld_132 * ld_188 && ld_132 > 0.0 &&
      High[1] - Low[1] < 1.777 * ld_180) || (l_ima_4 - l_ima_20 < l_ima_12 - l_ima_20 - 0.0002 && ld_76 < 0.0 && ld_44 < 0.0 && Open[0] < ld_108 && Open[0] >= ld_52 + ld_132 * ld_76 && ld_140 > 0.0 && High[1] - Low[1] < 1.586 * ld_180)) {
      ld_ret_68 = 2;
      gd_360 = 10000.0 * l_istddev_92 + 10.0;
   }
   if (l_ima_4 - l_ima_20 > l_ima_12 - l_ima_20 + 0.0002 && ld_76 > 0.0 && ld_44 > 0.0 && Open[0] > ld_124 && Open[0] <= ld_52 + ld_132 * ld_76 && ld_140 < 0.0 && High[1] - Low[1] > 1.586 * ld_180) {
      ld_ret_68 = 3;
      g_price_352 = 10000.0 * l_istddev_92 + 10.0;
   }
   if (l_ima_4 - l_ima_20 < l_ima_12 - l_ima_20 - 0.0002 && ld_76 < 0.0 && ld_44 < 0.0 && Open[0] < ld_108 && Open[0] >= ld_52 + ld_132 * ld_76 && ld_140 > 0.0 && High[1] - Low[1] > 1.586 * ld_180) {
      ld_ret_68 = 4;
      g_price_352 = 10000.0 * l_istddev_92 + 10.0;
   }
   return (ld_ret_68);
}

int start() {
   int l_ticket_4;
   double l_price_24;
   bool li_424;
   bool li_428;
   bool li_432;
   bool li_436;
   bool li_440;
   bool li_444;
   bool li_448;
   bool li_452;
   bool li_456;
   bool li_460;
   bool li_464;
   bool li_468;
   int li_unused_572;
   double l_price_576;
   int l_hour_12 = TimeHour(TimeCurrent());
   int l_count_16 = 0;
   int l_count_20 = 0;
   double ld_512 = High[iHighest(NULL, 0, MODE_HIGH, gi_396, 0)];
   double ld_520 = Low[iLowest(NULL, 0, MODE_LOW, gi_396, 0)];
   double l_imacd_32 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
   double l_imacd_40 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
   double l_imacd_48 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
   double l_imacd_56 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
   double l_ima_72 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_HIGH, 0);
   double l_ima_144 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_HIGH, 1);
   double l_ima_64 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_LOW, 0);
   double l_ima_136 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_LOW, 1);
   double l_ima_80 = iMA(NULL, 0, 22, 0, MODE_SMA, PRICE_CLOSE, 0);
   double l_ima_152 = iMA(NULL, 0, 22, 0, MODE_SMA, PRICE_CLOSE, 5);
   double l_ima_160 = iMA(NULL, 0, 22, 0, MODE_SMA, PRICE_CLOSE, 1);
   double l_ima_104 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, 0);
   double l_ima_112 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, 1);
   double l_ima_120 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, 2);
   double l_ima_168 = iMA(NULL, 0, 10, 0, MODE_EMA, PRICE_CLOSE, 1);
   double l_ima_128 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, 5);
   double l_ima_88 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 0);
   double l_ima_96 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 1);
   int li_528 = Crossed(l_ima_96, l_ima_160);
   double l_ima_532 = iMA(NULL, 0, gi_396, 0, MODE_SMA, PRICE_CLOSE, 0);
   double l_istddev_540 = iStdDev(NULL, 0, gi_396, 0, MODE_SMA, PRICE_CLOSE, 0);
   double l_istddev_216 = iStdDev(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0);
   double l_istddev_224 = iStdDev(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 1);
   double l_iwpr_176 = iWPR(NULL, 0, 26, 0);
   double l_iwpr_184 = iWPR(NULL, 0, 26, 1);
   double l_iwpr_192 = iWPR(NULL, 0, 26, 2);
   double l_iwpr_200 = iWPR(NULL, 0, 114, 0);
   double l_iwpr_208 = iWPR(NULL, 0, 114, 1);
   double l_idemarker_232 = iDeMarker(NULL, 0, 13, 0);
   double l_idemarker_240 = iDeMarker(NULL, 0, 13, 1);
   double l_idemarker_248 = iDeMarker(NULL, 0, 13, 2);
   double l_istochastic_256 = iStochastic(NULL, 0, 15, 6, 7, MODE_EMA, 0, MODE_MAIN, 0);
   double l_istochastic_264 = iStochastic(NULL, 0, 15, 6, 7, MODE_EMA, 0, MODE_MAIN, 1);
   double l_istochastic_272 = iStochastic(NULL, 0, 15, 6, 7, MODE_EMA, 0, MODE_SIGNAL, 0);
   double l_istochastic_280 = iStochastic(NULL, 0, 15, 6, 7, MODE_EMA, 0, MODE_SIGNAL, 1);
   if (l_istochastic_264 < l_istochastic_280 - 5.0 && l_istochastic_256 >= l_istochastic_272) li_432 = TRUE;
   if (l_istochastic_264 > l_istochastic_280 + 5.0 && l_istochastic_256 <= l_istochastic_272) li_436 = TRUE;
   if (l_istochastic_264 > l_istochastic_280 && l_istochastic_256 > l_istochastic_272) li_440 = TRUE;
   if (l_istochastic_264 < l_istochastic_280 && l_istochastic_256 < l_istochastic_272) li_444 = TRUE;
   double l_istochastic_392 = iStochastic(NULL, 0, 10, 5, 5, MODE_SMA, 0, MODE_MAIN, 0);
   double l_istochastic_400 = iStochastic(NULL, 0, 10, 5, 5, MODE_SMA, 0, MODE_MAIN, 1);
   double l_istochastic_408 = iStochastic(NULL, 0, 10, 5, 5, MODE_SMA, 0, MODE_SIGNAL, 0);
   double l_istochastic_416 = iStochastic(NULL, 0, 10, 5, 5, MODE_SMA, 0, MODE_SIGNAL, 1);
   if (l_istochastic_400 < l_istochastic_416 - 5.0 && l_istochastic_392 >= l_istochastic_408) li_448 = TRUE;
   if (l_istochastic_400 > l_istochastic_416 + 5.0 && l_istochastic_392 <= l_istochastic_408) li_452 = TRUE;
   if (l_istochastic_400 < l_istochastic_416 && l_istochastic_392 >= l_istochastic_408) li_456 = TRUE;
   if (l_istochastic_400 > l_istochastic_416 && l_istochastic_392 <= l_istochastic_408) li_460 = TRUE;
   if (l_istochastic_400 > l_istochastic_416 && l_istochastic_392 > l_istochastic_408) li_464 = TRUE;
   if (l_istochastic_400 < l_istochastic_416 && l_istochastic_392 < l_istochastic_408) li_468 = TRUE;
   double l_irsi_288 = iRSI(NULL, 0, 14, PRICE_CLOSE, 0);
   double l_irsi_296 = iRSI(NULL, 0, 14, PRICE_CLOSE, 1);
   double l_irsi_312 = iRSI(NULL, 0, 14, PRICE_CLOSE, 2);
   double ld_unused_304 = 0;
   if (l_irsi_288 < 30.0) ld_unused_304 = 1;
   if (l_irsi_288 > 70.0) ld_unused_304 = 2;
   double l_ibands_360 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 1);
   double l_ibands_368 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 2);
   double l_ibands_376 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 1);
   double l_ibands_384 = iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 2);
   double l_iadx_320 = iADX(NULL, 0, 14, PRICE_HIGH, MODE_MAIN, 0);
   double l_iadx_328 = iADX(NULL, 0, 14, PRICE_HIGH, MODE_PLUSDI, 0);
   double l_iadx_344 = iADX(NULL, 0, 14, PRICE_HIGH, MODE_PLUSDI, 1);
   double l_iadx_336 = iADX(NULL, 0, 14, PRICE_HIGH, MODE_MINUSDI, 0);
   double l_iadx_352 = iADX(NULL, 0, 14, PRICE_HIGH, MODE_MINUSDI, 1);
   if (l_iadx_328 > l_iadx_336) li_428 = TRUE;
   if (l_iadx_336 > l_iadx_328) li_424 = TRUE;
   if (l_iadx_320 < 30.0) {
      li_424 = FALSE;
      li_428 = FALSE;
   }
   gd_316 = MarketInfo(Symbol(), MODE_MAXLOT);
   g_minlot_324 = MarketInfo(Symbol(), MODE_MINLOT);
   g_lotstep_332 = MarketInfo(Symbol(), MODE_LOTSTEP);
   gd_340 = MarketInfo(Symbol(), MODE_MARGINREQUIRED) * g_lotstep_332;
   gi_348 = 3600 * gi_388 + 60 * gi_392;
   int l_stoplevel_548 = MarketInfo(Symbol(), MODE_STOPLEVEL);
   Comment("\n", "    Copyright ?2009, Forex Spiritual Team", 
      "\n", "    ======================================", 
      "\n", "     Broker Time       : ", TimeToStr(TimeCurrent()), 
      "\n", 
      "\n", "     Highest Price in ", gi_396, " Bars Period :  ", ld_512, 
      "\n", "     Lowest Price in ", gi_396, " Bars Period  :  ", ld_520, 
      "\n", "     Current Price ->  Bid :  ", Bid, "   Ask :  ", Ask, 
      "\n", 
      "\n", "     Balance                : ", AccountBalance(), 
      "\n", "     Equity                 : ", AccountEquity(), 
      "\n", "     Orders Total         : ", OrdersTotal(), 
      "\n", "     Total Profit/Loss    : ", AccountProfit(), 
   "\n");
   if (Slippage > g_slippage_376) g_slippage_376 = Slippage;
   if (DayOfWeek() == 5 && gi_380 == FALSE && Use_Time_Mgmt) return (0);
   closeExpiredOrders();
   if (!isTradeTime()) return (0);
   if (Bars < 100) {
      Print("bars less than 100");
      return (0);
   }
   if (!IsConnected()) {
      Print("No Connection!!!");
      Sleep(5000);
      return (0);
   }
   double l_price_552 = StopLoss;
   if (l_price_552 <= 0.0) l_price_552 = 0;
   int li_560 = 0;
   int li_564 = 0;
   int l_ord_total_8 = OrdersTotal();
   if (l_ord_total_8 > 0) {
      for (int l_pos_568 = 0; l_pos_568 < l_ord_total_8; l_pos_568++) {
         OrderSelect(l_pos_568, SELECT_BY_POS);
         if (OrderMagicNumber() == MagicNo) {
            if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) l_count_16++;
            else l_count_20++;
         }
      }
   }
   if (l_count_16 > 0)
      if (TimeCurrent() - OrderOpenTime() <= 60.0 * StopTime) return (0);
   if (l_count_16 < MaxOrder) {
      if (AccountFreeMargin() < 100.0 * LotsOptimized()) {
         Print("We have not enough money. Free Margin = ", AccountFreeMargin());
         return (0);
      }
      if (!IsTradeAllowed()) {
         Print("Trade context is busy! The expert cannot open position! Wait a moment...");
         Sleep(1000);
         return (0);
      }
      if (Predict() == 1.0 || Predict2() == 1.0 && Ask < (ld_512 + ld_520) / 2.0 - l_istddev_540 && li_440 && l_istochastic_256 < 45.0) li_560 = 3;
      if ((Predict() == 3.0 && ((l_iwpr_176 > l_iwpr_184 + 9.0 && li_464) || (l_iwpr_176 > l_iwpr_184 + 9.0 && li_440) && l_idemarker_232 > l_idemarker_240 + 0.05 && l_ima_112 < l_ima_160) ||
         (l_istochastic_256 < 40.0 && Open[1] < l_ima_136 && l_ima_80 > l_ima_128) || (l_istochastic_400 < 40.0 && l_ima_80 > l_ima_160 && l_ima_168 > l_ima_112) || (Open[2] > l_ima_112 &&
         Open[1] < Close[1] && Open[0] > Close[1] && li_440 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_idemarker_232 > l_idemarker_240 + 0.05)) || (Predict() == 1.0 && ((l_iwpr_176 > l_iwpr_184 +
         9.0 && l_istochastic_392 < 60.0 && li_464) || (l_iwpr_176 > l_iwpr_184 + 18.0 && l_istochastic_256 < 70.0 && li_440) && l_iwpr_176 < -15.0 && l_idemarker_232 > l_idemarker_240 &&
         l_ima_112 > l_ima_160 && l_ima_80 > l_ima_160) || (l_istochastic_256 < 40.0 && Open[1] > l_ima_136 && l_ima_104 < l_ima_128) || (l_istochastic_400 < 40.0 && l_ima_80 > l_ima_160 && l_ima_168 > l_ima_112) ||
         (Open[2] > l_ima_112 && Open[1] < Close[1] && Open[0] > Close[1] && li_440 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_idemarker_232 > l_idemarker_240 + 0.1)) || (Predict2() == 1.0 && (l_istochastic_256 < 50.0 && Open[1] > l_ima_136 && l_ima_104 < l_ima_128 && li_440 && Open[0] > Close[1] && Open[1] > Close[1])) ||
         (Predict2() == 1.0 && l_istochastic_256 < 50.0 && li_440 && l_iwpr_176 > l_iwpr_184 + 7.0 && Open[2] < Close[2] && Open[0] > Close[1] && Open[1] > Close[1]) || (Predict2() == 3.0 &&
         Open[0] > Close[1] && Open[1] < Close[1])) li_560 = 1;
      if ((l_ima_88 > l_ima_96 && l_ima_80 > l_ima_160 + 0.0002 && Open[0] < l_ima_80 + l_istddev_216 && (l_istochastic_392 > l_istochastic_400 && l_istochastic_408 > l_istochastic_416) ||
         (l_istochastic_256 > l_istochastic_264 && l_istochastic_272 > l_istochastic_280) && l_iwpr_176 < -15.0 && l_iwpr_176 > l_iwpr_184 + 3.0 && li_440 && l_ima_104 > l_ima_80 && Open[0] > l_ima_88) ||
         (l_iwpr_200 > l_iwpr_208 && l_iwpr_200 > -20.0 && l_iwpr_208 > -20.0 && l_iwpr_176 > l_iwpr_184 + 25.0 && l_iwpr_176 < -15.0 && l_iwpr_184 < l_iwpr_192 && l_istddev_216 > l_istddev_224 &&
         l_idemarker_232 > l_idemarker_240 && l_ima_80 > l_ima_152 && li_440 && l_iadx_320 > 20.0) || (Low[1] < l_ima_80 - 3.2 * l_istddev_224 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_iwpr_176 < -75.0 && li_440 && (l_istochastic_256 >= 20.0 && l_istddev_216 > l_istddev_224) ||
         l_iwpr_184 < l_iwpr_192) || (l_ima_72 > l_ima_104 && l_ima_72 > l_ima_144 && l_ima_144 < l_ima_104 && l_ima_80 > l_ima_152 + 0.0002 && Open[1] < Close[1] && li_440 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_idemarker_232 > l_idemarker_240 && l_iadx_328 > l_iadx_336) ||
         (li_432 && l_imacd_32 > l_imacd_40 && l_imacd_32 > l_imacd_48 && l_ima_168 > l_ima_112 && li_428 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_istochastic_256 > l_istochastic_264 &&
         l_istochastic_272 > l_istochastic_280 + 1.0) || (l_imacd_32 > l_imacd_40 && l_imacd_32 < 0.0 && l_imacd_32 > l_imacd_48 && l_imacd_40 < l_imacd_56 && li_440 && l_iwpr_176 > l_iwpr_184 && li_428 && l_ima_168 > l_ima_112 && Close[1] < Open[0] && Close[1] > Open[1] && l_istddev_216 > l_istddev_224) ||
         (li_432 && l_imacd_32 > l_imacd_40 && l_imacd_32 > l_imacd_48 && l_ima_104 < l_ima_112 && l_iwpr_176 > l_iwpr_184 + 9.0 && li_428 && l_ima_168 > l_ima_112) || (l_iwpr_176 >= -75.0 &&
         l_iwpr_176 > l_iwpr_184 + 9.0 && l_iwpr_184 < l_iwpr_192 - 5.0 && Open[2] < Close[2] && Open[1] > Close[2] && Open[1] < Close[1] && li_440 && l_ima_104 > l_ima_112 +
         0.0005 && l_iadx_320 > 25.0 && l_iadx_328 > 25.0 && l_ima_168 > l_ima_112) || (li_528 == 1 && l_iadx_328 > 25.0 && l_iwpr_176 > l_iwpr_184 + 12.0 && l_iadx_320 > 25.0 && l_iadx_328 > l_iadx_344 ||
         l_ima_168 > l_ima_112 && l_ima_80 >= l_ima_160 && l_ima_96 < l_ima_128 && li_440) || (Close[4] < Close[3] && Close[3] > Close[2] && Close[2] > Close[1] && Open[0] > Close[1] && High[1] - Close[1] < Open[1] - Low[1] && l_ima_104 > l_ima_128 + 0.0005 && l_iwpr_176 > l_iwpr_184 + 9.0 && l_iadx_320 > 25.0 && l_iadx_328 > 25.0 && l_iwpr_184 > l_iwpr_192) ||
         (Open[1] < Close[1] && Close[2] < l_ima_80 && Close[1] > l_ima_80 && Open[1] > l_ima_88 && Open[0] > l_ima_72 && l_ima_80 > l_ima_152 + 0.0005 && l_iwpr_176 < -5.0 &&
         l_iwpr_176 > l_iwpr_184 + 7.0 && l_idemarker_232 > l_idemarker_240 && l_idemarker_240 > l_idemarker_248) || (l_irsi_296 < l_irsi_312 && l_irsi_288 > l_irsi_296 + 5.0 && l_irsi_296 < 30.0 && l_ima_168 > l_ima_112 && l_iadx_320 > 25.0 && l_iadx_328 > 25.0) ||
         (Close[1] > l_ima_112 && Open[1] < l_ima_112 && l_ima_168 > l_ima_112 && l_iadx_320 > 30.0 && l_iadx_328 > 25.0 && l_ima_80 > l_ima_152 + 0.0003 && li_440 && l_iwpr_176 > l_iwpr_184 +
         18.0 && l_iwpr_184 > l_iwpr_192 + 7.0) || (li_448 && Open[1] > l_ima_136 && Open[0] > l_ima_72 && Open[1] < Close[1] && l_ima_80 > l_ima_160 + 0.0002 && l_iadx_320 > 25.0 && l_iadx_328 > 25.0 && l_iwpr_176 > l_iwpr_184 + 9.0 && l_ima_168 > l_ima_112) ||
         (li_448 && l_imacd_32 > l_imacd_40 && l_imacd_32 < 0.0 && l_imacd_32 > l_imacd_48 && l_iadx_320 > 25.0 && l_iadx_328 > 25.0 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_istochastic_392 > l_istochastic_400 &&
         l_istochastic_408 > l_istochastic_416 + 1.0) || (Close[2] < l_ibands_368 && Open[1] > l_ibands_360 && Open[0] > Close[1] && Open[1] < Close[1] && li_464 && l_iwpr_176 > l_iwpr_184 + 12.0 && l_istochastic_392 > l_istochastic_400 + 3.0 && l_istochastic_408 > l_istochastic_416 && l_ima_168 > l_ima_112 && l_ima_104 > l_ima_112) ||
         (l_iadx_328 > l_iadx_344 && l_iadx_344 < l_iadx_352 && l_iadx_328 >= l_iadx_336 && l_iadx_320 >= 35.0 && l_iadx_328 > 25.0 && l_iwpr_176 > l_iwpr_184 + 15.0 && li_440) ||
         (l_ima_88 > l_ima_96 && l_ima_104 > l_ima_112 && l_ima_80 > l_ima_160 && l_ima_80 > l_ima_152 + 0.0005 && l_ima_104 - l_ima_112 > l_ima_80 - l_ima_160 && l_ima_88 - l_ima_80 > l_ima_96 - l_ima_160 &&
         li_440 && l_iwpr_176 < -15.0 && l_iwpr_176 > l_iwpr_184 + 15.0 && l_ima_88 > l_ima_104 && l_ima_104 > l_ima_80 && Open[0] > l_ima_88) || ((li_456 && l_istochastic_400 < 25.0) ||
         (li_448 && l_istochastic_400 < 30.0) && l_ima_80 > l_ima_160 + 0.0002 && l_ima_168 > l_ima_112) || (li_432 && l_istochastic_256 < 30.0 && Open[1] > l_ima_136 && Close[1] > l_ima_128 && Open[0] > l_ima_72 && l_ima_104 < l_ima_128 && l_ima_104 < l_ima_112) ||
         (li_432 && Open[1] > l_ima_136 && Open[0] > l_ima_72 && Open[1] < Close[1] && l_iwpr_176 > l_iwpr_184 + 7.0 && l_idemarker_232 > l_idemarker_240 + 0.08 && l_istddev_216 > l_istddev_224) ||
         (Close[3] > l_ima_128 && Open[2] > l_ima_112 && Open[1] < Close[1] && Open[1] > Close[2] && Close[1] > l_ima_80 + 2.2 * l_istddev_224 && Open[0] > Close[1] && l_istddev_216 > l_istddev_224 &&
         li_440 && l_iwpr_176 > l_iwpr_184 + 7.0 && l_iwpr_176 < -10.0) || (l_ima_112 < l_ima_120 - 0.0001 && l_ima_104 > l_ima_112 + 0.0002 && l_ima_104 > l_ima_120 + 0.0001 && l_ima_112 < l_ima_160 && li_440 ||
         li_464 && Open[0] > Close[1]) || (l_ima_160 - l_ima_532 < l_ima_80 - l_ima_532 && l_ima_532 < (ld_512 + ld_520) / 2.0 - 2.0 * l_istddev_540 && l_ima_80 - l_ima_532 > l_istddev_540 && Open[0] > Close[1] && li_440) ||
         (iSAR(NULL, 0, 0.02, 0.2, 1) > Close[1] && iSAR(NULL, 0, 0.02, 0.2, 0) < Open[0] && iSAR(NULL, PERIOD_M15, 0.02, 0.2, 1) > iClose(NULL, PERIOD_M15, 1) && iSAR(NULL, PERIOD_M15, 0.02, 0.2, 0) < iOpen(NULL, PERIOD_M15, 0) &&
         iSAR(NULL, PERIOD_M30, 0.02, 0.2, 1) > iClose(NULL, PERIOD_M30, 1) && iSAR(NULL, PERIOD_M30, 0.02, 0.2, 0) < iOpen(NULL, PERIOD_M30, 0) && (Open[0] < Close[0] && Open[0] > Close[1] &&
         Ask > l_ima_80) || (l_ima_88 > l_ima_96 && l_imacd_32 > l_imacd_40 && l_imacd_32 < 0.0))) li_560 = 2;
      if (li_560 == 1 || li_560 == 2 || li_560 == 3) {
         if (l_price_552 > 0.0) l_price_552 = Ask - StopLoss * g_point_368;
         if (li_560 == 1) g_price_352 = Ask + gd_360 * g_point_368;
         if (li_560 == 2) g_price_352 = Ask + TakeProfit * g_point_368;
         if (li_560 == 3) g_price_352 = Ask + gd_360 * g_point_368;
         if(DayOfWeek()!=5)
         {
            l_ticket_4 = OrderSend(Symbol(), OP_BUY, LotsOptimized(), Ask, g_slippage_376, 0, 0, "Euro_Blaster", MagicNo, 0, Green);
            if (l_ticket_4 > 0) {
               if (OrderSelect(l_ticket_4, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice());
               OrderModify(OrderTicket(), OrderOpenPrice(), l_price_552, g_price_352, 0, CLR_NONE);
            } else Print("Error opening BUY order : ", GetLastError());
         }
         return (0);
      }
      if ((Predict() == 4.0 && ((l_iwpr_176 < l_iwpr_184 - 9.0 && li_468) || (l_iwpr_176 < l_iwpr_184 - 9.0 && li_444) && l_idemarker_232 < l_idemarker_240 - 0.05 && l_ima_112 > l_ima_160) ||
         (l_istochastic_256 > 60.0 && Open[1] > l_ima_144 && l_ima_80 < l_ima_128) || (l_istochastic_400 > 60.0 && l_ima_80 < l_ima_160 && l_ima_168 < l_ima_112) || (Open[2] < l_ima_112 &&
         Open[1] > Close[1] && Open[0] < Close[1] && li_444 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_idemarker_232 < l_idemarker_240 - 0.05)) || (Predict() == 2.0 && ((l_iwpr_176 < l_iwpr_184 - 9.0 &&
         l_istochastic_392 > 40.0 && li_468) || (l_iwpr_176 < l_iwpr_184 - 18.0 && l_istochastic_256 > 30.0 && li_444) && l_iwpr_176 > -85.0 && l_idemarker_232 < l_idemarker_240 &&
         l_ima_112 < l_ima_160 && l_ima_80 < l_ima_160) || (l_istochastic_256 > 60.0 && Open[1] < l_ima_144 && l_ima_104 > l_ima_128) || (l_istochastic_400 > 60.0 && l_ima_80 < l_ima_160 && l_ima_168 < l_ima_112) ||
         (Open[2] < l_ima_112 && Open[1] > Close[1] && Open[0] < Close[1] && li_444 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_idemarker_232 < l_idemarker_240 - 0.1)) || (Predict2() == 2.0 && (l_istochastic_256 > 50.0 && Open[1] < l_ima_144 && l_ima_104 > l_ima_128 && li_444 && Open[0] < Close[1] && Open[1] < Close[1])) ||
         (Predict2() == 2.0 && li_444 && l_istochastic_256 > 50.0 && l_iwpr_176 < l_iwpr_184 - 7.0 && Open[2] > Close[2] && Open[0] < Close[1] && Open[1] < Close[1]) || (Predict2() == 4.0 &&
         Open[0] < Close[1] && Open[1] > Close[1])) li_564 = 1;
      if ((l_ima_88 < l_ima_96 && l_ima_80 < l_ima_160 - 0.0002 && Open[0] >= l_ima_80 - l_istddev_216 && (l_istochastic_392 < l_istochastic_400 && l_istochastic_408 < l_istochastic_416) ||
         (l_istochastic_256 < l_istochastic_264 && l_istochastic_272 < l_istochastic_280) && l_iwpr_176 > -85.0 && l_iwpr_176 < l_iwpr_184 - 3.0 && li_444 && l_ima_104 < l_ima_80 && Open[0] < l_ima_88) ||
         (l_iwpr_200 < l_iwpr_208 && l_iwpr_200 < -80.0 && l_iwpr_208 < -80.0 && l_iwpr_176 < l_iwpr_184 - 25.0 && l_iwpr_176 > -85.0 && l_iwpr_184 > l_iwpr_192 && l_istddev_216 > l_istddev_224 &&
         l_idemarker_232 < l_idemarker_240 && l_ima_80 < l_ima_152 && li_444 && l_iadx_320 > 20.0) || (High[1] > l_ima_80 + 3.2 * l_istddev_224 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_iwpr_176 > -25.0 && li_444 && (l_istochastic_256 <= 80.0 && l_istddev_216 > l_istddev_224) ||
         l_iwpr_184 > l_iwpr_192) || (l_ima_64 < l_ima_104 && l_ima_64 < l_ima_136 && l_ima_136 > l_ima_104 && l_ima_80 < l_ima_152 - 0.0002 && Open[1] > Close[1] && li_444 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_idemarker_232 < l_idemarker_240 && l_iadx_336 > l_iadx_328) ||
         (li_436 && l_imacd_32 < l_imacd_40 && l_imacd_32 < l_imacd_48 && l_ima_168 < l_ima_112 && li_424 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_istochastic_256 < l_istochastic_264 &&
         l_istochastic_272 < l_istochastic_280 - 1.0) || (l_imacd_32 < l_imacd_40 && l_imacd_32 > 0.0 && l_imacd_32 < l_imacd_48 && l_imacd_40 > l_imacd_56 && li_444 && l_iwpr_176 < l_iwpr_184 && li_424 && l_ima_168 < l_ima_112 && Close[1] > Open[0] && Close[1] < Open[1] && l_istddev_216 > l_istddev_224) ||
         (li_436 && l_imacd_32 < l_imacd_40 && l_imacd_32 < l_imacd_48 && l_ima_104 > l_ima_112 && l_iwpr_176 < l_iwpr_184 - 9.0 && li_424 && l_ima_168 < l_ima_112) || (l_iwpr_176 <= -25.0 &&
         l_iwpr_176 < l_iwpr_184 - 9.0 && l_iwpr_184 > l_iwpr_192 + 5.0 && Open[2] > Close[2] && Open[1] < Close[2] && Open[1] > Close[1] && li_444 && l_ima_104 < l_ima_112 - 0.0005 &&
         l_iadx_320 > 25.0 && l_iadx_336 > 25.0 && l_ima_168 < l_ima_112) || (li_528 == 2 && l_iadx_336 > 25.0 && l_iwpr_176 < l_iwpr_184 - 12.0 && l_iadx_320 > 25.0 && l_iadx_336 > l_iadx_352 ||
         l_ima_168 < l_ima_112 && l_ima_80 <= l_ima_160 && l_ima_96 > l_ima_128 && li_444) || (Close[4] > Close[3] && Close[3] < Close[2] && Close[2] < Close[1] && Open[0] > Close[1] && Close[1] - Low[1] < High[1] - Open[1] && l_ima_104 < l_ima_128 - 0.0005 && l_iwpr_176 < l_iwpr_184 - 9.0 && l_iadx_320 > 25.0 && l_iadx_336 > 25.0 && l_iwpr_184 < l_iwpr_192) ||
         (Open[1] > Close[1] && Close[2] > l_ima_80 && Close[1] < l_ima_80 && Open[1] < l_ima_88 && Open[0] < l_ima_64 && l_ima_80 < l_ima_152 - 0.0005 && l_iwpr_176 > -95.0 &&
         l_iwpr_176 < l_iwpr_184 - 7.0 && l_idemarker_232 < l_idemarker_240 && l_idemarker_240 < l_idemarker_248) || (l_irsi_296 > l_irsi_312 && l_irsi_288 < l_irsi_296 - 5.0 && l_irsi_296 > 70.0 && l_ima_168 < l_ima_112 && l_iadx_320 > 25.0 && l_iadx_336 > 25.0) ||
         (Close[1] < l_ima_112 && Open[1] > l_ima_112 && l_ima_168 < l_ima_112 && l_iadx_320 > 30.0 && l_iadx_336 > 25.0 && l_ima_80 < l_ima_152 - 0.0003 && li_444 && l_iwpr_176 < l_iwpr_184 - 18.0 &&
         l_iwpr_184 < l_iwpr_192 - 7.0) || (li_452 && Open[1] < l_ima_144 && Open[0] < l_ima_64 && Open[1] > Close[1] && l_ima_80 < l_ima_160 - 0.0002 && l_iadx_320 > 25.0 && l_iadx_336 > 25.0 && l_iwpr_176 < l_iwpr_184 - 9.0 && l_ima_168 < l_ima_112) ||
         (li_452 && l_imacd_32 < l_imacd_40 && l_imacd_32 > 0.0 && l_imacd_32 < l_imacd_48 && l_iadx_320 > 25.0 && l_iadx_336 > 25.0 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_istochastic_392 < l_istochastic_400 &&
         l_istochastic_408 < l_istochastic_416 - 1.0) || (Close[2] > l_ibands_384 && Open[1] < l_ibands_376 && Open[0] < Close[1] && Open[1] > Close[1] && li_468 && l_iwpr_176 < l_iwpr_184 - 12.0 && l_istochastic_392 < l_istochastic_400 - 3.0 && l_istochastic_408 < l_istochastic_416 && l_ima_168 < l_ima_112 && l_ima_104 < l_ima_112) ||
         (l_iadx_336 > l_iadx_352 && l_iadx_344 > l_iadx_352 && l_iadx_328 <= l_iadx_336 && l_iadx_320 >= 35.0 && l_iadx_336 > 25.0 && l_iwpr_176 < l_iwpr_184 - 15.0 && li_444) ||
         (l_ima_88 < l_ima_96 && l_ima_104 < l_ima_112 && l_ima_80 < l_ima_160 && l_ima_80 < l_ima_152 - 0.0005 && l_ima_112 - l_ima_104 > l_ima_160 - l_ima_80 && l_ima_80 - l_ima_88 > l_ima_160 - l_ima_96 &&
         li_444 && l_iwpr_176 > -85.0 && l_iwpr_176 < l_iwpr_184 - 15.0 && l_ima_88 < l_ima_104 && l_ima_104 < l_ima_80 && Open[0] < l_ima_88) || ((li_460 && l_istochastic_400 > 75.0) ||
         (li_452 && l_istochastic_400 > 705.0) && l_ima_80 < l_ima_160 - 0.0002 && l_ima_168 < l_ima_112) || (li_436 && l_istochastic_256 > 70.0 && Open[1] < l_ima_144 && Close[1] < l_ima_128 && Open[0] < l_ima_64 && l_ima_104 > l_ima_128 && l_ima_104 > l_ima_112) ||
         (li_436 && Open[1] < l_ima_144 && Open[0] < l_ima_64 && Open[1] > Close[1] && l_iwpr_176 < l_iwpr_184 - 7.0 && l_idemarker_232 < l_idemarker_240 - 0.08 && l_istddev_216 > l_istddev_224) ||
         (Close[3] < l_ima_128 && Open[2] < l_ima_112 && Open[1] > Close[1] && Open[1] < Close[2] && Close[1] < l_ima_80 - 2.2 * l_istddev_224 && Open[0] < Close[1] && l_istddev_216 > l_istddev_224 &&
         li_444 && l_iwpr_176 < l_iwpr_184 - 7.0 && l_iwpr_176 > -90.0) || (l_ima_112 > l_ima_120 + 0.0001 && l_ima_104 < l_ima_112 - 0.0002 && l_ima_104 < l_ima_120 - 0.0001 && l_ima_112 > l_ima_160 && li_444 ||
         li_468 && Open[0] < Close[1]) || (l_ima_160 - l_ima_532 > l_ima_80 - l_ima_532 && l_ima_532 > (ld_512 + ld_520) / 2.0 + 2.0 * l_istddev_540 && l_ima_532 - l_ima_80 > l_istddev_540 && Open[0] < Close[1] && li_444) ||
         (iSAR(NULL, 0, 0.02, 0.2, 1) < Close[1] && iSAR(NULL, 0, 0.02, 0.2, 0) > Open[0] && iSAR(NULL, PERIOD_M15, 0.02, 0.2, 1) < iClose(NULL, PERIOD_M15, 1) && iSAR(NULL, PERIOD_M15, 0.02, 0.2, 0) > iOpen(NULL, PERIOD_M15, 0) &&
         iSAR(NULL, PERIOD_M30, 0.02, 0.2, 1) < iClose(NULL, PERIOD_M30, 1) && iSAR(NULL, PERIOD_M30, 0.02, 0.2, 0) > iOpen(NULL, PERIOD_M30, 0) && (Open[0] > Close[0] && Open[0] < Close[1] &&
         Bid < l_ima_80) || (l_ima_88 < l_ima_96 && l_imacd_32 < l_imacd_40 && l_imacd_32 > 0.0))) li_564 = 2;
      if (Predict() == 2.0 || Predict2() == 2.0 && Bid > (ld_512 + ld_520) / 2.0 && li_444 && l_istochastic_256 > 55.0) li_564 = 3;
      if (li_564 == 1 || li_564 == 2 || li_564 == 3) {
         if (l_price_552 > 0.0) l_price_552 = Bid + StopLoss * g_point_368;
         if (li_564 == 1) g_price_352 = Bid - gd_360 * g_point_368;
         if (li_564 == 2) g_price_352 = Bid - TakeProfit * g_point_368;
         if (li_564 == 3) g_price_352 = Bid - gd_360 * g_point_368;
         if(DayOfWeek()!=5)
         {
            l_ticket_4 = OrderSend(Symbol(), OP_SELL, LotsOptimized(), Bid, g_slippage_376, 0, 0, "Euro_Blaster", MagicNo, 0, Red);
            if (l_ticket_4 > 0) {
               if (OrderSelect(l_ticket_4, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice());
               OrderModify(OrderTicket(), OrderOpenPrice(), l_price_552, g_price_352, 0, CLR_NONE);
            } else Print("Error opening SELL order : ", GetLastError());
         }
         return (0);
      }
      return (0);
   }
   if (Profit_Protection && AccountEquity() > AccountBalance() * (Percent_Over_Balance / 100.0 + 1.0)) Close_All();
   for (int l_pos_0 = 0; l_pos_0 < l_count_16; l_pos_0++) {
      li_unused_572 = 0;
      OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNo) {
         l_price_576 = OrderStopLoss();
         if (OrderType() == OP_BUY) {
            if (AccountFreeMargin() <= 0.0 || (Balance_Protection && AccountEquity() + AccountMargin() < AccountBalance() * (1 - RiskPercent / 100.0))) {
               OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_376, Violet);
               return (0);
            }
            if (TrailingStop <= 0.0) continue;
            if (TrailingStop < l_stoplevel_548) TrailingStop = l_stoplevel_548;
            if (Bid - OrderOpenPrice() <= g_point_368 * TrailingStop) continue;
            if (NormalizeDouble(l_price_576, Digits) >= NormalizeDouble(Bid - g_point_368 * TrailingStop, Digits)) continue;
            l_price_576 = Bid - g_point_368 * TrailingStop;
            l_price_24 = OrderTakeProfit();
            if (TrailingProfit && li_440 && l_istochastic_256 < 70.0) l_price_24 = OrderTakeProfit() + TrailingPips * g_point_368;
            OrderModify(OrderTicket(), OrderOpenPrice(), l_price_576, l_price_24, 0, Blue);
            return (0);
         }
         if (AccountFreeMargin() <= 0.0 || (Balance_Protection && AccountEquity() + AccountMargin() < AccountBalance() * (1 - RiskPercent / 100.0))) {
            OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_376, Violet);
            return (0);
         }
         if (TrailingStop > 0.0) {
            if (TrailingStop < l_stoplevel_548) TrailingStop = l_stoplevel_548;
            if (OrderOpenPrice() - Ask > g_point_368 * TrailingStop) {
               if (NormalizeDouble(l_price_576, Digits) > NormalizeDouble(Ask + g_point_368 * TrailingStop, Digits) || NormalizeDouble(l_price_576, Digits) == 0.0) {
                  l_price_576 = Ask + g_point_368 * TrailingStop;
                  l_price_24 = OrderTakeProfit();
                  if (TrailingProfit && li_444 && l_istochastic_256 > 30.0) l_price_24 = OrderTakeProfit() - TrailingPips * g_point_368;
                  OrderModify(OrderTicket(), OrderOpenPrice(), l_price_576, l_price_24, 0, Red);
                  return (0);
               }
            }
         }
      }
   }
   return (0);
}

double LotsOptimized() {
   if (!MM) return (LotSize);
   if (Max_Lot_Size > 0.0) gd_316 = Max_Lot_Size;
   double ld_ret_0 = AccountFreeMargin() * RiskPercent / 400.0;
   ld_ret_0 = NormalizeDouble(MathFloor(ld_ret_0 / gd_340) * g_lotstep_332, 2);
   if (ld_ret_0 < g_minlot_324) ld_ret_0 = g_minlot_324;
   if (ld_ret_0 > gd_316) ld_ret_0 = gd_316;
   return (ld_ret_0);
   if (LotSize < g_minlot_324) LotSize = g_minlot_324;
   if (LotSize > gd_316) LotSize = gd_316;
   return (LotSize);
}

void Close_All() {
   int l_cmd_4;
   bool l_ord_close_8;
   for (int li_0 = OrdersTotal() - 1; li_0 >= 0; li_0--) {
      l_cmd_4 = OrderType();
      l_ord_close_8 = FALSE;
      if (OrderMagicNumber() == MagicNo || (OrderMagicNumber() != MagicNo && ProtectAll)) {
         switch (l_cmd_4) {
         case OP_BUY:
            l_ord_close_8 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), g_slippage_376, Pink);
            break;
         case OP_SELL:
            l_ord_close_8 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), g_slippage_376, Pink);
         }
         if (l_ord_close_8 == 0) Sleep(1000);
      }
   }
   Print("Account Profit Reached. All Open Trades Have Been Closed");
}

bool isTradeTime() {
   int l_str2time_4;
   int l_str2time_8;
   int l_datetime_0 = TimeCurrent();
   if (Use_Time_Mgmt) {
      l_str2time_4 = StrToTime(TradeStartHour + ":" + TradeStartMinutes);
      l_str2time_8 = StrToTime(TradeEndHour + ":" + TradeEndMinutes);
      if (l_str2time_4 < l_str2time_8 && l_datetime_0 < l_str2time_4 || l_datetime_0 >= l_str2time_8) return (FALSE);
      if (l_str2time_4 > l_str2time_8 && (l_datetime_0 < l_str2time_4 && l_datetime_0 >= l_str2time_8)) return (FALSE);
   }
   return (TRUE);
}

void closeExpiredOrders() {
   int l_datetime_0;
   int l_ord_total_4;
   if (gi_384) {
      if (Use_Time_Mgmt) {
         l_datetime_0 = TimeCurrent();
         l_ord_total_4 = OrdersTotal();
         for (int l_pos_8 = l_ord_total_4 - 1; l_pos_8 >= 0; l_pos_8--) {
            if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES) || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNo || OrderType() > OP_SELL) continue;
            if (l_datetime_0 - OrderOpenTime() > gi_348) OrderClose(OrderTicket(), OrderLots(), d_if(OrderType() == OP_BUY, Bid, Ask), g_slippage_376);
         }
      }
   }
}

double d_if(bool ai_0, double ad_4, double ad_12) {
   if (ai_0) return (ad_4);
   return (ad_12);
}
本博客所有文章如无特别注明均为原创。作者:天泓评测
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)