1. What it is
ATT Zone Recovery EA manages a trade from its opening to its closing with the zone recovery method. The first trade is opened manually, by another expert advisor, with a button on the panel or by the EA itself on a strategy signal. While the price moves in the trade's favour, the stop is moved to break-even and trailed behind the price. If the price turns against the trade, a counter pending order fires at the edge of the zone, and from there the levels alternate until the price leaves the zone and reaches the target. The volume of every level is calculated from the loss already locked in, the accumulated commissions and swaps and the cycle target, so the basket closes at the set profit on either side.
The EA's main property: the maximum loss of the cycle, in money and as a percentage of the balance, is on the panel before the first trade is opened and is recalculated after every change of the inputs. Everything the EA is going to do is visible in advance: the trigger price and the volume of every level, the basket break-even point, the target.
The EA works on hedging and netting accounts, runs one cycle per chart and keeps its state across terminal restarts. The interface, the input names and the notifications are in English.
Fig. 1. The panel during recovery: the bands from top to bottom.

2. Installation
The EA is distributed through the MQL5 Market and is installed from the terminal; no files are copied by hand.
- The product is listed on the Market tab of the terminal's Toolbox window, or on its product page at mql5.com. Buying, renting and downloading the demo require a signed-in MQL5.community account: Tools → Options → Community.
- After the purchase the terminal downloads and installs the product itself. It appears in the Navigator under Expert Advisors → Market.
- The EA is dragged from the Navigator onto a chart, and algo trading is allowed in the dialog. The Algo Trading button on the terminal's toolbar has to be on.
Updates arrive in the same place, in the list of purchased products on the Market tab. The number of activations is stated on the product page. The free demo from the Market, like every Market demo, runs in the Strategy Tester only.
After the first start the panel sits at the left edge of the chart. The chart timeframe does not matter: the signal timeframe is a separate input. The panel is dragged by its header and folded with the button in its top right corner.
3. Quick start
- The EA is placed on an empty chart of a liquid symbol with a small spread and swap; both are shown at the bottom of the panel.
- The risk rows of the panel are read: Max loss is the worst case for the current inputs with the class safe, aggressive, dangerous or not feasible; the table above it is the plan of the next cycle, the trigger price and the volume of every level.
- If the risk figure is not acceptable, Recovery trades, Zone, Zone expansion, Initial lot or Behavior are changed (they are marked with two asterisks in the inputs window), and the panel recalculates the plan.
- The first trade is opened with the Buy or Sell button, or an entry strategy is selected in the inputs, or adoption of external trades is enabled and the trade is opened the usual way.
- From there the EA runs the cycle on its own. A new trade opens only after the basket is closed; manual trades are not added to an active cycle.
The first run is best done on a demo account and in the visual mode of the tester, where the plan, the risk class and the execution of every level are visible.
4. How a cycle works
Fig. 2. A zone recovery cycle: the first trade, the zone, alternating levels, targets beyond the zone edges.
A cycle starts with the first trade. A zone of the set width is laid out around it. A counter pending stop order sits at the edge of the zone away from the trade. If the price reaches it, a trade in the opposite direction opens, and the next order appears at the opposite edge. The levels alternate like this: odd levels in the direction of the first trade, even levels against it.
The targets lie outside the zone: one above the upper edge, the other below the lower edge. The volume of every level is calculated so that, when the price leaves through either edge, the total result of the basket equals the cycle target, commissions and swaps included. Lots grow exactly as much as the arithmetic requires, not by a fixed multiplier.
While there is no basket, the first trade is managed like an ordinary position: break-even, trailing by a share of the maximum move in its favour, a stealth take-profit. If the price goes the right way at once, the cycle closes without a single recovery level.
When every level of the ladder is filled, the loss policy after the last level applies (section 9): close everything at the far edge exactly at the displayed maximum, or hold the basket and unwind it.
5. The panel
The panel is read from top to bottom; the numbers match figure 1.
- Header: symbol, chart timeframe, zone width and state. The coloured band along the top edge and the word on the right show the state: Ready (no cycle), Managing (the first trade is managed), Recovery (recovery in progress), Paused, Closing (the basket is being closed), Halted (an input or risk error, no trading). On the right the cycle number or the entry source, and the fold button.
- Cycle P/L: the current result of the cycle in the account currency. −142.50 in the figure.
- Target and Costs: the cycle target (+38.00), its price and distance (1.16585, 46 p), the accumulated costs (12.80) and the basket break-even price (BE 1.16502).
- Levels: the level budget. "Levels 3 of 8" and a bar of segments: filled levels are solid, the next one is outlined. On the right the next level with its direction, volume and distance: "next L4 ▼ 0.41 · 18 p".
- The ladder table: number, direction, volume and trigger price of every level; filled ones are marked filled, the next one is highlighted. In a plan without a cycle the first row shows market and entry.
- Risk rows: Max loss, the worst case of the cycle in money and as a percentage of the balance with its class (−6 400.00, 32 % · aggressive); Max lots, the total volume with the full ladder (2.54); All charts, the combined worst case of every chart running the EA (−7 800.00, 39 %).
- Market data: spread, the zone to spread ratio (highlighted in amber below 20×), long and short swaps, and today, the realised result of this instance since the start of the server day.
- Buttons: Buy and Sell without a cycle, Pause and Close all in a cycle. Close all asks for confirmation: for five seconds the button turns into "Confirm close?"; in the tester it closes at once.
- The Auto Entries check box and the EA's magic number. The label names the source of automated entries: the selected strategy with its timeframe ("Auto Entries · RSI H1") or Random in manual mode.
Fig. 3. The panel without a cycle: the Ready state, the hint line, the Buy and Sell buttons, the Auto Entries check box.

