can you count only buy positions or short that are opened?

Created at 04 Nov 2020, 17:59
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!
PI

pistrituadrian16

Joined 01.11.2020

can you count only buy positions or short that are opened?
04 Nov 2020, 17:59


can you count only buy positions or short that are opened?

 

public int Count{ get; }
int totalPositions = Positions.Count;

 

How can I use this to only count all long open positions or all short open positions, a little example would be awesome.


@pistrituadrian16
Replies

PanagiotisCharalampous
05 Nov 2020, 07:54

Hi pistrituadrian16,

Here is an example

Positions.Count(x => x.TradeType == TradeType.Buy)

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous