Manages all open order (other pairs too)

 
Hello,

I'm trying to write a code to manage all open orders regardless it's pairs. My idea is to attach it on one pair only but will manage orders from other pairs too.
But it seems this code is failed, any idea why?

for(int i=OrdersTotal()-1;i>=0;i--)
 {   
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderType()==OP_BUY)
    { 
      if(OrderOpenPrice()-Bid >= 25*Point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_BID),5,0);
      if(Bid-OrderOpenPrice() >= 30*Point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_BID),5,0);
      return(0);
    }
   if(OrderType()==OP_SELL)
    {
      if(Ask-OrderOpenPrice() >= 25*Point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_ASK),5,0);
      if(OrderOpenPrice()-Ask >= 30*Point) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_ASK),5,0);    
      return(0);         
    }       
 }

Thank you
 

What error do you get?

 
Replace OrderSelect(i, SELECT_BY_POS, MODE_TRADES) with if(OrderSelect(i, SELECT_BY_POS)) {/* */}
Replace Bid with MarketInfo(OrderSymbol(),MODE_BID)
Replace Ask with MarketInfo(OrderSymbol(),MODE_ASK)
Replace Point with MarketInfo(OrderSymbol(),MODE_POINT)
 
Well, it's already solved. Thank you.
 
Yes, You were using wrong prices in your sample.
Reason: