The Reverse Script is a handy script that reverses open positions in the current trade account.
The purpose of this script is to reverse existing open positions quickly, reliably and accurately in an automated mechanism. There are circumstances when a trader feels that the market conditions have reversed and he needs to reverse his open positions. The trader is able to accomplish this with a single click using the Reverse script.
The script iterates through each open position (either a BUY or a SELL trade), and then closes it at the market price. After the original position has been closed, it opens a new trade with the same lot-size in the opposite direction. So, a BUY position is closed and an opposite SELL position with an identical lot-size is opened. Likewise, a SELL position is closed and an opposite BUY position with an identical lot-size is opened. If CurSymbolOnly is set to TRUE, then the script reverses positions only for the current chart symbol leaving open positions of other symbols untouched. However, if CurSymbolOnly is set to FALSE, then the script reverses open positions of all symbols.
If StopLoss and TakeProfitparameters are configured then the script sets the stop-loss and the profit-target of the reversed positions accordingly.
The Marketwatch parameter is used to configure the script for STP/ECN brokers, whereby the broker expects the stop-loss and the profit-target to be set only after the position is opened. When set to TRUE, the Reverse script first opens the reverse position and then updates the stop-loss and take-profit thereby fulfilling the criteria of STP/ECN brokers.
The Reverse script does not act upon pending orders, namely BUY-LIMT, BUY-STOP, SELL-LIMIT and SELL-STOP orders. It acts only on open positions, thus leaving the pending orders untouched.
- StopLoss – The stop-loss of each individual trade in pips.
- TakeProfit – The profit target of each individual trade in pips.
- CurSymbolOnly– Specifies whether the script is applicable to open positions of all symbols, or only for the current chart symbol.
- MarketWatch– Specifies whether the stop-loss and take-profit (if configured) are sent to the broker immediately, or only after the reverse position is opened. If set to TRUE, then the stop-loss and take-profit are set only after the reverse trade is opened. If set to FALSE, then the stop-loss and take-profit are sent to the broker along with the reverse order request.