Count Pending Order by Label an Direction

Created at 24 Apr 2019, 00:13
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!
DelFonseca's avatar

DelFonseca

Joined 25.06.2017

Count Pending Order by Label an Direction
24 Apr 2019, 00:13


Hi,

Im trying count pending orders by label and direction but i cant. Example for Stop order with Long direction

 

            _LongPendingPositionsCount = PendingOrders.Where(posPendingLongCount => posPendingLongCount.Label == LabelBuy).Where(posPendingLongCount => posPendingLongCount.OrderType == PendingOrderType.Stop && posPendingLongCount.TradeType == TradeType.Buy).Count();

Please Help me. 

Thank you


@DelFonseca
Replies

PanagiotisCharalampous
24 Apr 2019, 10:16

Hi DelTrader,

Can you please explain to us what is the problem?

Best Regards,

Panagiotis


@PanagiotisCharalampous

DelFonseca
24 Apr 2019, 20:17

Hi Panagiotis,

Im trying to count how many buy stop pending orders i have. 
I have 6 pending orders, with order type "Buy Stop"and the code below returns 1, not 6. 

_LongPendingOrdersCount = PendingOrders.Where(posPendingLongCount => posPendingLongCount.Label == LabelBuy).Where(posPendingLongCount => posPendingLongCount.OrderType == PendingOrderType.Stop && posPendingLongCount.TradeType == TradeType.Buy).Count();

Can you help me please ?
Thank you so much


@DelFonseca

PanagiotisCharalampous
25 Apr 2019, 09:34

Hi DelTrader,

I do not see anything wrong in this code. Can you share the complete cBot code? Make sure you are setting the labels correctly.

Best Regards,

Panagiotis


@PanagiotisCharalampous