Closing Pending Orders

 
 

It looks to me like you have statements for closing orders IMMEDIATELY after the statements for modifying them, which would cause what you are getting. By the way, why are you trying to modify a stop AND THEN delete the order? Makes no sense to me. While we're thinking along these lines, I just made an EA that can modify stops and close orders. You can check it out below. Maybe it will help you, maybe it won't. At the very least, you can check the code as a programming example:

https://www.mql5.com/en/forum/176995

Reason: