Dear Support,
I have an issue properly detecting when an order was Filled.
I created a sample strategy to demonstrate the issue. In a nutshell:
- I submit orders in the onBar() function. I handle a private Set, and add the orders into the set after the engine.submitOrder() was called.
- I want to do certain action after the order is filled. I used to do this by using to onMessage() function, and checking if the strategy receive an ORDER_FILL_OK message of this particular order.
This used to be a working scenario, but now it is not working anymore, because after a certain onMessage() call, the order in the private Set is not the same anymore that is available within message.getOrder().
This is a sample output of the strategy attached:
2015-12-15 20:28:00 Order fill
2015-12-15 20:28:00 false
2015-12-15 20:28:00 myOrders:[EURUSD1]-FILLED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 anOrder: [EURUSD1]-FILLED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 message: Message Type: ORDER_FILL_OK; Text: ; Related Order: [EURUSD1]-FILLED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 false
2015-12-15 20:28:00 myOrders:[EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 anOrder: [EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 message: Message Type: NOTIFICATION; Text: ORDER_FILLED-Order FILLED at 1.09137 (#369216953 SELL 0.005 mil. EUR/USD @ MKT MAX SLIPPAGE 0) - Position #96057133; Related Order: [EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 Order submit
2015-12-15 20:28:00 false
2015-12-15 20:28:00 myOrders:[EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 anOrder: [EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 message: Message Type: ORDER_SUBMIT_OK; Text: ; Related Order: [EURUSD1]-OPENED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 true
2015-12-15 20:28:00 myOrders:[EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 anOrder: [EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 message: Message Type: NOTIFICATION; Text: ORDER_ACCEPTED-Order ACCEPTED: #369216954 STOP LOSS BUY 0.005 mil. EUR/USD @ MKT IF ASK => 1.09195 - Position #96057133; Related Order: [EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 true
2015-12-15 20:28:00 myOrders:[EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 anOrder: [EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 message: Message Type: NOTIFICATION; Text: ORDER_ACCEPTED-Order ACCEPTED: #369216953 SELL 0.005 mil. EUR/USD @ MKT MAX SLIPPAGE 0 - Position #96057133; Related Order: [EURUSD1]-CREATED / EUR/USD / 1.09137 / 0.005 / 0.005
2015-12-15 20:28:00 --Sending SHORT EURUSD1; amount=0.005; price=0.00000; SL=1.09195
2015-12-15 20:28:00 adding order to set. myorders size: 0
I've indicated with red when things go wrong.
Edit: color codes seems to to work within /code block, so I removed them. But I think it is visible what is wrong: We should get 'true', instead of getting 'false'.
What is strange that on the Historical Test this strategy is working as designed. (So the condition of myOrders.contains(anOrder) is always true.
If this is a bug, could you advise how to work around, till the bug is fixed?
Thanks and regards.