if (OrdersTotal() > 0 ) { OrderSelect(SELECT_BY_POS, MODE_TRADES); { if((OrderType() == OP_SELL)||(OrderType() == OP_BUY)) return(true); } }