Loading…

Leverage Disaster Simulator

"Higher leverage means higher risk" is a sentence every trader has read and few have actually watched happen. This EA makes it concrete: it runs one fixed, non-optimised moving-average crossover rule over real historical bars, once per leverage multiple in a configurable list (1x, 5x, 10x, 25x, 50x by default), sizing each trade as a fraction of that leverage level's own current simulated balance - identical entries and exits at every level, only the position size scales. The result is a side-by-side comparison, on demand via an on-chart button, of what identical trading skill produces at different leverage settings. Lower multiples typically survive the full replay with a shrunken or grown balance; higher multiples typically hit a point where the required minimum lot can no longer be opened against the remaining simulated balance - the practical definition of ruin used here, since a broker's real minimum lot floor is what actually ends an account long before the mathematical zero is reached. Every simulated position size is computed from the symbol's real MODE_TICKVALUE/MODE_TICKSIZE and normalised to the broker's real MODE_LOTSTEP/MODE_MINLOT/MODE_MAXLOT - the sizing arithmetic is exactly what a live sizing routine would do, only the resulting orders are bookkeeping entries, never real ones. Notes and limitations No real order is ever sent - this tool exists purely to make a leverage comparison visible on demand, not to trade. "Ruin" here means the simulated balance can no longer cover the broker's real minimum lot at the fixed stop distance used internally; a live account can occasionally survive slightly past that point via a margin call partial-close, or fail slightly before it via spread/slippage this simulation ignores entirely. Every leverage level trades the identical entry/exit signal - this deliberately excludes any leverage-aware strategy adjustment (tighter stops at higher leverage, for example) so the comparison isolates position sizing as the only variable. The fixed 20-pip stop distance used for every trade's risk sizing is a simplification; a real system's stop distance would typically vary with volatility.

Expert advisor · MT4 · v1.0 · Free

About Leverage Disaster Simulator

Leverage Disaster Simulator is a script for MetaTrader 4 based on Moving Average. It has 5 settings, such as History bars, Fast ma period and Slow ma period. MQL source code included.

Files in the download: LeverageDisasterSimulator.ex4, LeverageDisasterSimulator.mq4, LeverageDisasterSimulator.txt.

Settings

SettingDefaultWhat it does
History bars600Bars of real history replayed for the simulation
Fast ma period8Fixed, non-optimised fast MA period (same rule at every leverage)
Slow ma period21Fixed, non-optimised slow MA period
Starting balance1000.0Simulated starting balance, same for every leverage level
Risk fraction per trade0.02Fraction of CURRENT simulated balance risked per trade at 1x baseline

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Moving Average · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria