Looping all orders that are in the processed of being opened

ycomp  

Hello,

I would like to loop all uncompleted orders - meaning: orders that I have opened with OrderSendAsync(), and retrieve the comments. They can be market, stop, limit, etc. orders.

By comment I mean what was specified in OrderSendAsync(), not the broker supplied comment.

So this means I would like to ignore any orders that I opened with OrderSendAsync() that are no longer queued.. maybe they got opened, maybe closed.. maybe errored, doesn't matter - I just want to ignore them.

So could someone just explain generally how this is done? And should I use CTrade()? would that make things easier?

Fernando Carreiro  
ycomp: Hello, I would like to loop all uncompleted orders - meaning: orders that I have opened with OrderSendAsync(), and retrieve the comments. They can be market, stop, limit, etc. orders. By comment I mean what was specified in OrderSendAsync(), not the broker supplied comment. So this means I would like to ignore any orders that I opened with OrderSendAsync() that are no longer queued.. maybe they got opened, maybe closed.. maybe errored, doesn't matter - I just want to ignore them. So could someone just explain generally how this is done? And should I use CTrade()? would that make things easier?

In general terms, I would think that if the order has still not been processed by the trade server then the conclusion is that comment is the original one and not the broker's one.

As for it's state, the ENUM_ORDER_STATE property can help you identify asynchronously placed orders that have still not been accepted by the trade server ...

Each order has a status that describes its state. To obtain information, use OrderGetInteger() or HistoryOrderGetInteger() with the ORDER_STATE modifier. Allowed values are stored in the ENUM_ORDER_STATE enumeration.

ENUM_ORDER_STATE

Identifier

Description

ORDER_STATE_STARTED

Order checked, but not yet accepted by broker

ORDER_STATE_PLACED

Order accepted

ORDER_STATE_CANCELED

Order canceled by client

ORDER_STATE_PARTIAL

Order partially executed

ORDER_STATE_FILLED

Order fully executed

ORDER_STATE_REJECTED

Order rejected

ORDER_STATE_EXPIRED

Order expired

ORDER_STATE_REQUEST_ADD

Order is being registered (placing to the trading system)

ORDER_STATE_REQUEST_MODIFY

Order is being modified (changing its parameters)

ORDER_STATE_REQUEST_CANCEL

Order is being deleted (deleting from the trading system)

ycomp  

Fernando Carreiro #:

In general terms, I would think that if the order has still not been processed by the trade server then the conclusion is that comment is the original one and not the broker's one.

As for it's state, the ENUM_ORDER_STATE property can help you identify asynchronously placed orders that have still not been accepted by the trade server ...

Each order has a status that describes its state. To obtain information, use OrderGetInteger() or HistoryOrderGetInteger() with the ORDER_STATE modifier. Allowed values are stored in the ENUM_ORDER_STATE enumeration.

ENUM_ORDER_STATE

Identifier

Description

ORDER_STATE_STARTED

Order checked, but not yet accepted by broker

ORDER_STATE_PLACED

Order accepted

ORDER_STATE_CANCELED

Order canceled by client

ORDER_STATE_PARTIAL

Order partially executed

ORDER_STATE_FILLED

Order fully executed

ORDER_STATE_REJECTED

Order rejected

ORDER_STATE_EXPIRED

Order expired

ORDER_STATE_REQUEST_ADD

Order is being registered (placing to the trading system)

ORDER_STATE_REQUEST_MODIFY

Order is being modified (changing its parameters)

ORDER_STATE_REQUEST_CANCEL

Order is being deleted (deleting from the trading system)

thanks Fernando, gives me a place to start.

Fernando Carreiro  
ycomp #: thanks Fernando, gives me a place to start.
You are welcome!
Reason: