Modifying a Pending order, looses the SL and TP

Created at 20 Jul 2016, 03:15
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!
AN

Anka Software

Joined 06.11.2014

Modifying a Pending order, looses the SL and TP
20 Jul 2016, 03:15


Hi,

   If you run the code sample from your trading API page, the pending order looses its SL and TP.

 

public class Sample_cBot : Robot
{
    protected override void OnStart()
    {
        var price = Symbol.Ask + 10 * Symbol.PipSize;
        DateTime? expiry = Server.Time.AddHours(12);
        PlaceStopOrder(TradeType.Buy, Symbol, 10000, price, "myLabel", 10, 10, expiry);
    }
 
    protected override void OnBar()
    {
        foreach (var order in PendingOrders)
        {
            if (order.Label == "myLabel")
            {
                double newPrice = Symbol.Ask + 5 * Symbol.PipSize;
                ModifyPendingOrder(order, newPrice, order.StopLossPips, 
                                                            order.TakeProfitPips, order.ExpirationTime);
            }
        }
    }
}

 

Please advice.

 

Regards

 

Vivek


@Anka Software