Navigation´╝ÜHome > Content >

Forex_Benz_AUDNZ_v7.mq4

Time: 2017-04-27 | Download file:Forex_Benz_AUDNZ_v7.mq4

#property copyright "http://www.forexbenz.com"
#property link      "http://www.forexbenz.com"

#import "benzaudnz.dll"
   void Init(int a0, int a1, int a2, double a3, int a4, int a5, double a6, double a7, int a8, double a9);
   int GetMagic(int a0);
   int GetS(int a0);
   int GetS1(int a0);
   double CalcLots(int a0);
   int CondG(int a0);
   void CondC(int a0);
   int CondB(int a0, int a1, double a2, double a3, double a4, int a5, int a6);
   void UpdateEx(int a0, int a1);
   int CondA(double a0, int a1, int a2);
   int Func(int a0, int a1);
#import

double Gd_76 = D'09.09.2001 05:46:40';
double Gd_84 = 100.0;
int Gi_92 = 2;
int Gi_96 = 5;
int Gi_100 = 6;
int Gi_104 = 8;
bool Gi_108 = TRUE;
bool Gi_112 = TRUE;
extern double Lots = 0.01;
extern double Multiplier = 1.6;
extern int MaxSpread = 8;
int Gi_136 = 1;
bool Gi_140 = FALSE;
double Gd_144 = 1.6;
extern int MaxOpenTrades = 12;
int G_file_156 = -1;
int G_count_160;
int G_count_164;
double Gd_168;
bool Gi_176 = FALSE;

// CE0BE71E33226E4C1DB2BCEA5959F16B
void f0_8(string As_0) {
   if (Gi_140)
      if (G_file_156 >= 0) FileWrite(G_file_156, TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS) + ": " + As_0);
}

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   G_file_156 = FileOpen(WindowExpertName() + "_" + Time[0] + "_" + Symbol() + ".log", FILE_WRITE);
   f0_8("Symbol()=" + Symbol() + ",Period=" + Period());
   Init(AccountNumber(), Gi_96, Digits, Point, Gi_136, Gi_92, Lots, Multiplier, MaxOpenTrades, Gd_144);
   Init(AccountNumber(), Gi_100, Digits, Point, Gi_136, Gi_92, Lots, Multiplier, MaxOpenTrades, Gd_144);
   if (Digits == 3 || Digits == 5) MaxSpread = 10 * MaxSpread;
   f0_0();
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   f0_2();
   f0_8("Closed");
   if (G_file_156 > 0) FileClose(G_file_156);
   return (0);
}

// F99D68FB006512E811761244F21D1F0A
int f0_9(int A_magic_0) {
   int count_8 = 0;
   G_count_160 = 0;
   G_count_164 = 0;
   for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
      if (OrderSelect(pos_4, SELECT_BY_POS)) {
         if (OrderMagicNumber() == A_magic_0) {
            count_8++;
            if (OrderType() == OP_BUY) G_count_160++;
            if (OrderType() == OP_SELL) G_count_164++;
         }
      }
   }
   return (count_8);
}

// 35165E15D176C3DBAA6BCE3386AE17D8
void f0_1(int A_magic_0, int Ai_4) {
   double price_32;
   double Ld_unused_40;
   double Ld_8 = -1;
   double Ld_16 = 111111111;
   for (int pos_24 = 0; pos_24 < OrdersTotal(); pos_24++) {
      if (OrderSelect(pos_24, SELECT_BY_POS)) {
         if (A_magic_0 == OrderMagicNumber()) {
            Ld_8 = MathMax(Ld_8, OrderOpenPrice());
            Ld_16 = MathMin(Ld_16, OrderOpenPrice());
         }
      }
   }
   int Li_28 = 0;
   for (pos_24 = 0; pos_24 < OrdersTotal(); pos_24++) {
      if (OrderSelect(pos_24, SELECT_BY_POS)) {
         if (A_magic_0 == OrderMagicNumber()) {
            price_32 = 0;
            Ld_unused_40 = 0;
            if (OrderType() == OP_SELL) price_32 = Ld_8 + Ai_4 * Point;
            else price_32 = Ld_16 - Ai_4 * Point;
            if (Li_28 == Gi_104) Gd_168 = OrderStopLoss();
            if (Li_28 > Gi_104) price_32 = Gd_168;
            if (NormalizeDouble(OrderStopLoss(), Digits) != NormalizeDouble(price_32, Digits)) OrderModify(OrderTicket(), OrderOpenPrice(), price_32, 0, OrderExpiration(), White);
         }
      }
   }
}

// C5A7E99141EEEFCB0510E8BEB7152151
int f0_7(int A_magic_0) {
   int ticket_16;
   int ticket_20;
   double order_lots_24;
   double order_lots_32;
   int ticket_40;
   bool Li_ret_4 = TRUE;
   int count_12 = 10;
   while (count_12 > 0) {
      count_12 = 0;
      order_lots_24 = 0;
      order_lots_32 = 0;
      for (int pos_8 = OrdersTotal() - 1; pos_8 >= 0; pos_8--) {
         if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderMagicNumber() == A_magic_0 || A_magic_0 == -1) {
               if (OrderLots() > order_lots_24) {
                  order_lots_24 = OrderLots();
                  ticket_16 = OrderTicket();
               }
               order_lots_32 = OrderLots();
               ticket_20 = OrderTicket();
               count_12++;
            }
         }
      }
      if (count_12 > 0) {
         if (order_lots_24 > order_lots_32) ticket_40 = ticket_16;
         else ticket_40 = ticket_20;
         if (OrderSelect(ticket_40, SELECT_BY_TICKET)) OrderClose(ticket_40, OrderLots(), OrderClosePrice(), MarketInfo(Symbol(), MODE_SPREAD));
         RefreshRates();
      }
   }
   return (Li_ret_4);
}

// 961F942C5DA3D9DD4B61136E1927C38F
void f0_4(int A_magic_0, int Ai_4) {
   int Li_8 = 0;
   for (int pos_12 = OrdersTotal() - 1; pos_12 >= 0; pos_12--) {
      if (OrderSelect(pos_12, SELECT_BY_POS)) {
         if (OrderMagicNumber() == A_magic_0) {
            Li_8 = (OrderClosePrice() - OrderOpenPrice()) / Point;
            if (OrderType() != OP_SELL) break;
            Li_8 = -1 * Li_8;
            break;
         }
      }
   }
   if (Li_8 >= Ai_4) f0_7(A_magic_0);
}

// 7CE58342490F2719632C99A1A5E38D1B
void f0_3(int A_x_0, int A_y_4, string A_name_8) {
   ObjectCreate(A_name_8, OBJ_LABEL, 0, 0, 0);
   ObjectSet(A_name_8, OBJPROP_CORNER, 0);
   ObjectSet(A_name_8, OBJPROP_XDISTANCE, A_x_0);
   ObjectSet(A_name_8, OBJPROP_YDISTANCE, A_y_4);
}

// A31CC313628C1016047703BA5C89BF1B
void f0_5(string A_name_0, string A_text_8) {
   ObjectSetText(A_name_0, A_text_8, 8, "", White);
}

// 647C654060B254405AA7795FD0CF52F2
void f0_2() {
   for (int count_0 = 0; count_0 < 20; count_0++) ObjectDelete("t_" + count_0);
}

// 2A508E8D00E1DDA662BF44E51D7FA006
void f0_0() {
   for (int count_0 = 0; count_0 < 20; count_0++) f0_3(5, 10 * count_0 + 15, "t_" + count_0);
}

// A3CD115B6329731696991CF56127DCA7
void f0_6() {
   int count_0 = 0;
   double Ld_4 = 0;
   for (int pos_12 = 0; pos_12 < OrdersTotal(); pos_12++) {
      if (OrderSelect(pos_12, SELECT_BY_POS)) {
         if (OrderMagicNumber() == GetMagic(Gi_96) || OrderMagicNumber() == GetMagic(Gi_100)) {
            f0_5("t_" + count_0, OrderMagicNumber() + "," + DoubleToStr(OrderLots(), 2) + "," + TimeToStr(OrderOpenTime()));
            count_0++;
            Ld_4 += OrderProfit() + OrderSwap();
         }
      }
   }
   f0_5("t_" + count_0, "Total: " + DoubleToStr(Ld_4, 2));
   for (pos_12 = count_0 + 1; pos_12 < 20; pos_12++) f0_5("t_" + pos_12, " ");
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_4;
   bool Li_8;
   int Li_12;
   if (AccountEquity() >= Gd_76 && AccountEquity() <= Gd_84) Gi_176 = TRUE;
   if (Gi_176) {
      f0_7(-1);
      return (0);
   }
   for (int count_0 = 0; count_0 < 2; count_0++) {
      Li_4 = Gi_96;
      if (count_0 == 1) Li_4 = Gi_100;
      Li_8 = TRUE;
      f0_6();
      Li_12 = f0_9(GetMagic(Li_4));
      if (Li_12 == 0) {
         for (int pos_16 = OrdersHistoryTotal() - 1; pos_16 >= 0; pos_16--)
            if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) Li_8 = CondB(Li_4, OrderMagicNumber(), OrderProfit(), OrderClosePrice(), OrderOpenPrice(), TimeCurrent(), OrderCloseTime());
      }
      if (Li_8) {
         if (Li_12 == 0) {
            if (!Gi_108 && GetS(Li_4) > 0) return;
            if (!Gi_112 && DayOfWeek() == 5) return;
            if (!(CondA(Bid, Li_4, 1))) return;
            CondC(Li_4);
         }
         if (CondA(Bid, Li_4, 0) == 1) {
            if (MarketInfo(Symbol(), MODE_SPREAD) <= MaxSpread) {
               if (Li_12 < MaxOpenTrades) {
                  if (CondG(Li_4) == 1) {
                     if (OrderSend(Symbol(), OP_BUY, NormalizeDouble(CalcLots(Li_4), 2), Ask, MarketInfo(Symbol(), MODE_SPREAD), 0, 0, WindowExpertName(), GetMagic(Li_4), 0, Green) != -1) UpdateEx(Li_4, 0);
                  } else
                     if (OrderSend(Symbol(), OP_SELL, NormalizeDouble(CalcLots(Li_4), 2), Bid, MarketInfo(Symbol(), MODE_SPREAD), 0, 0, WindowExpertName(), GetMagic(Li_4), 0, Red) != -1) UpdateEx(Li_4, 1);
               }
            }
         }
         Li_12 = f0_9(GetMagic(Li_4));
         f0_1(GetMagic(Li_4), GetS1(Li_4));
         f0_4(GetMagic(Li_4), Func(Li_4, Li_12));
      }
   }
   return (0);
}

Recommend