SL and TP

Created at 01 Apr 2021, 15:21
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!
EY

eynt

Joined 08.05.2020

SL and TP
01 Apr 2021, 15:21


1. Can I use ModifyStopLossPrice / ModifyTakeProfitPrice even if there was not SL/TP on the initial ExecuteMarketOrder method?

2. When I use ModifyStopLossPrice / ModifyTakeProfitPrice how do I know when the SL/TP is executed?

3. In case either the SL/TP is executed, does it means that the other one is automatically canceled?

 

Thanks


@eynt
Replies

PanagiotisCharalampous
02 Apr 2021, 08:44

Hi yuval.ein,

  1. Yes
  2. Check Positions.Modified event
  3. Yes

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

eynt
02 Apr 2021, 13:00

RE:

I am not sure how to implement the Positions.Modified event in the context I was talking about.

the PositionModifiedEventArgs object only gives a Position object which does not give (to my understanding a state if the order was filled, cancelled, etc.

Perhaps you can give a small code example of how to know when a stop loss was filled after entering a position using ExecuteMarketOrder and placing its stop loss using ModifyStopLossPrice.

 

Thank you


@eynt

PanagiotisCharalampous
02 Apr 2021, 14:15

Hi yuval.ein,

Sorry I misread the question. To check when a SL/TP was executed, you can subscribe to the Position.Closed event and check the PositionCloseReason of the PositionClosedEventArgs.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

eynt
06 Apr 2021, 15:42

RE:

When I use ModifyStopLossPrice I don't see an order at the "Orders" tab nor at the PendingOrders property.

 

1. Is the SL placed internally on cTrader or at the broker?

2. Where can I see the SL order by code?

3. What happens if the cTrader app is restated, is the SL is kept or canceled?

 

Thanks


@eynt

PanagiotisCharalampous
06 Apr 2021, 15:47

Hi yuval.ein,

SL and TP are kept on the server and they are associated to the position.  Hence you can find it in your Position object. They will not appear on the Orders tab neither they are affected by application restart. 

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

eynt
06 Apr 2021, 15:52

RE:

PanagiotisCharalampous said:

SL and TP are kept on the server and they are associated to the position.

 

On the server you mean at the broker's server?

 


@eynt

PanagiotisCharalampous
06 Apr 2021, 16:10

Hi yuval.ein,

Yes, cTrader server.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous