MAx Trade Set Expert Advisor Description

MAx Trade Set Expert Advisor is a script that reverses existing open positions. It is typically employed in a stop-and-reverse scenario where the trade wants to reverse the positions in an automated way.

Stop-and-Reverse mechanisms are very useful in volatile market conditions and during news events. They provide the trader with a one-click solution to reverse the portfolio positions with minimum slippage and spreads. For example, if a trade is short on a specific instrument, and a news event is received which implies a bullish outlook, the trade can reverse his positions by launching this script.

When the Expert Advisor starts, it scans for all open positions. If CUR_SYMBOL_ONLY is set to TRUE, only those positions of the current symbol are evaluated. However, if CUR_SYMBOL_ONLY is set to FALSE, then positions of all symbols are evaluated. Each open trade is then reversed if the spread is within the specified SLIPPAGE value range. If the spread for the symbol is not within the specified SLIPPAGE range, then Expert Advisor proceeds to the next open position.

The script then closes the open position and then proceeds to open a reverse position in the opposite direction – e.g. BUY is reversed to SELL and vice-versa. The stop-loss and take-profit settings are derived from the STOP_LOSS and TAKE_PROFIT user settings respectively.

To distinguish between ECN and non-ECN (STP) brokers, the script provides the MARKETWATCH feature to avoid the orders with stop-loss and take-profits from being rejected. ECN brokers allow setting the stop-loss and take-profit values only after the order is submitted to the broker. If an order with a stop-loss and take-profit is submitted, it is rejected and therefore the reversal can fail.

The script also has advanced error handling mechanism to handle failure when reversing trades. When an error occurs during reversing a trade, it is tracked and queued. If the error is recoverable, then the Expert Advisor tries to reverse again on the next tick.

Configurable Inputs for MAx Trade Set Expert Advisor

  1. STOP_LOSS – The stop-loss of each trade in pips.
  2. TAKE_PROFIT – The take-profit of each trade in pips`.
  3. CUR_SYMBOL_ONLY– Specifies whether the script should reverse the open positions for current symbol, or for all symbols.
  4. MARKETWATCH – Specifies whether to use the ECN mode or market mode for placing stop-loss and take-profit. If this parameter is set to TRUE, then the stop-loss and take-profit are not sent to the broker when the initial order is placed. The stop-loss and take-profit are updated only after the initial order is opened. If this parameter is FALSE, then the stop-loss and take-profit are sent to the broker along with the initial order.
  5. SLIPPAGE – The maximum allowed slippage in pips.
  6. NUMBER_OF_TRY – The number of tries the Expert Advisor will check for the entry condition if the current spread is greater than the value of SLIPPAGE.