On a LIVE account, I have received the message...
ORDER_CLOSE_REJECTED message wrote:
ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state... [truncated for brevity]
...even while message.getOrder().getState() returns OPEN.
It can be demonstrated from the code and log below that
- order.getState()==OPEN (line 12)
- message.getOrder()==order (line 3, because the exception was not thrown)
- message.getType()==ORDER_CLOSE_REJECTED (line 18)
- message.getContent()=="ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state... (line 22)
Or am I missing something?
The contiguous code snippet...
void message(IMessage message) throws UnexpectedMessageException {
Debug.assertFalse(isSimulating());
if (message.getOrder() != order) {
throw new UnexpectedMessageException("This message is not intended for my order.");
}
String myComment = null;
String messageContent = message.getContent();
if (messageContent != null && messageContent.contains("Invalid price format - please use increments of 0.1 pip.")) {
myComment = "targetEntry=" + getTargetEntry() + ", targetSl=" + getTargetSl() + ", targetTp=" + getTargetTp();
}
if (messageContent != null && messageContent.contains("ORDER_ALREADY_FILLED")) {
myComment = "getState()==" + order.getState() + ", getFillTime()==" + order.getFillTime();
}
if (log != null) {
logWriteTag("MSG");
log.print(Conversions.gmtDateStr(message.getCreationTime()));
log.print(',');
log.print(message.getType());
log.print(',');
log.print(order.getId());
log.print(',');
log.println(message.getContent());
if (myComment != null) {
logWriteTag("CMT");
log.print(',');
log.print(',');
log.print(',');
log.println(myComment);
}
}
// more code followed this snippet
...generated this contiguous log snippet...
the log wrote:
MSG,+,2013.02.20 16:05:00.721,ORDER_CLOSE_REJECTED,18898680,ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state, order #78576575 ENTRY SELL 0.003 mil. EUR/USD @ LIMIT 1.33598 IF BID <= 1.33628
CMT,+,,,,getState()==OPENED, getFillTime()==0
At the same time, this was found in the Java console:
Java console wrote:
20.02.2013 18:04:20.085 SEVERE connection.a ] Feedback received catched and throwed: null
20.02.2013 18:04:20.085 SEVERE a.c ] Runnable execution error
java.lang.NullPointerException
at com.dukascopy.charts.data.a.e.d(Unknown Source)
at com.dukascopy.dds2.greed.connection.a.j(Unknown Source)
at com.dukascopy.dds2.greed.connection.a.a(Unknown Source)
at com.dukascopy.transport.client.a.d.execute(Unknown Source)
at com.dukascopy.transport.client.a.c.run(Unknown Source)
at com.dukascopy.transport.client.j.run(Unknown Source)
This message was received (and the log snippet generated) repeatedly (perhaps 50 times, until I noticed it and stopped the strategy) because my strategy repeatedly tried to close the order.