Tom299 wrote:
when using the tester, you can use message.getContent().contains("Order closed") to find out, that
an order was closed and reset variables etc. but with running strategy on demo, this message will
never appear. instead of, the message will look like:
Order FILLED at 1.26935 USD (#47103447 BUY 0.98104 mil. EUR/USD @ MKT) - Position #9864059
Do not use message.getContent(), use message.getType() == IMessage.Type.ORDER_CLOSE_OK instead
Tom299 wrote:
when i have a look at the state of this order: order.getState=FILLED, but the order should be "CLOSED"
It is possible when order is partially closed.
Tom299 wrote:
i think this is confusing, when i open an order, the state should be "open" until it will be closed, then the
state should be "closed". when state is "FILLED" i don't know if i opened or closed a trad
Order changes it's status from CREATED to OPENED when server sends back a responce about accepted order. For market orders it lasts only few seconds, for limit orders this status will be untill condition is reached. After money are bought or sold, order becomes FILLED. After you close the order it becomes CLOSED
Tom299 wrote:
which messages should i use to make sure to find all open and close messages to make my strategy running
on demo/real account like with the tester?
You should use IMessage.getType() to check what kind of message it is.