Trailing Profit Take

Created at 05 May 2015, 10: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!
GS

GS66

Joined 12.04.2015

Trailing Profit Take
05 May 2015, 10:15


Hi,

I have seen code for trailing stop loss, and although I'm not an expert I want to code also trailing profit take.

 What about this? Any Suggestions?

   if(position.TradeType == TradeType.Buy)
            {
                double distance = position.EntryPrice - Symbol.Bid;

                if (distance >= Trigger * Symbol.PipSize)
                {
                    double newProfitTakePrice = Symbol.Bid + TrailingProfit * Symbol.PipSize;
                    if (position.ProfitTake == null || newProfitTakePrice > position.ProfitTake)
                    {
                        Trade.ModifyPosition(position, newProfitTakePrice, position.TakeProfit);
                    }
                }
                
            }

Thanks


@GS66
Replies

Spotware
18 Jun 2015, 12:54

Dear Trader,

We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.

 


@Spotware