Recovery Mode Manager
A trader in drawdown is statistically the trader most likely to reach for larger size to win it back faster - the opposite of what actually helps. A rule like "cut position size in half once I'm 8% under my equity peak, and don't go back to full size until I've recovered to within 3%" is easy to state and easy to forget to apply consistently in the moment, especially several trades into a losing stretch. This EA tracks that rule mechanically. It keeps a running peak of account equity (persisted across restarts) and computes live drawdown from that peak. Once drawdown reaches a configurable entry threshold it switches to recovery mode; it only switches back to normal once equity recovers to within a smaller exit threshold of the peak, not simply back under the entry threshold - that gap between the two thresholds (hysteresis) stops the mode flapping back and forth on ordinary equity noise right at the boundary. Each mode publishes its own risk multiplier (1.0 normal, a reduced value such as 0.5 in recovery) to a named GlobalVariable that a trader's own sizing spreadsheet, or another EA's lot-size calculation, can read directly by name and multiply its own risk percent by. This EA never trades. It is a read-only sizing input, published for whatever actually opens the trades to use. Notes and limitations - This EA does not trade, close positions, or resize anything itself - it only publishes a number. Nothing enforces that any other tool actually reads or respects it; that integration is the trader's responsibility. - Peak equity is persisted with GlobalVariableSet, which the terminal auto-deletes after roughly 4 weeks of no access - an account left completely idle that long can lose its tracked peak and silently restart from the equity at next attach. Reattaching periodically resets that clock. - Drawdown is computed from equity (includes floating P/L), not balance, so it reacts to unrealised losses in open positions as well as closed ones. - A withdrawal read as equity dropping below the old peak looks identical to a real drawdown unless InpResetPeakOnInit is used deliberately after the withdrawal.
Expert advisor · MT5 · v1.0 · Free
About Recovery Mode Manager
Recovery Mode Manager is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Drawdown enter percent, Drawdown exit percent and Normal risk multiplier. MQL source code included.
Files in the download: RecoveryModeManager.ex5, RecoveryModeManager.mq5, RecoveryModeManager.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Drawdown enter percent | 8.0 | Enter recovery mode once drawdown from peak equity reaches this % |
| Drawdown exit percent | 3.0 | Return to normal once drawdown falls back under this % (must be < enter) |
| Normal risk multiplier | 1.0 | Published multiplier while in normal mode |
| Recovery risk multiplier | 0.5 | Published multiplier while in recovery mode |
| Instance tag | Default | Names this instance's GlobalVariable, so multiple strategies can coexist |
| Reset peak on init | false | Reset the persisted peak equity to current equity on this attach |
| Alert on mode change | true | Popup Alert() whenever the mode switches |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Risk & Lot Size · Alerts · MT5 Expert Advisor · MQL5 Source Code