Reopening the Opposite Position After a Trade Closes
Summary
This MetaTrader expert-advisor example describes an automatic reversal rule. When a position closes, the program detects the closing deal and opens a new position in the opposite direction on the same symbol, using the same volume. For instance, closing a long AUDUSD position triggers a short AUDUSD position of equal size.
The implementation relies on the platform’s trade-transaction event handler. It filters for newly added deals in account history, checks that the deal is an exit, retrieves its type, volume, and symbol, then submits the corresponding new order. The article provides illustrative code and explains the event flow, but gives no backtest or live-trading evidence. It also does not discuss safeguards such as distinguishing partial closures, filtering which positions should trigger reversals, or handling order rejection, so the behavior should be understood as a simple automation example rather than a complete trading system.
Key ideas
- The expert advisor reacts to a position-closing deal and submits a new trade in the opposite direction.\nThe replacement order uses the closed deal’s symbol and volume.\nThe logic is triggered from a trade-transaction event and checks for an exit entry.\nThe example does not describe performance evidence or safeguards for partial closes and rejected orders.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.