Navigation´╝ÜHome > Content >

NEWTEC.mq4

Time: 2016-10-12 | Download file:NEWTEC.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.225.1g []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
extern string PAIR = "EURCHF M5";
extern string Expert_Name = "NEWTEC";
extern int Magicnumber = 12346;
extern bool Increase_Lots = FALSE;
extern int Risk = 200;
extern double Lots = 1.0;
extern double Maximum_Lots = 1000.0;
extern double Maximum_Spread = 7.0;
extern bool Hidden_TP = TRUE;
extern bool Hidden_SL = TRUE;
extern string license_holder = "registered to the following license holder";
extern string Name = "William Bolton";
extern string Email = "whb1949@cox.net";
extern string company_Name = "Quantum Pendant";
extern string company_city = "3016 Plaza De Monte";
extern string company_street = "NV 89102, Las Vegas";
extern string developer = "copyrights informations";
extern string MAIL = "newtec@mail-me.com";
int gi_200 = 4;
int gi_204 = 622;
int gi_208 = 732;
int gi_212 = 5;
bool gi_216 = TRUE;
int g_period_220 = 11;
int gi_224 = 14;
int g_slippage_228 = 3;
int gi_232 = 10;
int gi_236 = 1;
int gi_240 = 3;
int gi_244 = 7;
int gi_248 = 60;
int gi_252 = 140;
int gi_256 = 170;
int gi_260 = 200;
int gi_264 = 240;
int gi_268 = 3;
int gi_272 = 2;
int gi_276 = 0;
int gi_280 = 1;
int gi_unused_284 = 4;
int gi_288 = 22;
int gi_292 = 23;
double gd_296 = 500000000000.0;
int g_count_304 = 0;
double g_ord_open_price_308 = 0.0;
double g_ord_open_price_316 = 0.0;
int gi_324 = 55;
bool gi_328 = FALSE;
int g_bars_332 = -1;
bool gi_unused_336 = TRUE;
bool gi_unused_340 = TRUE;
double g_ifractals_344;
double g_ifractals_352;
double gd_unused_360;
double gd_unused_368;
double g_ifractals_376;
double g_ifractals_384;
double gd_unused_392;
double gd_unused_400;
int gi_unused_408 = 0;
int gi_unused_412 = 0;
int gi_unused_416 = 0;
double gd_420 = 0.0;
double gd_unused_428 = 0.0;
double gd_unused_436 = 0.0;
int gi_unused_444;
int gi_448;
int gi_452;
double gd_456;
double gd_464;
double g_point_472;

int init() {
   gd_456 = SetPoint();
   gd_464 = SetBroker();
   g_point_472 = MarketInfo(Symbol(), MODE_POINT);
   return (0);
}

