Demetra Robustness Lab Monte Carlo Stress Test
- Utilità
-
Francesca Draoli
Under the name DEMETRA, I develop software for MetaTrader 5. On this profile I publish indicators, utilities and expert advisors. I handle the code, the tests and the updates myself. - Versione: 1.26
- Aggiornato: 24 novembre 2026
- Attivazioni: 10
Is the edge of your strategy robust, or did the backtest just get lucky? Robustness Lab takes the closed trades of a strategy and puts them through a set of stress tests: Monte Carlo risk, trade order, the best trades removed, luck, extra costs, missed trades and stability over time. The answer is one clear verdict and an A to F grade, with every test shown on one panel.
It reads the trades from your account history, from a Strategy Tester or trade history report saved as HTML, or from a CSV file. It is read-only: on live charts it never opens, modifies or closes a trade.
Main features
1. Three trade sources. Account history, with an optional magic number filter. A report (.htm or .html) saved from the Backtest tab of the Strategy Tester or from the History tab of the Toolbox: its currency is read from the report and its initial deposit becomes the starting capital unless you set one; a report whose amounts do not add up to its balance column is refused. A CSV file with one closed trade per row: quoted fields, comma, semicolon or tab separators, and any common number format (1,234.50, 1.234,50, 1 234,50, currency signs, negatives in brackets) are read; you can state the currency of the amounts, and rows that cannot be read are counted and shown on the panel. An optional symbol filter works on account history, on reports and on CSV files with a symbol column; the panel says so when a CSV has no symbol column. From account history every closed position counts as one trade, partial closes included, with its commission, swap and fees.
2. Monte Carlo cone. Many simulated equity paths built from your own trades. The panel draws the band that holds most of the paths and the median path. When each path has as many trades as the history (the default), the real trades are drawn on top in their real order, so you can see whether the real result sits in the middle of the band or near its edge.
3. Simulated risk. Final profit or loss of the paths at the bad, typical and good end, maximum drawdown measured from the running peak (a path that loses the whole capital stops there, at 100%, and counts as ruin), share of the simulated runs that ended in profit and share that reached ruin at the drawdown you define (a measure of fragility, not a forecast), and the loss at the edge of the worst paths with their average loss.
4. Order test. The same trades shuffled many times: it shows how the drawdown of the real order compares with random orders, so a drawdown that was only lucky or unlucky is easy to spot.
5. Remove the best. The best trades are taken out and the rest is measured again, together with the share of profit made by the top trades. A strategy that lives on a few big wins shows it here.
6. Luck test. How often a strategy with no edge at all would reach the same result. A deflated profit factor and confidence take into account how many variants or optimisation passes you tried before picking this one.
7. Stress test. An extra cost on every trade (spread, slippage, commission), the break-even extra cost, and trades skipped at random as with downtime or filters.
8. Stability over time. The trades are split in time order and each part is measured on its own, so an edge that faded is visible.
9. Grade and verdict. ROBUST, MIXED or FRAGILE with an A to F grade and the number of checks passed. With too few trades it says NEEDS MORE DATA and gives no grade. The thresholds can be changed in the inputs.
10. Repeatable results and report. A fixed random seed gives the same numbers every time. RE-RUN repeats every simulation with the next seed. REPORT saves an HTML report with the cone and all results, plus CSV files of the results and of the trades, in the MQL5\Files folder. On live charts the CSV files can also be written after each analysis.
11. Panel. Every line has a tooltip that explains it. The panel scales with the chart size and the screen DPI, works on dark and light charts and can be minimized; on a chart too small for it, it is minimized automatically and comes back when the chart is larger. It checks for new closed trades, or a changed file, at the interval you set. When the source has fewer than two closed trades, an example strategy is shown instead, clearly marked SAMPLE DATA; on live charts this can be switched off. Before the terminal is connected, the panel says it is waiting for the account history instead of showing SAMPLE DATA.
Inputs
Trade source, history window, filters, file name and folder, currency of the CSV amounts, and example data on or off; number of simulations, path length, starting capital (in the currency of the trades), ruin level and random seed; settings of each test; verdict thresholds; CSV export, panel position and refresh interval. Values outside the allowed range are refused at start, with one clear message in the Experts log.
Any symbol and account currency: forex, gold, indices, crypto and more. Attach it to any chart; the analysis does not depend on the chart symbol unless you set the symbol filter.
Analysis only. It uses no DLL and no web requests. In the Strategy Tester the panel runs by itself and presses RE-RUN and REPORT; to give the tester some activity it places one small demonstration trade, which is left out of the analysis. This demo works only in the Strategy Tester and can be switched off. On live charts it never trades.
The tests describe how the trades you supply behaved in the past and how sensitive the result is to luck, order and costs. They do not predict future results, and no tool guarantees profits. Trading involves risk.
