Setting up and testing AW Recovery EA

What AW Recovery does

AW Recovery EA is a system for recovering unprofitable positions. When a position goes badly against you, the EA locks it, splits it into many separate parts, and closes each part separately using profit from averaging orders. Closing losses in parts lets you exit a deep drawdown with a much lower deposit load than holding the whole position and waiting.

The EA can recover positions opened by hand, by another EA, or by a combination of both — and it can pause or disable the other EA while it works, so nothing interferes with the recovery.

The AW Recovery main panel with six numbered areas: window buttons, main position, average orders, totals with Stop Recovery and Close All, possible closures with Reduce Volume, and the drawdown line
The main panel is the whole report. The position being recovered (2), the averaging orders working on it (3), the totals with Stop Recovery and Close All (4), and the parts the accumulated profit can pay for right now (5). The last line carries the drawdown and the EA's state.

One symbol at a time The EA works only on the pair it is attached to and stays in standby until there is a losing position on that symbol. To recover several instruments, attach it to each chart separately — and make sure the account has enough free margin for the recovery orders.

How the recovery works

Three mechanisms run together:

  1. Locking

    The EA aligns buy and sell volumes so the loss stops growing. From this moment the drawdown is frozen, whatever the market does.

  2. Averaging orders

    A grid of averaging orders opens by the rules you set — volume, step, multipliers and an optional trend filter. Their profit is the fuel for the recovery.

  3. Partial closing

    As soon as accumulated profit covers a part of the losing position, the EA closes that part — starting with the orders you told it to prioritize. Step by step, the position shrinks to zero.

The part being processed right now — a slice of the losing position plus its averaging orders — is called the current group. You can watch it and close it manually from the current-group panel.

Testing in the strategy tester

Test the EA before running it on a live account. Use Visualization mode — the on-chart panel is fully functional in the tester, so you can simulate a real drawdown and watch the whole recovery.

  1. Open the strategy tester

    Select AW Recovery EA, pick a symbol, and enable Visualization.

  2. Enter the deposit

    Use the amount you actually plan to dedicate to the recovery — the test is only meaningful with a realistic deposit.

  3. Choose the launch mode

    Instant start, or start at a drawdown threshold in percent or in money — the same setting you will use live.

  4. Simulate the drawdown

    Open orders from the EA panel until you reach the volume and drawdown you want to test. Then let the EA take over and watch it unwind the position.

The MetaTrader 4 strategy tester bar with AW Recovery EA selected, symbol EURJPY M30, and the Visual mode checkbox highlighted
Step 1. Pick the EA and the symbol, then tick Visual mode — without it you cannot press the panel buttons during the run.
The tester's Testing tab with the Initial deposit field highlighted, set to 1000 USD
Step 2. Set the initial deposit to the amount you actually plan to dedicate to the recovery. A test on a deposit you will never have tells you nothing.
Two panels: the main panel with the Stop Recovery button highlighted, an arrow down, and the order opening bar highlighted below
Step 4. Press Stop Recovery first, then open as many orders as the drawdown you want to test needs. Let the EA take over and watch it unwind them.

Pause anytime The panel works during the test: you can stop the recovery, resume it, or close the current group manually — exactly as on a live chart.

Exit from standby mode

When the launch condition is met, the EA performs a one-time sequence of actions before starting the recovery. Each action is optional and controlled by an input:

Action at launchInput
Disable other EAs — on this symbol or on all symbols Disable other EAs at Launch
Delete manually set StopLoss and TakeProfit levels Delete SL and TP
Delete pending orders on the symbol Delete Pending Orders at Launch
Close profitable orders and use the profit against the loss Close profit at Launch

All of this happens once, at initialization — not continuously during the recovery.

The EA's Inputs tab with Delete SL and TP, Close profit at Launch and Delete Pending Orders at Launch underlined
The three one-time actions, each its own input. Set them before the launch — after it they are not read again.

Automatic locking

Locking (Use locking) is what freezes the drawdown. Whether to keep it automatic depends on how you run the EA:

  • Enable it when the EA works standalone and you don't plan to interfere — especially on a VPS, where nobody is watching and a second algorithm could add volume the EA doesn't expect.
  • Disable it when you add orders manually during the recovery, or run a parallel algorithm on the same symbol — the EA would otherwise immediately lock every new order it sees.
The EA's Inputs tab with the Use locking input highlighted and its On / Off list open
One input decides it: Use locking.
The EA's Common tab with the Allow live trading checkbox unticked and highlighted
To lock a position by hand instead, untick Allow live trading before you open the balancing order — the EA keeps its panel and its figures, but sends nothing to the broker while you work.

Running alongside other EAs

Compatibility comes down to one rule:

Compatible — when automatic locking is disabled, or the other EA uses different MagicNumbers. Incompatible — when automatic locking is enabled and both trade the same orders.

The EA's Inputs tab with Disable other EAs at Launch highlighted and its list open: disable on all symbols, disable on the same symbol, do not disable
Three answers to «what happens to the other EA»: disable it everywhere, disable it on this symbol only, or leave it alone.

Then choose how the recovery starts:

Launch typeWhen it fits
Instant start There is already a losing position and you want the recovery now.
Start at drawdown in percent The EA arms itself and waits until floating drawdown reaches the set percentage of the deposit.
Start at drawdown in money Same, but the threshold is set in the deposit currency.

Tuning recommendations

Four numbers define the character of the recovery. The manual's formulas give a sane starting point; refine them in the tester.

Part to close

Mentally divide the losing order into 6–8 parts — that is the slice the EA will try to close each time:

Part to close ≈ volume of the farthest order ÷ 6…8

Volume of the averaging order

Keep averaging volume in a 1 : 1.5 ratio to the closing part:

Volume of average order ≈ Part to close × 1.5

TakeProfit for partial close

Do not set it below three spreads — the group must at least clear costs:

TP for partial close ≥ current spread × 3

Step between averaging orders

Derive the step from real volatility — ATR(14) on the daily chart — instead of guessing points:

Risk profileStepCharacter
HighATR ÷ 4Dense grid, faster recovery, higher load
MediumATR ÷ 3The balanced default
LowATR ÷ 2Sparse grid, slow and conservative
EURUSD daily chart with the ATR(14) indicator in a subwindow, the data window showing ATR 0.00736
Where the number comes from. ATR(14) on EURUSD daily reads 0.00736 here — that is 736 points, so a medium step is about 245.
XAUUSD daily chart with the ATR(14) indicator in a subwindow, the data window showing ATR 12.3529
The same rule on gold. ATR(14) reads 12.3529, and the point size differs — read the step off the instrument you trade, never off a number someone gave you for another one.

Multiplier to step then stretches the grid progressively, so far orders sit farther apart than near ones.

Trend filters

Averaging orders can open blindly at intervals, or only when a filter agrees. Three modes are built in (Trend filtering for average orders):

The EA's Inputs tab with Trend filtering for average orders highlighted and its list open: Simple Grids, Bulls Bears Candles Filtering, AW Trend Predictor Filtering
The three modes sit in one input, next to the grid's volume, step and multipliers.
ModeHow it opens averaging orders
BullsBears Candles On reversal candle patterns detected by the built-in indicator.
AW Trend Predictor On signals of the built-in AW Trend Predictor, with its own timeframe and sensitivity.
Simple grids No filtering — strictly at the set step, like a classic grid.

Trend Predictor mode settings

  • Timeframe — set it larger than the working chart; the filter should see the bigger picture.
  • Amplitude — higher values mean fewer, stronger signals.
  • First trade — by trend direction, or at trend reverse.
  • Averaging — in any direction, or only in the direction of the trend.

Current group & commissions

The current group is the slice of the losing position the EA is working on right now, together with its averaging orders. The group's TakeProfit calculation accounts for swaps and commissions — so the close is profitable in fact, not only on the screen.

On ECN accounts, where commission is charged separately, enable Use full commission when calculating so partial closes account for the full round-turn commission.

The current group panel with three numbered areas: the parts of the losing position being closed, their averaging orders, and the group total with the Close Current Group button
The current group panel. The parts of the losing position being worked on right now with their tickets (1), the averaging orders feeding them (2), and the group's own total with the button that closes it by hand (3).
Animation: the EA closes one group of orders after another, and the losing position shrinks step by step
Group after group. Each pass closes one slice and the position gets smaller — this is the recovery seen from the outside.

Notifications

The EA reports two events: recovery started (the EA left standby) and recovery completed.

ChannelSetup
AlertPopup in the terminal — works out of the box.
EmailTerminal → ToolsOptionsEmail.
PushMetaQuotes ID in ToolsOptionsNotifications.

Identifiers and MagicNumbers

The EA distinguishes two groups of orders: the orders being recovered, and its own averaging orders (MagicNumber of average orders). Which orders get recovered is set by MagicNumbers group for recovery:

ModeWhat gets recovered
All orders on same symbol Everything on the chart's symbol, whoever opened it.
Manual + listed MagicNumbers Orders with the listed MagicNumbers, plus manual orders (magic = 0).
Same MagicNumbers only Only orders whose MagicNumber is in the list.

The queue is controlled by What orders to start from — begin with the easy-to-close orders or with the hard ones — and First ticket for recovery overrides the queue for one specific order.


Continue with this series

Was this page helpful? Yes Could be better