How partial order executions are notified to the EA?

 

Suppose a situation where the EA places an order with lot 2. If this order is partially executed then a full execution should produce two deals. The first one is notified in the OnTrade() method as being related to an order with status ORDER_STATE_PARTIAL. What about the second one? Will it be notified as being related to an order with status ORDER_STATE_FILLED (due the remaining lot was totally executed in the second deal), or will it be notified as being related to another ORDER_STATE_PARTIAL (due being partial or not is related to the original order)?

This situation can't be tested in the backtester, and I couldn't find details about this specific behavior in the docs.

 

You can even get more than 2 deals.

The deals will be notified in relation to initial order, with order status set accordingly.

 
Alain Verleyen:

You can even get more than 2 deals.

The deals will be notified in relation to initial order, with order status set accordingly.


Thanks Alain. So in case of partial order execution all the deals are related to orders with status ORDER_STATE_PARTIAL, right?

 
lorenooliveira:

Thanks Alain. So in case of partial order execution all the deals are related to orders with status ORDER_STATE_PARTIAL, right?

All deals are related to the initial order. The status depends of the...status :-D

Try it.

Reason: