Setting a trailing stop.

Created at 03 Dec 2018, 03:25
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!
WI

willd7781

Joined 18.09.2018

Setting a trailing stop.
03 Dec 2018, 03:25


Im sure this is a simple question but i havent managed to do it. 

Im trying to set a trailing stop to a possition when its opend. 

It is my understaning from examaning the API refrance explorer that to set it you using 

public bool HasTrailingStop{ get; }

ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10, 2, "comment", true);
Print("Position was opened, has Trailing Stop = {0}", result.Position.HasTrailingStop);

This doesnt build however. In effect I want the code to not use stop loss or take profit but instead use a trailing stop with a 10 pip spead. 

 

Any help would be much appricatied,

 

WILL 


@willd7781
Replies

PanagiotisCharalampous
03 Dec 2018, 11:23

Hi William,

Can you share with us the complete cBot code so that we can fix it? It the above code sample the definition of result is missing.

Best Regards,

Panagiotis


@PanagiotisCharalampous