int start() {
   double ld_0 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2);
   if (ld_0 == 0.01) gi_452 = 2;
   else {
      if (ld_0 == 0.1) gi_452 = 1;
      else gi_452 = 0;
   }
   gi_448 = gi_452;
   if (gi_328 == TRUE) {
      CloseAll();
      return (0);
   }
   if (gd_296 > 0.0 && AccountEquity() >= gd_296) {
      ForceCloseAll();
      return (0);
   }
   int l_count_8 = 0;
   int l_count_12 = 0;
   int l_count_16 = 0;
   int l_ticket_20 = -1;
   int l_pos_24 = 0;
   for (l_pos_24 = 0; l_pos_24 < OrdersTotal(); l_pos_24++) {
      OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magicnumber && OrderCloseTime() == 0) {
         l_count_16++;
         if (OrderType() == OP_BUY) {
            l_count_8++;
            g_ord_open_price_308 = OrderOpenPrice();
         }
         if (OrderType() == OP_SELL) {
            l_count_12++;
            g_ord_open_price_316 = OrderOpenPrice();
         }
      }
   }
   for (int li_28 = 1; li_28 < Bars; li_28++) {
      if (iFractals(NULL, PERIOD_M15, MODE_UPPER, li_28) != 0.0) {
         g_ifractals_344 = iFractals(NULL, PERIOD_M15, MODE_UPPER, li_28);
         gd_unused_368 = Time[li_28];
         break;
      }
   }
   for (int li_32 = 1; li_32 < Bars; li_32++) {
      if (iFractals(NULL, PERIOD_M15, MODE_LOWER, li_32) != 0.0) {
         g_ifractals_352 = iFractals(NULL, PERIOD_M15, MODE_LOWER, li_32);
         gd_unused_360 = Time[li_32];
         break;
      }
   }
   for (int li_36 = 1; li_36 < Bars; li_36++) {
      if (iFractals(NULL, PERIOD_H1, MODE_UPPER, li_36) != 0.0) {
         g_ifractals_376 = iFractals(NULL, PERIOD_H1, MODE_UPPER, li_36);
         gd_unused_400 = Time[li_36];
         break;
      }
   }
   for (int li_40 = 1; li_40 < Bars; li_40++) {
      if (iFractals(NULL, PERIOD_H1, MODE_LOWER, li_40) != 0.0) {
         g_ifractals_384 = iFractals(NULL, PERIOD_H1, MODE_LOWER, li_40);
         gd_unused_392 = Time[li_32];
         break;
      }
   }
   gi_unused_408 = MathRound((g_ifractals_344 - g_ifractals_352) / gd_456);
   gi_unused_412 = MathRound((g_ifractals_376 - g_ifractals_384) / gd_456);
   gd_420 = 0;
   gd_420 = g_ifractals_344 - (g_ifractals_344 - g_ifractals_352) / 2.0;
   gi_unused_444 = MathRound(iATR(Symbol(), PERIOD_M15, 4, 0) / gd_456);
   bool li_44 = FALSE;
   if (Close[0] <= g_ifractals_376 && Close[0] >= g_ifractals_384) li_44 = TRUE;
   if (gi_216 == TRUE) {
      for (int l_pos_48 = 0; l_pos_48 < OrdersTotal(); l_pos_48++) {
         OrderSelect(l_pos_48, SELECT_BY_POS, MODE_TRADES);
         if (OrderType() == OP_BUY && OrderMagicNumber() == Magicnumber) {
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_248 && TimeCurrent() - OrderOpenTime() < 60 * gi_252 && Bid >= OrderOpenPrice() + gi_268 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Orange);
               Print("Prot. Level 1 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_252 && TimeCurrent() - OrderOpenTime() < 60 * gi_256 && Bid >= OrderOpenPrice() + gi_272 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Orange);
               Print("Prot. Level 2 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_256 && TimeCurrent() - OrderOpenTime() < 60 * gi_260 && Bid >= OrderOpenPrice() + gi_276 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Orange);
               Print("Prot. Level 3 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_260 && TimeCurrent() - OrderOpenTime() < 60 * gi_264 && Bid >= OrderOpenPrice() - gi_280 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Orange);
               Print("Prot. Level 4 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
         }
         if (OrderType() == OP_SELL && OrderMagicNumber() == Magicnumber) {
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_248 && TimeCurrent() - OrderOpenTime() < 60 * gi_252 && Ask <= OrderOpenPrice() - gi_268 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Orange);
               Print("Prot. Level 1 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_252 && TimeCurrent() - OrderOpenTime() < 60 * gi_256 && Ask <= OrderOpenPrice() - gi_272 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Orange);
               Print("Prot. Level 2 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_256 && TimeCurrent() - OrderOpenTime() < 60 * gi_260 && Ask <= OrderOpenPrice() - gi_276 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Orange);
               Print("Prot. Level 3 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
            if (TimeCurrent() - OrderOpenTime() > 60 * gi_260 && TimeCurrent() - OrderOpenTime() < 60 * gi_264 && Ask <= OrderOpenPrice() + gi_280 / 10000.0) {
               RefreshRates();
               OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Orange);
               Print("Prot. Level 4 - Close Price :" + DoubleToStr(OrderClosePrice(), Digits) + " Lots : " + DoubleToStr(OrderLots(), gi_448) + " Order Number : " + DoubleToStr(OrderTicket(), 0) +
                  " Profit : $ " + DoubleToStr(OrderProfit(), 2));
            }
         }
      }
   }
   CloseAll();
   double l_icustom_52 = iCustom(Symbol(), PERIOD_M1, "Moving averageSigma", gi_224, 1, 0, 0.2, 6, 0, 9, 1, "", "", 4, 0);
   if (IsTradeTime() && IsTradeTimeA()) {
      if (l_count_16 <= gi_232) {
         if (g_bars_332 != Bars) {
            g_count_304 = 0;
            g_bars_332 = Bars;
         }
         RefreshRates();
         if (Ask - Bid < Maximum_Spread / 10000.0 && li_44 && g_count_304 <= gi_236) {
            if (l_count_8 < 1 && l_icustom_52 <= -0.12 && Bid <= gd_420 - gi_244 / 10000.0 && GetSignal(0) == 1) {
               if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("No money.Reduce your Lots! Free Margin = ", AccountFreeMargin());
               else {
                  if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, Ask - gi_208 * g_point_472 * gd_464, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Blue);
                  else {
                     if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, 0, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Blue);
                     else {
                        l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, Ask - gi_208 * g_point_472 * gd_464, Ask + gi_200 * g_point_472 * gd_464, Expert_Name + " " +
                           Symbol(), Magicnumber, 0, Blue);
                     }
                  }
                  if (l_ticket_20 > 0) g_count_304++;
               }
               gi_unused_340 = TRUE;
            }
            if (l_count_8 > 0 && l_count_8 < gi_240 && l_icustom_52 <= -0.12 && g_ord_open_price_308 - Bid >= gi_212 / 10000.0 && Bid <= gd_420 - gi_244 / 10000.0 && GetSignal(0) == 1) {
               if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("No money.Reduce your Lots! Free Margin = ", AccountFreeMargin());
               else {
                  if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, Ask - gi_208 * g_point_472 * gd_464, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Blue);
                  else {
                     if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, 0, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Blue);
                     else {
                        l_ticket_20 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_228, Ask - gi_208 * g_point_472 * gd_464, Ask + gi_200 * g_point_472 * gd_464, Expert_Name + " " +
                           Symbol(), Magicnumber, 0, Blue);
                     }
                  }
                  if (l_ticket_20 > 0) g_count_304++;
               }
               gi_unused_340 = TRUE;
               gi_unused_336 = FALSE;
            }
            if (l_count_12 < 1 && l_icustom_52 >= 0.12 && Ask >= gd_420 + gi_244 / 10000.0 && GetSignal(1) == 1) {
               if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("No money.Reduce your Lots! Free Margin = ", AccountFreeMargin());
               else {
                  if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, Bid + gi_208 * g_point_472 * gd_464, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Red);
                  else {
                     if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, 0, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Red);
                     else {
                        l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, Bid + gi_208 * g_point_472 * gd_464, Bid - gi_200 * g_point_472 * gd_464, Expert_Name +
                           " " + Symbol(), Magicnumber, 0, Red);
                     }
                  }
                  if (l_ticket_20 > 0) g_count_304++;
               }
               gi_unused_336 = TRUE;
            }
            if (l_count_12 > 0 && l_count_12 < gi_240 && l_icustom_52 >= 0.12 && Ask - g_ord_open_price_316 >= gi_212 / 10000.0 && Ask >= gd_420 + gi_244 / 10000.0 && GetSignal(1) == 1) {
               if (AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) Print("No money.Reduce your Lots! Free Margin = ", AccountFreeMargin());
               else {
                  if (Hidden_TP == TRUE && Hidden_SL == FALSE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, Bid + gi_208 * g_point_472 * gd_464, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Red);
                  else {
                     if (Hidden_TP == TRUE && Hidden_SL == TRUE) l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, 0, 0, Expert_Name + " " + Symbol(), Magicnumber, 0, Red);
                     else {
                        l_ticket_20 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_228, Bid + gi_208 * g_point_472 * gd_464, Bid - gi_200 * g_point_472 * gd_464, Expert_Name +
                           " " + Symbol(), Magicnumber, 0, Red);
                     }
                  }
                  if (l_ticket_20 > 0) g_count_304++;
               }
               gi_unused_336 = TRUE;
               gi_unused_340 = FALSE;
            }
         }
      }
      if (l_icustom_52 < 0.1 && l_icustom_52 > -0.1) {
         gi_unused_340 = TRUE;
         gi_unused_336 = TRUE;
      }
   }
   return (0);
}

int GetSignal(int ai_0) {
   bool li_ret_4 = FALSE;
   if (ai_0 == 0) {
      if (Ask <= NormalizeDouble(iMA(Symbol(), PERIOD_M5, g_period_220, 0, MODE_SMA, PRICE_OPEN, 0), Digits) - 0.0003) li_ret_4 = TRUE;
   } else {
      if (ai_0 == 1)
         if (Bid >= NormalizeDouble(iMA(Symbol(), PERIOD_M5, g_period_220, 0, MODE_SMA, PRICE_OPEN, 0), Digits) + 0.0003) li_ret_4 = TRUE;
   }
   return (li_ret_4);
}

void CloseAll() {
   for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
      OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magicnumber && OrderCloseTime() == 0) {
         if (SecurProfit() == 1) {
            if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Blue);
            if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Red);
         } else {
            if (IsTradeTime()) {
               if (OrderType() == OP_BUY && (OrderOpenPrice() - Bid) / 0.0001 > gi_204) OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Blue);
               if (OrderType() == OP_SELL && (Ask - OrderOpenPrice()) / 0.0001 > gi_204) OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Red);
            } else {
               if (Hidden_SL == TRUE)
                  if (OrderType() == OP_BUY && (OrderOpenPrice() - Bid) / 0.0001 > gi_208) OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Blue);
               if (OrderType() == OP_SELL && (Ask - OrderOpenPrice()) / 0.0001 > gi_208) OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Red);
            }
         }
      }
   }
}

void ForceCloseAll() {
   for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
      OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magicnumber && OrderCloseTime() == 0) {
         if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_228, Blue);
         if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_228, Red);
      }
   }
}

bool IsTradeTime() {
   if (gi_288 < gi_292 && TimeHour(TimeCurrent()) < gi_288 || TimeHour(TimeCurrent()) >= gi_292) return (FALSE);
   if (gi_288 > gi_292 && (TimeHour(TimeCurrent()) < gi_288 && TimeHour(TimeCurrent()) >= gi_292)) return (FALSE);
   if (gi_288 == 0) gi_292 = 24;
   if (Hour() == gi_292 - 1 && Minute() >= gi_324) return (FALSE);
   return (TRUE);
}

int IsTradeTimeA() {
   if (DayOfWeek() == 5 && Hour() >= gi_292) return (0);
   return (1);
}

double GetLots() {
   double ld_ret_0;
   double ld_8;
   int li_16;
   double l_lotsize_20 = MarketInfo(Symbol(), MODE_LOTSIZE);
   double ld_28 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2);
   double ld_36 = NormalizeDouble(MarketInfo(Symbol(), MODE_MARGINREQUIRED), 4);
   if (ld_28 == 0.01) li_16 = 2;
   else {
      if (ld_28 == 0.1) li_16 = 1;
      else li_16 = 0;
   }
   gi_448 = li_16;
   if (Increase_Lots == TRUE) ld_ret_0 = NormalizeDouble(AccountFreeMargin() * Risk / l_lotsize_20 / gi_232, gi_448);
   else ld_ret_0 = Lots;
   double ld_44 = NormalizeDouble(MarketInfo(Symbol(), MODE_MINLOT), 2);
   double ld_52 = NormalizeDouble(MarketInfo(Symbol(), MODE_MAXLOT), 2);
   if (gi_448 == 2) ld_44 = 0.01;
   if (gi_448 == 1) ld_44 = 0.1;
   if (gi_448 == 0) ld_44 = 1;
   if (ld_ret_0 < ld_44) ld_ret_0 = ld_44;
   if (ld_52 > Maximum_Lots) ld_8 = Maximum_Lots;
   else ld_8 = ld_52;
   if (ld_ret_0 > ld_8) ld_ret_0 = ld_8;
   return (ld_ret_0);
}

double TickValue() {
   double ld_0 = NormalizeDouble(MarketInfo(Symbol(), MODE_TICKVALUE), Digits);
   return (ld_0);
}

int SecurProfit() {
   bool li_ret_0 = FALSE;
   if (OrderProfit() > TickValue() * GetLots() * gi_200 * gd_464) li_ret_0 = TRUE;
   return (li_ret_0);
}

double SetPoint() {
   double ld_ret_0;
   if (Digits == 5 || Digits == 3) ld_ret_0 = 0.00001;
   else ld_ret_0 = 0.0001;
   return (ld_ret_0);
}

int SetBroker() {
   double ld_ret_0;
   if (Digits == 5 || Digits == 3) ld_ret_0 = 10;
   else ld_ret_0 = 1;
   return (ld_ret_0);
}

Recommend