How do I search for pending orders by symbol or lable?

Created at 06 Dec 2021, 20:37
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!
sirinath's avatar

sirinath

Joined 25.11.2021

How do I search for pending orders by symbol or lable?
06 Dec 2021, 20:37


How do you get pending orders by symbol or lable?


@sirinath
Replies

amusleh
07 Dec 2021, 09:19

Hi,

All pending orders are in PendingOrders collection, and you can use Linq queries to filter, sort, or group them, here is an example of filtering orders based on label:

var myLabel = "MyLabel";
var pendingOrdersWithMyLabel = PendingOrders.Where(order => order.Label.Equals(myLabel, System.StringComparison.OrdinalIgnoreCase));

To use Linq you have to add the "using System.Linq" on top of your indicator or cBot, for more about Linq check here: Language-Integrated Query (LINQ) (C#) | Microsoft Docs


@amusleh