ModifyPosition

Created at 02 Jun 2015, 13:42
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!
GS

GS66

Joined 12.04.2015

ModifyPosition
02 Jun 2015, 13:42


 protected override void OnPositionOpened(Position openedPosition)
        {
            position = openedPosition;
           
            if (position.TradeType == TradeType.Buy)
            {
                double? stopLoss = position.EntryPrice - StopLoss * Symbol.PipSize;
                double? takeProfit = position.EntryPrice + TakeProfit * Symbol.PipSize;
                ModifyPosition(position, stopLoss, takeProfit);
            }

            if (position.TradeType == TradeType.Sell)
            {
                double? stopLoss = position.EntryPrice + StopLoss * Symbol.PipSize;
                double? takeProfit = position.EntryPrice - TakeProfit * Symbol.PipSize;
                ModifyPosition(position, stopLoss, takeProfit);
            }

Basically on Stop orders the SL and TP are calculated based on the original submitted price. Now since the slippage may be absurd even 30-50 pips, I've inserted this code in order to modify SL and TP on Stop Orders. 

Sometimes it doesn't work and SL and TP are not modified. is there and error or what?


@GS66
Replies

Spotware
10 Jun 2015, 14:58

Dear Trader,

Could you please send us the corresponding journal records for cases when protection was not applied?

The journal tab contains detailed information about trading operations.


@Spotware