Hello
I need to Open a new Opposite order immediately after stop loss hit
if i have a buy order and the Stop loss hit immediately open a sell order with a stop loss at the open price of the previous order and a take profit target 2 times the SL
and if i have a sell order and the stop loss hit immediately open a buy order with a stop loss at the open price of the previous order and a take profit target 2 times the SL
here is my code
I searched in the forum and tried to use the code in this post https://www.mql5.com/en/forum/155948#comment_3801295
but it didn't work even if i didn't use the last open order price as a stop loss and used a normal distance of pips stop loss
It would be better to open an opposite stop-order at your stop loss so you wouldn't have to worry about network latency causing more slippage
but then i have to deal with the expiration of the order, i prefer market orders
but then i have to deal with the expiration of the order, i prefer market orders
What do you mean?
if the first position reached TP target then how i am gonna close the pending order at the SL ?
It would be better to open an opposite stop-order at your stop loss so you wouldn't have to worry about network latency causing more slippage
You don't close pending order anywhere. They are pending, you delete them.
This fails on US brokers because of no hedging. The open price must be far enough that the original SL has triggered.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I need to Open a new Opposite order immediately after stop loss hit
if i have a buy order and the Stop loss hit immediately open a sell order with a stop loss at the open price of the previous order and a take profit target 2 times the SL
and if i have a sell order and the stop loss hit immediately open a buy order with a stop loss at the open price of the previous order and a take profit target 2 times the SL
here is my code
I searched in the forum and tried to use the code in this post https://www.mql5.com/en/forum/155948#comment_3801295
but it didn't work even if i didn't use the last open order price as a stop loss and used a normal distance of pips stop loss