Help - How can u code a fixed SL and variable TP using OrderModify()

 

I am testing various aspects of my EA. What I would like to achieve is:

1. Set a fixed Stop Loss without setting a Take Profit level when I open a trade position, i.e:

Result=OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,stoploss,0,"",MAGICNUMBER,0,Red);

This part works well in my code.

2. For the open position, I would like the Stop Loss to remain constant (i.e. same value as when order was opened),

but vary takeprofit (i.e. have a trailing takeprofit or so to speak). I have tried using OrderModify() for this:

OrderModify(OrderTicket(),OrderOpenPrice(),NULL,takeprofit,0,Red);

Although it allows me to modify the takeprofit as I wish, IT ALSO MODIFIES THE ORIGINAL SL THAT I WANT TO KEEP.

Can anyoune help me resolve this issue?

Thanx in advance.

 

OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),takeprofit,0,Red);

 
Roger wrote >>

OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),takeprofit,0,Red);

Thank you Roger. You have solved my problem and it works!