The code I used finds the previous stop loss value in pips by subtracting the open price of that order with the stop loss value in price and stores it in previousstop.
Then I get the stop loss value in price (stored in stop) by adding the previous stop value in pips to the open price of the new order.
No you don't, the open price of the new order is Bid not OrderOpenPrice()
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The code I used finds the previous stop loss value in pips by subtracting the open price of that order with the stop loss value in price and stores it in previousstop.
Then I get the stop loss value in price (stored in stop) by adding the previous stop value in pips to the open price of the new order.
Thanks, thats what was missing! Managed to setup the same for tp with: previoustakeprofit = (OrderOpenPrice()-OrderTakeProfit());
Thanks for your help.