How to find a specific pending market order?

Created at 17 Aug 2024, 21:15
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RI

rick2010

Joined 08.08.2024

How to find a specific pending market order?
17 Aug 2024, 21:15


Anyone know how to find a market order that has not been filled yet?

I am placing multiple async market orders using: 

ExecuteMarketOrderAsync(TradeType.Buy, SymbolName, 10000, "OrderLabel");

Is this how I check to see if that order is still pending?

            foreach(PendingOrder order in PendingOrders) {           

               if(order.Label == "OrderLabel")
                   return true;        
           }

The reason I need to know this is to avoid duplicate trades.

TIA

 

 


 


@rick2010
Replies

PanagiotisCharalampous
19 Aug 2024, 05:53

Hi there, 

Pending orders are only limit, stop and stop limit orders. A market order is not a pending order.

Best regards,

Panagiotis


@PanagiotisCharalampous

rick2010
19 Aug 2024, 12:58 ( Updated at: 19 Aug 2024, 13:03 )

RE: How to find a specific pending market order?

PanagiotisCharalampous said: 

Hi there, 

Pending orders are only limit, stop and stop limit orders. A market order is not a pending order.

Best regards,

Panagiotis

MetaTrader has a way to find orders before they actually become an open position. I need to do the same with cTrader. If I put on several async market orders all at once I need to be able to check if they've been filled otherwise I get duplicates. I don't want to use callbacks. I need to be able to look them up by their custom label. Something like my example:

            foreach(Order order in SomeListOfUnfilledOrders) {           

               if(order.Label == “order123”)
                   return true;        
           }


@rick2010

PanagiotisCharalampous
20 Aug 2024, 04:36

RE: RE: How to find a specific pending market order?

rick2010 said: 

PanagiotisCharalampous said: 

Hi there, 

Pending orders are only limit, stop and stop limit orders. A market order is not a pending order.

Best regards,

Panagiotis

MetaTrader has a way to find orders before they actually become an open position. I need to do the same with cTrader. If I put on several async market orders all at once I need to be able to check if they've been filled otherwise I get duplicates. I don't want to use callbacks. I need to be able to look them up by their custom label. Something like my example:

            foreach(Order order in SomeListOfUnfilledOrders) {           

               if(order.Label == “order123”)
                   return true;        
 

Then you need to store this information on your side e.g. add market orders in a collection and remove them only after you have received an execution response from the server.


@PanagiotisCharalampous