Take profit

Created at 29 Apr 2024, 21:16
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!
EM

emmasystems

Joined 08.12.2015

Take profit
29 Apr 2024, 21:16


Please help ,
where TP1 is moved to TP2: , using pendingorder execution. new takeprofit is not working. 
 result = TP1> TP2.
protected override void OnTick()
        {
            var longPosition = Positions.Find("_TP plus", SymbolName, TradeType.Buy);

            if (longPosition == null) && (TP1 > TP2)
            {
                PendingLimitOrder(TradeType.Buy, SymbolName, 100000, "TP plus", StopLoss, TakeProfit);
            }
            else
            {
                if (longPosition.Pips >= Symbol.PipSize * 50)&& (TP1 > TP2)
                    ModifyPosition(longPosition, 30, TakeProfit);
                  if (longPosition.Pips >= 50)

					ModifyPosition(longPosition, longPosition.EntryPrice + Symbol.PipSize * 30, longPosition.TakeProfit);

		            Print(result); 
		            Thank you

@emmasystems
Replies

PanagiotisCharalampous
30 Apr 2024, 05:34

Hi there,

Please provide a full cBot code that builds and then explain to us how we can reproduce your issue in backtesting.

Best regards,

Panagiotis


@PanagiotisCharalampous