Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Twitter üzerinde bulun!
Fan sayfamıza katılın
Kodu ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Kodu beğendiniz mi? MetaTrader 5 terminalinde deneyin
Komut dosyaları

Robustness Lab: Monte Carlo drawdown analysis of your trading history - MetaTrader 5 için komut dosyası

Panagiotis Paterakis
Panagiotis Paterakis
  • Algorithmic trading developer (MQL5, cTrader C#, Python) at  Self-employed
  • Yunanistan
  • 333
I design, code and run automated trading systems. My own systems trade forex, indices and gold live on cTrader (C#), across several brokers, so I work through the full cycle: clear strategy rules, backtesting with realistic costs, robustness checks around the chosen parameters, live deployment, and
Görüntülemeler:
82
Derecelendirme:
(1)
Yayınlandı:
\MQL5\Include\RobustnessLab\
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

A backtest or a live track record shows one order of trades. The same trades in a different order can produce a much deeper drawdown. This script measures how much deeper.

Monte Carlo report: equity fan and drawdown percentiles

How it works

  • It loads the closed trades from the account history between two dates, optionally filtered by magic number and symbol. Profit, swap, commission and fees are combined per position.
  • Two methods: shuffle (same trades, random order, so the final result stays the same and only the path changes) or bootstrap (trades drawn with replacement, so the final result varies too).
  • For every simulation it records the maximum drawdown in money and in percent of the running peak, and the final equity.

Output

  • Drawdown at the 50th, 90th, 95th and 99th percentile, compared with the original order.
  • Probability that the maximum drawdown reaches your threshold (default 20%) and probability of ending below the start.
  • Final equity at the 5th, 50th and 95th percentile and an "MC recovery factor": net profit divided by the 95th percentile drawdown.
  • A panel on the chart with the equity fan and the drawdown histogram (press Close to remove it), and an HTML report in Terminal\Common\Files\RobustnessLab.

Inputs

History from and to, magic number (-1 = all), symbol filter, number of simulations, method, starting balance (0 = estimated from the account), random seed, drawdown threshold, write HTML report, panel size.

Notes

  • Needs at least a few closed trades. Results are only as good as the history: more trades give more reliable percentiles.
  • Requires RL_Common.mqh and RL_MonteCarlo.mqh in MQL5\Include\RobustnessLab (included). The same Monte Carlo class can be used in your own EAs.
  • Statistics describe past data only and are not a forecast.

The screenshot shows part of the HTML report produced by the same Monte Carlo class for the 818 trades of a Strategy Tester run of a simple demo EA (EURUSD H1, 2021-2025). That demo EA loses money, which shows the report also works as a warning.

Robustness Lab: Market regime indicator (bias-corrected Hurst, efficiency ratio, volatility) Robustness Lab: Market regime indicator (bias-corrected Hurst, efficiency ratio, volatility)

Classifies the market as trend, mean-reversion or noise using three public measures: the Hurst exponent by rescaled range with small-sample bias correction, Kaufman's efficiency ratio and the percentile of the current ATR. A colour strip shows the regime bar by bar, and a panel shows the regime on M15, H1, H4 and D1 at the same time. Part of the free Robustness Lab set.

Robustness Lab: Seasonality heatmap with t-statistics (hour x weekday) Robustness Lab: Seasonality heatmap with t-statistics (hour x weekday)

Shows how a symbol has behaved in every hour of every weekday, as a heatmap on the chart. Colour the cells by t-statistic, mean return, hit rate or average range. Cells that pass a significance threshold get a gold frame, and the panel tells you how many cells would pass that threshold by chance alone, so a single lucky hour is not mistaken for an edge. Hover any cell for its full numbers. Part of the free Robustness Lab set.

Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester

Draws a live heatmap of two optimised inputs while the Strategy Tester optimises your EA, and scores every cell by its neighbourhood: the plateau score is the mean minus k times the standard deviation of the surrounding cells. It shows whether your best parameters sit on a stable plateau or on a single lucky cell, and writes an HTML report, a CSV and a picture of the map. Includes a Monte Carlo drawdown criterion and a small demo EA. Part of the free Robustness Lab set.

Prop Firm Risk Manager - daily loss and trailing drawdown guard Prop Firm Risk Manager - daily loss and trailing drawdown guard

Account guard for prop-firm challenges. It does not open trades: it watches the whole account (manual trades and any EA) and closes everything before the firm's limits are broken. - Daily loss limit: closes all and blocks trading until the next day. - Max drawdown: static or trailing (can lock at the start balance); closes all and locks the account. - Optional profit-target lock, max lots / max positions, Friday close. - On-chart panel (equity, today's P/L, daily and drawdown room left) and push alerts. - Equity peak and lock are saved per account, so a restart does not reset the protection. Main inputs: StartBalance, DailyLossUSD, DDMode, MaxDDUSD, LockAtStart, safety buffers, TargetUSD, MaxOpenLots, MaxOpenPositions, FridayCloseOn, ResetLock. Attach to any one chart, any symbol and timeframe, with Algo Trading enabled.