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
Kütüphaneler

Robustness Lab: Optimisation robustness map with plateau score for the Strategy Tester - MetaTrader 5 için kütüphane

Panagiotis Paterakis
Panagiotis Paterakis
  • Algorithmic trading developer (MQL5, cTrader C#, Python) at  Self-employed
  • Yunanistan
  • 128
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:
92
Derecelendirme:
(1)
Yayınlandı:
\MQL5\Experts\RobustnessLab\ \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

The best line of an optimisation report is often the luckiest one. A parameter set is more trustworthy when its neighbours give similar results. This library shows that directly.

Optimisation robustness map with plateau score, demo EA on EURUSD H1

How it works

  • Each optimisation pass sends its statistics to the terminal through frames (FrameAdd). The collector in the terminal draws a heatmap of two chosen inputs and updates it during the optimisation.
  • Metric per cell: net profit, profit factor, recovery factor, Sharpe ratio, the value returned by OnTester, or the MC recovery factor (net profit divided by the 95th percentile Monte Carlo drawdown of that pass).
  • If more than two inputs are optimised, each cell holds the mean (or best) over the other inputs.
  • Plateau score of a cell = mean - k x standard deviation of the valid cells within the chosen radius. At least 60% of the neighbourhood must be valid. Passes with too few trades are excluded and shown grey.
  • At the end it marks the best single cell (white) and the most robust cell (cyan) and tells you if the best cell sits on a weaker neighbourhood.

How to use it in your EA

  1. Copy the three .mqh files to MQL5\Include\RobustnessLab and add #include <RobustnessLab\RL_OptimizationMap.mqh>.
  2. Declare a global CRLOptimizationMap object and add the four tester functions (OnTester, OnTesterInit, OnTesterPass, OnTesterDeinit). RL_Demo_EA.mq5 shows them in a few lines.
  3. Optimise two inputs, choose "Custom max" as the criterion if you want the MC recovery factor to drive the optimisation, and watch the map on the chart that opens.
  4. Reports go to Terminal\Common\Files\RobustnessLab (HTML and CSV) and the picture to MQL5\Files\RobustnessLab.

A single test (not an optimisation) writes a Monte Carlo drawdown report for that run instead.

Demo EA

RL_Demo_EA is a plain EMA crossover with ATR stops. It exists only to demonstrate the tools and is not a trading recommendation.

Notes

  • Works with complete and genetic optimisation. Grid up to 200 values per axis.
  • A robust cell still needs an out-of-sample (forward) check before live use.

The screenshot shows the optimisation of the demo EA on EURUSD H1, 2021-2025: fast EMA 4-40 and slow EMA 20-200, 361 combinations (grey cells are invalid combinations where fast >= slow).

Robustness Lab: Monte Carlo drawdown analysis of your trading history Robustness Lab: Monte Carlo drawdown analysis of your trading history

Takes the closed trades of your account (all, or filtered by magic number and symbol), reshuffles or resamples them thousands of times and shows how deep the drawdown could realistically get. You get drawdown percentiles, the probability of a drawdown above your limit, the spread of final equity, an equity fan chart and a drawdown histogram, on the chart and as an HTML report. Part of the free Robustness Lab set.

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.

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.

Return-to-Mean Clock: How Many Bars Does Price Take to Come Back to the Moving Average Return-to-Mean Clock: How Many Bars Does Price Take to Come Back to the Moving Average

Measures how long price takes to come back to its moving average. The histogram shows the distance of the close from an EMA in ATR. Every time that distance first reaches a stretch level (1, 2 and 3 ATR by default), the indicator follows the stretch until the close is back at the average, runs further, or the wait is over. A panel shows, for each level, how often price came back, how often it ran further first, and the median and 80th-percentile number of bars the return took. One line can be pasted into a comment to compare symbols. It is a statistics tool and gives no trade signals.