using the check message method makes me nervous. What if there is an error and this mesaage doesn't come up, but a new order has been filled? Better to actually check the list of orders with a function like this:
//count open positions
protected int positionsTotal(Instrument instrument) throws JFException {
int counter = 0;
for (IOrder order : engine.getOrders(instrument)) {
if (order.getState() == IOrder.State.FILLED) {
counter++;
}
}
return counter;
}