Single position

Created at 08 Oct 2018, 12:16
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

Single position
08 Oct 2018, 12:16


Dear Panagiotis! Hi!

Let's suppose I know I only have one position opened. What would be the easiest way to address it?
 

Regards, 

Sahsa


@alexander.n.fedorov
Replies

PanagiotisCharalampous
08 Oct 2018, 12:20

Hi Sasha,

It is not clear to me what is the problem you would like to address. Can you please explain?

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
08 Oct 2018, 12:22

if (Positions.FindAll (Instance).Count()=1)

{

       ClosePositions(?)

}


@alexander.n.fedorov

alexander.n.fedorov
08 Oct 2018, 12:23

if (Positions.FindAll (Instance).Count()==1)

{

       ClosePositions(?)

}


@alexander.n.fedorov

PanagiotisCharalampous
08 Oct 2018, 12:27

If you want to close that one position then try the following

ClosePosition(Positions.First(x => x.Label == Instance));

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
08 Oct 2018, 12:28

Thank you


@alexander.n.fedorov