close StopOrder

Created at 17 Dec 2016, 22:03
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!
CO

collinganesh

Joined 14.10.2016

close StopOrder
17 Dec 2016, 22:03


Hello,

If a cBot places two Orders, a MarkeOrder and a StopOrder, what code can I use to close the StopOrder when the MarketOrder hits its TakeProfit = 10 pips?

Kind regards

if (_MA_cross_down && shortPosition == null)
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol, Symbol.NormalizeVolume(Volume), label, StopLoss, TakeProfit);

            }

            if (_MA_cross_down && shortPosition == null)
            {
                double targetPrice = Symbol.Ask + PipsAway * Symbol.PipSize;
                PlaceStopOrder(TradeType.Buy, Symbol, Volume2, targetPrice, label_2, StopLoss, TakeProfit);
            }

 


@collinganesh
Replies

... Deleted by UFO ...

collinganesh
17 Dec 2016, 22:44

Thank you


@collinganesh

collinganesh
17 Dec 2016, 23:40

Thanks Lucian. The code works perfectly.

Merry Christmas to you.


@collinganesh