- The header and the Ready state word: no cycle; on the right the entry source (manual entry).
- The hint line. Without a cycle it explains why an entry is blocked right now (session, weekday, spread, news, daily limit), or that adoption of external trades is on. In a cycle it reports that the first trade was adopted and whether it kept its own stops, or that the cycle is paused.
- The Buy and Sell buttons open the first trade at market.
- The Auto Entries check box switches automated entries on and off without editing the inputs. With a strategy selected it starts ticked, in manual mode unticked, on a live chart and in the tester alike. On a live chart the switch requires a second click within five seconds ("Confirm: auto entries ON?"); in the tester it switches at once. The state of the box lives until the EA restarts. The instance's magic number is on the right.
Fig. 4. The folded panel: symbol, state and cycle result in one line.

The button in the top right corner folds the panel into a pill with the symbol, the state and the cycle result; a second click unfolds it. Panel size selects one of three sizes: Small, Medium, Large (75, 100 and 125 % of the reference, multiplied by the screen scale, so on a 4K monitor at 150 % the panel looks the same as on an ordinary one). If the selected size does not fit the chart height, the panel steps down to the next smaller size and says so in the journal. Panel text size changes only the type inside the selected size: Small, Medium, Large (90, 100 and 110 %).
Fig. 5. A ladder of 50 levels: the table folds filled, pending and blocked levels into range rows.

