Move stop loss to last take profit
-
Hi All. I am busy with an EA designed to open two positions. Each position will have an initial stop loss of 20 pips. Then if first target is at 10 pips the first trade will be closed and the second's stop loss moved to a loss of 10 pips. This part is working fine. Where I am stuck is I need a condition that if the new stop loss is greater then 10 pips (the first target) then the second trade should be auto closed (this happens sometimes due spread spikes). The numbers used above are just examples they are variable depending on the trade. I have tried the below but it does not work for some reason?

Any suggestions are welcome.
-
Apologies one more thing, the reason I use the formula is because these blocks trigger when the first trade closes, so the open range should be equal to the profit of the first trade
-
After modifying the stop loss of the second trade, calculate the distance between the new stop loss and the entry price. If that distance is less than or equal to -10 pips (i.e., SL is more than 10 pips away in loss), close the second trade.
You can use "For Each Trade" block with Skip every "n" trade = 1 — this will select the second trade.
Then, use "Pips away from Stop Loss" or "Pips away from Open Price" to calculate how far the stop loss is from the entry.
If the pips from SL > first target (e.g., 10 pips), use a "Close Trade" block to close the second trade automatically.