This is an Expert Advisor designed to automatically average out trading positions opened manually or by another EA.
Order Selector Section:
These settings select the orders that will be averaged by the EA. With the default settings, the EA will average all orders for this currency pair.
- BuySell (Buy/Sell/All): Buy – select only Buy orders; Sell – select only Sell orders; All – select Buy and Sell orders.
- Ticket: Select only order with this ticket. If 0, not active.
- Magic: Select only orders with this magic number. If 0, not active.
- GridStepPips: grid step (in 4-digit pips).
- TakeProfitType (FixedTakeProfit/DistanceFromBE): select how the take-profit is calculated. FixedTakeProfit – take-profit is calculated from the last order (order with the best price); DistanceFromBE – take-profit is calculated from the breakeven level.
- TakeProfitPips: take-profit value (in 4-digit pips).
- LotMult: lot multiplication factor.
- MaxGridLevel: maximal number of grid orders.
- SetTPAtOnce (TRUE/FALSE): If TRUE, EA will set the common take-profit to all orders at once; if FALSE, EA will set the common take-profit when the first pending order is triggered.
These settings activate the Lock feature of the EA: if the maximal number of grid levels is opened and the price moves another LockDistPips pt against the basket, EA opens the locking order that makes the whole position neutral and removes all take-profits. After that, EA does nothing.
- UseLock (TRUE/FALSE): Enable the lock feature.
- LockDistPips: locking distance (in 4-digit pips).
This feature closes all open orders if the maximal drawdown is reached.
- MaxDD: Maximal open drawdown allowed, in units of the base currency. If the open drawdown of the open orders exceeds MaxDD, all market orders are closed immediately, all pending orders are deleted, and trading is stopped. If MaxDD is set to 0, this option is disabled.
- MaxDDPerCent: The same as MaxDD, but in percents of the account balance. E.g., if MaxDDPerCent =30, the trading will be stopped when the drawdown exceeds 30% of your account balance. If MaxDDPerCent is set to 0, this option is disabled.
- MagicEA: magic number of averaging orders.
- MagicLock: magic number of the locking order.
- comment_color: color of the text in the information box.
- box_color: background color of the information box.
- colBE: color of the breakeven line.
1. A bug of non-deleting the lock pending orders is fixed.
2. When both long and short orders are present, the EA now asks to specify the direction of averaging (BuySell = Buy or Sell).