open new order when previous open trades are in profits

 
bool Profit()
  { 
  bool exist =false;
  int orderstotal=OrdersTotal();
   int orders=0;
   double ordticket[30][4];
   
   ArrayInitialize(ordticket,EMPTY_VALUE);
   bool Profits=posType==OP_BUY ? Ask-OrderOpenPrice()>(OrderTakeProfit()-OrderOpenPrice()) : OrderOpenPrice()-Bid>(OrderOpenPrice()-OrderTakeProfit());
   for(int i=0; i<orderstotal; i++)
           {
            if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
               if( OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic_Number )
                 {
                  continue;
                 }
            ordticket[orders][0] = (double)OrderOpenTime();
            ordticket[orders][1] = OrderTicket();
            ordticket[orders][2] = OrderOpenPrice();
            ordticket[orders][3] = OrderTakeProfit();
 
            orders++;
           }
         if(orders>1)
           {
            ArrayResize(ordticket,orders);
            ArraySort(ordticket);
           }
           else exist =true;
      for(int i=0; i<orders; i++)
           {
           
            if(OrderSelect((int)ordticket[i][1],SELECT_BY_TICKET))
                if(!Profits)
                {
                continue;
                }
                exist =true;
            }
          return(exist);
          }  
 

Hi want my ea to open another trade on when previously opened trade are in profits mql4 code above is a function for checking if trades are in profits,it is  still true when in loss

Reason: