Get the EntryPrice of a PlaceStopLimitOrder

Created at 02 Oct 2024, 08: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!
SE

sebastien.t

Joined 12.03.2024

Get the EntryPrice of a PlaceStopLimitOrder
02 Oct 2024, 08:13


Hello,

 

I would like to access of the EntryPrice of my Stop Limit Order. the issue is that the order is not yet triggered and sp it is a Pending Order but the PendingOrder doesn't get. the property EntryPrice. The two line below don't work

PositionSlOrderSell.PendingOrder.EntryPrice

PositionSlOrderSell.Position.EntryPrice

 

Any idea?

 

TradeResult PositionSlOrderSell = PlaceStopLimitOrder(TradeType.Sell, SymbolName, VolumeUnits, StopEntryShort-Symbol.PipSize,stopLimitRangePipsShort, LabelShort, stopLossShort, takeProfitShort);

Print("after Position");

if (PositionSlOrderSell.IsSuccessful)

Print(PositionSlOrderSell.ToString());

Print("Buy at {0}", PositionSlOrderSell.PendingOrder.EntryPrice);

Print("Order placed. SL: {0}", PositionSlOrderSell.PendingOrder.StopLoss);

 

Thank you


@sebastien.t
Replies

VIZAINT
02 Oct 2024, 08:26

The way I know to get Entry Price is when the position is executed and this is the way I use:

 ExecuteMarketOrderAsync(TradeType.Buy, SymbolName, _volumeInUnits, Label, OnCompletedBuy);

and metod OnCompletedBuy:
 private void OnCompletedBuy(TradeResult result)
        {
            if (!result.IsSuccessful)
                Print("Error: ", result.Error);
            result.Position.ModifyStopLossPips(10);
            result.Position.ModifyTakeProfitPips(100);
            EntryPrice = result.Position.EntryPrice;

        }


@VIZAINT

sebastien.t
02 Oct 2024, 08:31 ( Updated at: 02 Oct 2024, 09:23 )

RE: Get the EntryPrice of a PlaceStopLimitOrder

Thank you for you answer. I want to get it from the Position itself when it is successful. I want to store it in Local storage before the execution to be able to monitor the slippage.

When the Position is executed it is too late…

 

Do you have any idea?

 

 


@sebastien.t

VIZAINT
02 Oct 2024, 09:49

It is impossible to know the entry price before it is executed, unless you indicate this price before it has to be executed,


@VIZAINT

PanagiotisCharalampous
02 Oct 2024, 10:43

Hi there,

The correct property is PendingOrder.TargetPrice.

Best regards,

Panagiotis


@PanagiotisCharalampous

sebastien.t
02 Oct 2024, 12:24

RE: Get the EntryPrice of a PlaceStopLimitOrder

Amazing, thank you!!!

 

PanagiotisCharalampous said: 

Hi there,

The correct property is PendingOrder.TargetPrice.

Best regards,

Panagiotis

 


@sebastien.t