How to make this EA work with other EA?

 

This is the EA I want to modify to work with others.It's a simple grid EA.It use AccountBalance() and AccountEquity(),so when other EA have oders in list. This EA can't work correctly.Someone please help.

extern int Step = 170;
extern double FirstLot = 0.1;
extern double IncLot = 0.0;
extern double MinProfit = 15.0;
extern int Magic = 2008;
double g_ord_lots_108 = 0.0;
double g_ord_lots_116 = 0.0;
double gd_124;
double gd_132;
int gi_140 = 1635190;

int init() {
   if (IsConnected()) {
      Comment("wahaha");
      GlobalVariableSet("OldBalance", AccountBalance());
      return (0);
   }
}

int deinit() {
   if (IsConnected()) {
      Comment("");
      return (0);
   }
}

int start() {
   if (IsConnected()) {
      if (AccountEquity() >= GlobalVariableGet("OldBalance") + MinProfit) {
         DeletePendingOrders(Magic);
         CloseOrders(Magic);
         GlobalVariableSet("OldBalance", 0);
      }
      GlobalVariableSet("OldBalance", AccountBalance());
      if (MyOrdersTotal(Magic) == 0) {
         OrderSend(Symbol(), OP_BUYLIMIT, FirstLot, Ask - Step * Point, 3, 0, 0, "", Magic, 0, Green);
         OrderSend(Symbol(), OP_SELLLIMIT, FirstLot, Bid + Step * Point, 3, 0, 0, "", Magic, 0, Red);
      }
      gd_124 = GetLastSellPrice(Magic);
      gd_132 = GetLastBuyPrice(Magic);
      if (gd_124 - Bid <= 5.0 * Point) OrderSend(Symbol(), OP_SELLLIMIT, g_ord_lots_108 + IncLot, gd_124 + Step * Point, 3, 0, 0, "", Magic, 0, Red);
      if (Ask - gd_132 <= 5.0 * Point) OrderSend(Symbol(), OP_BUYLIMIT, g_ord_lots_116 + IncLot, gd_132 - Step * Point, 3, 0, 0, "", Magic, 0, Red);
   }
   return (0);
}

int DeletePendingOrders(int a_magic_0) {
   int l_ord_total_4;
   if (IsConnected()) {
      l_ord_total_4 = OrdersTotal();
      for (int l_pos_8 = l_ord_total_4 - 1; l_pos_8 >= 0; l_pos_8--) {
         OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() != OP_BUY || OrderType() != OP_SELL) OrderDelete(OrderTicket());
      }
   }
   return (0);
}

int CloseOrders(int a_magic_0) {
   int l_ord_total_4;
   if (IsConnected()) {
      l_ord_total_4 = OrdersTotal();
      for (int l_pos_8 = l_ord_total_4 - 1; l_pos_8 >= 0; l_pos_8--) {
         OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) {
            if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3);
            if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3);
         }
      }
   }
   return (0);
}

int MyOrdersTotal(int a_magic_0) {
   int l_count_4;
   int l_ord_total_8;
   if (IsConnected()) {
      l_count_4 = 0;
      l_ord_total_8 = OrdersTotal();
      for (int l_pos_12 = 0; l_pos_12 < l_ord_total_8; l_pos_12++) {
         OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) l_count_4++;
      }
   }
   return (l_count_4);
}

double GetLastBuyPrice(int a_magic_0) {
   int li_4;
   if (IsConnected()) {
      li_4 = OrdersTotal() - 1;
      for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
         OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUYLIMIT || OrderType() == OP_BUY) {
            g_ord_lots_116 = OrderLots();
            return (OrderOpenPrice());
         }
      }
   }
   return (0);
}

double GetLastSellPrice(int a_magic_0) {
   int li_4;
   if (IsConnected()) {
      li_4 = OrdersTotal() - 1;
      for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
         OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_SELLLIMIT || OrderType() == OP_SELL) {
            g_ord_lots_108 = OrderLots();
            return (OrderOpenPrice());
         }
      }
   }
   return (100000);
}

 

It seems to me decompiled