Loading…

Withdrawal Policy Demonstrator

Two traders can run the exact same strategy with the exact same edge and end up with very different outcomes purely because of what they do with their profits. This demonstrator makes that difference visible directly: a single synthetic sequence of trades (a fixed win rate and reward:risk ratio, sized as a percent of CURRENT equity each time) is generated once with a seeded random source, and the SAME win/loss sequence is applied to two parallel balances so the comparison isolates the policy, not luck. The compounding balance reinvests every gain, so its position size grows and shrinks with its own equity. The withdrawal balance runs identically between withdrawal checks, but every InpWithdrawEveryN- Trades trades it looks at how much profit it has made since the last check and pulls a configurable share of that profit out, leaving only the remainder compounding. It never dips below its own baseline because of a withdrawal, since only profit already made is ever taken. The CSV report lays out both equity curves trade by trade, plus a summary comparing final trading equity, cumulative cash withdrawn, combined wealth (equity still trading plus cash already pulled out), and maximum drawdown for each policy. Notes and limitations - Report-only. No order is ever sent and the real account balance is never read or touched - InpStartingBalance is a synthetic starting figure, not the attached account's actual balance. - The synthetic trade sequence is a fixed win-rate coin-flip model with a constant reward:risk ratio. It says nothing about any real strategy's actual trade distribution, streaks, or correlation between trades - use it to understand the mechanics of a withdrawal policy, not to size a real one. - Risk is expressed purely as a percent of current equity - no lot size, symbol, spread or commission is involved anywhere in this simulation. - The simulation runs exactly once, on the first tick after attach. Changing an input requires removing and re-attaching the EA (or reloading the template) to re-run with the new values.

Expert advisor · MT5 · v1.0 · Free

About Withdrawal Policy Demonstrator

Withdrawal Policy Demonstrator is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 9 settings, such as Starting balance, Num trades and Win rate percent. MQL source code included.

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

Settings

SettingDefaultWhat it does
Starting balance10000.0Starting balance for both curves
Num trades500Number of synthetic trades to simulate (capped, see .txt)
Win rate percent45.0Probability a synthetic trade is a winner
Reward risk ratio2.0Win pays this many times the amount risked
Risk percent per trade1.0Percent of CURRENT equity risked on each trade
Random seed12345Seed for MathSrand - same seed reproduces the same run
Withdraw every n trades20How often the withdrawal curve checks for a payout
Withdraw percent of profit50.0Percent of profit since the last check that is withdrawn
Report file nameWithdrawalPolicyDemo_report.csvReport file, written under MQL5\Files\

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: Alerts · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria