(Positions.Find(order.label) == null) Equivalent for Pending Orders

Created at 09 Nov 2015, 04:54
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!
SI

sim_trader

Joined 03.08.2013

(Positions.Find(order.label) == null) Equivalent for Pending Orders
09 Nov 2015, 04:54


Hi cTDN,

I am new to the forum and C-trader.

I need to be able to look through pending orders and see if a label already exists.

Or in simple terms how do I achieve this

(Positions.Find(order.label) == null)

But for pendingorders ?

Thanks so so much for your time, Cheers,

A


@sim_trader
Replies

Spotware
09 Nov 2015, 18:13

Dear Trader,

Please have a look at the following code snippet. It loops through all pending orders and if a pending order has the label "NewLabel" it prints the word "Hello" to the log.

            foreach (var order in PendingOrders)
            {
                if (order.Label == "NewLabel")
                {

                    Print("Hello");
                }
            }

In addition, we recommend you to have a look at the API Reference and Guides section of cTDN.com


@Spotware