Get TargetPrice Value from a pending order

Created at 10 Jun 2019, 23:27
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!
MA

martin100181@gmail.com

Joined 10.06.2019

Get TargetPrice Value from a pending order
10 Jun 2019, 23:27


Hi, I need to get the Target price from a labeled pending order so I can use it.

I.e: 

For a position labeled "Long_1" I would get entry price liske this:

 Entry_Value = Positions.Find("Long_1").EntryPrice;

But how do I get the same from a Pending order called "Long_1" ?

 

Thank you.

 


@martin100181@gmail.com
Replies

martin100181@gmail.com
10 Jun 2019, 23:48

More: 

 

In fact I need the following:

1. I create a pending order with a defined target price and a label. Lets say "Long_1". 

2. Sometime after that, it is possible that the bot stoped or whatever, so on the start I need the bot to check if Long_1 exists as a Pending order or if it was executed and its now a position and get the entry pice value (or target price if it´s still a pending order).

3. As a result I need to have that price stores in a variable.

 

I hope I could explain myself.


Thank you!


@martin100181@gmail.com

PanagiotisCharalampous
11 Jun 2019, 09:49

Hi martin100181@gmail.com,

Thanks for posting in our forum. See below

var targetPrice = PendingOrders.First(x => x.Label == "Long_1").TargetPrice;

Best Regards,

Panagiotis


@PanagiotisCharalampous