The table always has eight rows. With a long ladder it shows a window around the next level and folds the rest.
- "Levels 12 of 50" and the next level, "next L13 ▲ 1.46 · 14 p".
- Above 16 levels the budget bar becomes continuous: the next level is marked on it, the blocked tail is hatched.
- "L1–L12 · 12 filled · 0.62 lots net": the filled levels in one row with their net volume.
- The next level is highlighted.
- "L18–L33 · 16 pending · lots 4.44 → 126.22": the pending levels in one row with their volume range.
- "L34–L50 · 17 blocked · max volume": levels the broker will not accept because of the maximum volume or the margin.
- The Max lots row shows cap: the plan has hit the broker's maximum volume.
6. On the chart
Fig. 6. The cycle on the chart: the zone, filled levels, tags of the next levels, break-even and target lines, closed-cycle cards.
- The translucent zone band; its dashed edges are the level trigger prices. The "zone 32.0 p" label at the left edge.
- Numbered dots: filled levels on the bars where they fired, green for buys and red for sells, joined by a thin line. This is the real path of the cycle.
- The next level tag: "▼ L4 · 0.41 lots · in 18 p". The zone edge it sits on turns solid from the current bar. The dotted line from the hollow circle of the current price points at the next trigger.
- The muted tag of the level after the next one ("▲ L5 · 0.66") and the "+N more" count of pending levels on that edge. With an expanding zone or a width list the pending levels have their own prices: short ticks with labels on the nearest six.
- The dotted target line ("TP +38.00 · 1.16585"); the basket closes in profit on it.
- The basket break-even line ("BE 1.16502").
- Closed-cycle cards: the result ("+$41.20"), the cycle number, the level count and the reason for closing (target, manual close, guard). A profit sits in a green card above the closing point, a loss in a red one below it. The cards stay until the EA is removed (at most 300, then the oldest goes) and do not depend on whether the panel is shown; the Closed-cycle result card on the chart input switches them off.
- The upper and lower break-even lines of the fully filled ladder ("Upper BE · if all 8 fill · 1.16780", "Lower BE …"). They show where the basket breaks even if every level fills; when a line is off screen, its price is shown at the right edge, top or bottom.
- The hollow circle on the current price. The "ladder ends at L33 · max volume" note appears when the plan is clamped by the broker.
7. The first trade: where it comes from and how it is managed
Buttons
Buy and Sell on the panel open the first trade at market with the Initial lot volume (or the volume derived from the risk budget). A plan with the dangerous class opens only after a warning in the journal; a not feasible plan does not open at all.
Built-in strategies
Entry strategy sets the source of automated entries, Signal timeframe sets the calculation timeframe independently of the chart timeframe. The strategies: Manual (buttons), Random (for testing), RSI reversal (a reversal from the Indicator level with the Indicator period), Bollinger band fade (an entry off a Bollinger band), MACD cross (a MACD crossover with the Fast period and the Slow period), Moving average cross (a crossover of two moving averages with the same periods), Stochastic reversal, Donchian breakout (a breakout of the channel built over Indicator period bars), Heiken Ashi flip (a change of the Heiken Ashi candle colour), ADX (a DI+ and DI− cross with ADX at or above the Indicator level), Ichimoku (a Tenkan and Kijun cross; Fast period sets Tenkan, Slow period sets Kijun), Buy only and Sell only (a constant entry in one direction), Custom indicator.
Reverse automated signals turns any strategy into its contrarian version. Continuous opens the next cycle in the same direction as soon as a cycle started with a button is closed; it stops after a manual Close all or when the re-entry is rejected by the risk check.
Custom indicator
With Entry strategy = Custom indicator the indicator name is set (with its subfolder if it is not in the root of the Indicators folder), its inputs as a comma-separated list (for example 14,0,3.0) and the way the signal is read:
- Arrows: two buffers, a buy arrow and a sell arrow; a non-empty value in a buffer counts as a signal.
- Level: one buffer; a cross of the Custom level upward gives a buy, downward a sell.
- Zero: one buffer, a cross of zero.
- Code: one buffer with a direction code: 0 buy, 1 sell, EMPTY_VALUE nothing. The classic signal-buffer convention, compatible with other recovery EAs.
Custom signal bar sets the signal bar: 1 the last closed bar (no repainting), 0 the current bar.
External trades
Adopt an external trade as the first trade sets which external positions on the chart symbol the EA takes as the first trade of a cycle:
- Off: the EA manages only what it opened itself.
- Manual trades only: positions without a magic number (terminal, mobile application).
- Any external trade: any position on the symbol that does not belong to this instance, other EAs included. It needs care when several robots work on one symbol.
- Magic list: only positions whose magic number is in the Magic list for adoption (semicolon-separated, for example 123;456).
Remove the adopted trade's own SL/TP strips the adopted trade's hard stops so that they cannot close the cycle behind the EA's back; from then on the EA's break-even and trailing take over. With the input off, the panel warns that the adopted trade has kept its own stops.
Managing the first trade
Break-even trigger sets after how many pips of profit the stop is moved to break-even; Break-even behavior chooses whether it goes to the entry price or locks half of the profit. Trailing stop keeps the set share of the maximum move in the trade's favour and starts after the break-even trigger; the stop is never placed on the losing side of the entry; Trailing step sets the minimum step of a move. Stealth take-profit closes the first trade at a hidden take-profit that is not in the order. A value of 0 switches any of these mechanisms off.
8. Zone and volumes
Zone width
Zone mode selects the calculation: Fixed pips takes Zone size, ATR takes the ATR with the Zone ATR period on H1 multiplied by the Zone ATR multiplier; the ATR mode fits the width to the symbol's volatility, so one set of inputs suits different symbols. Zone sequence sets an explicit list of widths per level in pips, for example 50;50;80;120; a set list takes priority over the mode, and beyond its end the last width keeps growing by Zone expansion. Zone expansion multiplies the zone width at every level: 1.0 gives the classic fixed zone, values of 1.1–1.5 noticeably reduce the whipsaw risk at the cost of a wider worst case.
The zone should be at least 20–25 spreads: the bottom of the panel shows the zone/spread ratio and highlights it in amber below 20×. A fixed-spread account reduces the risk of false level triggers on spread spikes.
Volumes
Lot sizing mode: Fixed lot takes Initial lot; Auto: risk % of balance picks the largest initial lot whose worst case fits into Risk % of balance. Recovery behavior sets how fast the volumes grow: Very aggressive puts the basket break-even closer to the current price but consumes margin faster; Very light gives the lowest total exposure. Recovery trades sets the ladder length, up to 50 levels: more levels mean a longer recovery and a larger final volume.
Profit target mode and Profit target value set the cycle target: in pips on the initial lot, in money or as a percentage of the balance. Trail basket after target enables trailing of the basket once the target is reached.
Risk classes
Max loss on the panel gets the class safe, aggressive, dangerous or not feasible. A not feasible plan (volume or margin beyond what is possible) sends no order at all, and the journal stays clean. A dangerous plan is refused by automated entries on a live chart; the Buy and Sell buttons open it after a warning in the journal. In the tester a dangerous plan trades, and the journal says so once. Risks add up across charts: the All charts row shows the combined worst case of every EA instance in the terminal.
9. After the last level, pause and closing
Loss policy after the last level sets the behaviour once the ladder is used up. Close all at the far boundary closes everything at the far edge of the zone exactly at the displayed maximum loss: the figure is known before entry and does not depend on where the price goes next. Hold and unwind stops adding levels, keeps the basket and closes it when half of the drawdown at the moment of full allocation is recovered, the target is reached or the emergency stop fires. Holding has no fixed loss cap, so it is combined with Emergency cycle stop.
Emergency cycle stop closes the cycle when its loss reaches the set percentage of the balance, in any phase of the cycle.
Pause stops adding levels and closes the cycle once half of the drawdown accumulated since the pause is recovered, or at the target if it is reachable. Close all closes the basket at once after confirmation.
The target and the zone inputs can be changed during a cycle through the inputs window: the volume and the trigger price of the pending order are recalculated automatically. A gap or slippage can move the actual closing away from the displayed figure.
Fig. 7. The loss policy after the last level: closing at the far boundary or holding and unwinding.
10. Filters and limits
The filters apply only to the opening of a new cycle and never interfere with recovery levels: a cycle that has started is carried to its end.
- Sessions: Trade Asian, European, American session by server time, or Use custom hours with its own Custom start and Custom end window.
- Weekdays: Trade on Monday … Trade on Friday.
- Max spread in points: with a larger spread the entry is postponed.
- News filter on the terminal's built-in calendar: entries are blocked from Block minutes before news before an event until Block minutes after news after it; High-impact events only restricts the filter to important events.
- Daily loss limit and Daily profit target in the account currency: the realised result of this instance (symbol and magic) since the start of the server day is counted, the same figure as in the today row. Once either is reached, no new cycles open until the next day.
The reason for a block is shown in the hint line under the state on the panel.
11. Notifications
Notifications on cycle events: Off, Terminal alert (the terminal window), Push notification (the mobile terminal), Alert + push. Messages arrive at the start of a cycle, at the fill of every level, at the closing of a cycle and when any guard fires. In the tester notifications are off.
12. Inputs
The input names are given as they appear in the inputs window. Two asterisks in the window mark the inputs that affect risk.
Trading
| Input | Purpose | Default |
|---|---|---|
| Lot sizing mode | Fixed lot or Auto: risk % of balance | Fixed lot |
| Initial lot (fixed mode) | Initial volume for the fixed mode | 0.01 |
| Risk % of balance (auto mode) | Risk budget for the automatic mode: the largest initial lot whose worst case fits into the percentage | 10.0 |
| Entry strategy | Source of the first trade (section 7) | Manual (chart buttons) |
| Signal timeframe | Calculation timeframe of the strategies, independent of the chart | H1 |
First trade management
| Input | Purpose | Default |
|---|---|---|
| Break-even trigger, pips | Profit in pips at which the stop moves to break-even; 0 switches it off | 10.0 |
| Break-even behavior | Move SL to entry or Lock half the profit | Move SL to entry |
| Trailing stop, % of MFE | Share of the maximum move in the trade's favour kept by the stop; 0 switches it off | 30.0 |
| Trailing step, pips | Minimum step of a stop move | 2.0 |
| Stealth take-profit, pips | Hidden take-profit of the first trade; 0 switches it off | 0.0 |
Recovery
| Input | Purpose | Default |
|---|---|---|
| Recovery trades | Ladder length in levels; at most 50 | 25 |
| Zone mode | Fixed pips or Auto: ATR-based | Auto: ATR-based |
| Zone size, pips (fixed mode) | Zone width for the fixed mode | 50.0 |
| Zone ATR period (H1) | ATR period for the ATR mode | 14 |
| Zone ATR multiplier | ATR multiplier for the ATR mode | 4.0 |
| Zone expansion per level | Zone width multiplier at every level; 1.0 means no expansion | 1.2 |
| Zone sequence, pips per level | Explicit list of widths per level, for example 50;50;80; takes priority over the mode | empty |
| Recovery behavior | Very aggressive, Aggressive, Standard, Light, Very light | Standard |
| Profit target mode | Pips (on initial lot), Money, Percent of balance | Pips |
| Profit target value | Target value in the selected units | 20.0 |
| Trail basket after target, % | Trailing of the basket after the target; 0 closes at once | 0.0 |
| Emergency cycle stop, % of balance | Emergency closing of the cycle at a loss of this percentage; 0 switches it off | 0.0 |
| Loss policy after the last level | Close all at the far boundary or Hold, stop adding, unwind at half drawdown | Close all at the far boundary |
Entry strategy parameters
| Input | Purpose | Default |
|---|---|---|
| Indicator period | Period of RSI, Stochastic, Donchian, ADX | 14 |
| Indicator level | RSI level (oversold), ADX threshold | 30.0 |
| Fast period (MACD/MA) | Fast period of MACD and MA cross, Tenkan for Ichimoku | 12 |
| Slow period (MACD/MA) | Slow period of MACD and MA cross, Kijun for Ichimoku | 26 |
| Custom indicator name | Name of the custom indicator, with a subfolder if needed | empty |
| Custom indicator inputs | Inputs of the indicator, comma-separated | empty |
| Custom signal interpretation | Arrows, Level, Zero, Code | Arrows |
| Custom buy-signal buffer | Buy-arrow buffer for the Arrows mode | 0 |
| Custom sell-signal buffer | Sell-arrow buffer for the Arrows mode | 1 |
| Custom value buffer | Value buffer for the Level, Zero and Code modes | 0 |
| Custom level to cross | Level for the Level mode | 0.0 |
| Custom signal bar | 1 the last closed bar, 0 the current bar | 1 |
| Reverse automated signals | Contrarian version of any strategy | false |
| Continuous | Repeat the manual direction after each cycle | false |
Entry filters
| Input | Purpose | Default |
|---|---|---|
| Trade Asian / European / American session | Allowed sessions by server time | true, true, true |
| Use custom hours instead | Own window instead of the sessions | false |
| Custom start hour / minute | Start of the own window | 0 / 0 |
| Custom end hour / minute | End of the own window | 23 / 59 |
| Trade on Monday … Trade on Friday | Allowed weekdays | true |
| Max spread, points | Maximum spread for an entry; 0 switches it off | 0 |
| News filter (built-in calendar) | News filter on the built-in calendar | false |
| Block minutes before news | Minutes blocked before an event | 30 |
| Block minutes after news | Minutes blocked after an event | 30 |
| High-impact events only | Important events only | true |
| Daily loss limit, money | Daily loss limit in the account currency; 0 switches it off; blocks new cycles | 0.0 |
| Daily profit target, money | Daily profit target; 0 switches it off; blocks new cycles | 0.0 |
External trades
| Input | Purpose | Default |
|---|---|---|
| Adopt an external trade as the first trade | Off, Manual trades only, Any external trade, Magic list | Off |
| Magic list for adoption | Semicolon-separated list of magic numbers | empty |
| Remove the adopted trade's own SL/TP | Strip the adopted trade's own stops | true |
Other
| Input | Purpose | Default |
|---|---|---|
| Notifications on cycle events | Off, Terminal alert, Push notification, Alert + push | Off |
| Magic number | Instance identifier; unique for every chart | 772001 |
| Trade comment | Comment of the trades | ATT Zone Recovery |
| Show chart panel | Show the panel | true |
| Panel size | Small, Medium, Large (75, 100, 125 %) | Medium |
| Panel text size | Small, Medium, Large (90, 100, 110 %), type only | Medium |
| Closed-cycle result card on the chart | Result card of a closed cycle on the chart | true |
| Panel: DEMO values | Demo figures on the panel and a sample cycle on the chart for screenshots; stays off on a live account | false |
| Tester: open one random first trade at start | In the tester, in manual mode, open one random first trade at the start | true |
| Verbose logging | Detailed journal | false |
13. Files
The cycle state is stored in the file MQL5\Files\ATTZoneRecovery\<symbol>_<magic>.bin in the terminal's sandbox and is updated at every change of the cycle; at start the EA reads it and continues the cycle after a terminal restart, a timeframe switch or an edit of the inputs. The instance's worst case is published in the terminal global variable ATTZR_RISK_<symbol>_<magic>; the All charts row adds up the risk of every chart from these variables; the variable is deleted when the instance has nothing to add.
14. Strategy Tester
In the tester, Manual mode opens one random first trade at the start (Tester: open one random first trade at start) so that a backtest with default inputs shows trading; after that cycle the EA opens nothing on its own. Further cycles are opened with the Buy and Sell buttons in visual mode or with the Auto Entries check box on the panel: in manual mode it gives random entries, with a strategy selected signal-based ones. Visual mode shows the plan, the risk class and the execution of every level. A dangerous plan trades in the tester, a not feasible plan opens nowhere. The demo from the Market runs in the tester only.
15. If something looks wrong
| Symptom | Cause | Action |
|---|---|---|
| Halted on the panel and "Trading halted" | An input or risk error, the reason is written to the journal | Fix the input named in the journal |
| "Entry blocked: …" under the state | A filter fired: session, weekday, spread, news, daily limit | Wait for the window or change the filter |
| Max loss with the not feasible class | The plan does not pass the broker's volume or margin | Lower Initial lot or Recovery trades, raise the deposit |
| Automated entries do not open with the dangerous class | On a live chart such a plan opens only with a button | Lower the risk in the inputs or open with a button after the warning |
| Nothing opens in the tester after the first cycle | In manual mode the Auto Entries box starts unticked | Tick Auto Entries on the panel or select a strategy |
| The panel buttons do not react | Algo trading is off or the tester runs without visual mode | Switch algo trading on; in the tester use visual mode |
| The panel does not fit the chart height | The selected Panel size is taller than the chart | The panel steps down on its own; enlarge the window or select Small |
| The panel text looks large on a high-resolution monitor | The type is multiplied by the screen scale | Panel text size = Small |
| Rows L34–L50 blocked · max volume | The broker will not accept the volume or the margin is insufficient | A shorter ladder, a smaller initial lot or a lighter Behavior |
| The adopted trade closed at its own stop | Remove the adopted trade's own SL/TP is off | Switch the input on; the panel stops warning |
| The cycle continued after a terminal restart | The state was restored from the file (section 13) | Expected behaviour; Close all closes the basket |
| Levels do not fire inside a session | The order was rejected by the broker with "Market closed" | Wait for the market to open; the EA retries |




![[Action Required]: Manual EA Pause Recommended [Action Required]: Manual EA Pause Recommended](https://c.mql5.com/6/1027/splash-preview-775266.png)
