Loading…

Drawdown Recovery Mathematics

A loss and the gain needed to undo it are not the same percentage, and the gap grows faster than most traders expect. A 20% loss needs a 25% gain to recover; a 50% loss needs 100%; a 90% loss needs 900%. The relationship is convex - it gets worse than intuition expects once losses pass roughly 30-40% - because the recovery gain is computed against the smaller post-loss balance, not the original one. This script prints the trader's own numbers first: type in the account's real historical peak balance (MT4 keeps no running record of it, so this has to be supplied), optionally let the current figure come live from account equity, and the script computes the exact current drawdown and the exact gain required to recover it. Underneath that it prints a full reference grid across a range of loss percentages so the shape of the curve is visible, with the row closest to the trader's own drawdown marked. Notes and limitations - Recovery here means "gain enough, with nothing else happening, to reach the typed peak again". It ignores time, trading costs, and any further losses incurred on the way back up. - If InpYourPeakBalance is set too low (below the true historical peak), the reported drawdown and required gain will understate reality - the figure is only as honest as what gets typed in. - This is arithmetic, not a trading signal. It says nothing about whether or how a drawdown will actually be recovered, only what recovering it mathematically requires.

Script · MT5 · v1.0 · Free

About Drawdown Recovery Mathematics

Drawdown Recovery Mathematics is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Your peak balance, Use live equity as current and Your current balance. MQL source code included.

Files in the download: DrawdownRecoveryMaths.ex5, DrawdownRecoveryMaths.mq5, DrawdownRecoveryMaths.txt.

Settings

SettingDefaultWhat it does
Your peak balance10000.0Type your account's real historical peak balance/equity here
Use live equity as currenttrueIf true, use this account's live equity as "current"; else use InpYourCurrentBalance
Your current balance8000.0Manual mode only: your account's current balance/equity
Grid start loss pct5.0Reference grid's first loss percentage row
Grid max loss pct90.0Reference grid's last loss percentage row
Grid step loss pct5.0Increment between grid rows

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Grid · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria