Issue with automatically place order after stop loss or taking profit

 
I'm developing trading program in MT5, when I tested the strategy, whatever strategy I developed, it always execute an other order after taking profit or stop loss. Anyone know why and how to stop it, thanks very much for your help!
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
MQL5 forum: Expert Advisors and Automated Trading
MQL5 forum: Expert Advisors and Automated Trading
  • www.mql5.com
How to create an Expert Advisor (a trading robot) for Forex trading
 
nguyenhungmanh: I'm developing trading program in MT5, when I tested the strategy, whatever strategy I developed, it always execute an other order after taking profit or stop loss. Anyone know why and how to stop it, thanks very much for your help!

It is not "another" order and you can't prevent it. It is the order for the "out" deals to close the position. The same also happens on a live trading.

The orders for the "in" deals open the positions and the orders for the "out" deals close the positions.

MT5 works differently than MT4. Read the following ...

Articles

Orders, Positions and Deals in MetaTrader 5

MetaQuotes, 2011.02.01 16:13

Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
 
Fernando Carreiro #:

It is not "another" order and you can't prevent it. It is the order for the "out" deals to close the position. The same also happens on a live trading.

The orders for the "in" deals open the positions and the orders for the "out" deals close the positions.

MT5 works differently than MT4. Read the following ...

Thanks very much for explanation, I was so confused and didn't know what went wrong :-), now I understand