Demetra Risk Scenario Lab Stress and Lot Size Test
- ユーティリティ
-
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. - バージョン: 1.25
- アクティベーション: 10
How much stress and how much size can your trading take? Risk Scenario Lab takes the closed trades of a strategy and re-runs them under harder conditions: higher costs, bigger losses, smaller wins, other lot sizes and compounding. It shows where the edge breaks, the largest lot size that keeps the risk inside your own limits, and what the positions open right now would lose in a bad move, all 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, whose initial deposit becomes the starting capital unless you set one; its amounts are shown in the report's currency. A CSV file with one closed trade per row, with optional symbol and volume columns, in the usual formats: comma, semicolon or tab separators, decimal point or comma, UTF-8, ANSI or UTF-16. Rows that cannot be read are counted and shown, and a file that cannot be read safely is refused with the reason, never guessed. CSV amounts are taken in the account currency unless you set the file currency. When the trades are in a currency other than the account's, the starting capital is converted at your broker's rate. An optional symbol filter works on account history, on reports and on CSV files with a symbol column; on a CSV without one, the panel says so. From account history every closed position counts as one trade, partial closes included, with its commission, swap and fees.
2. What-if scenarios. Your trades in their real order with an extra cost per trade, with every loss bigger, with every win smaller, with all three together, with another lot size and with compounding. For each scenario: net result, profit factor, largest drawdown and, from Monte Carlo paths, the simulated drawdown and the share of simulated paths in ruin. This is a simulation of your past trades, not a forecast. When a scenario loses the whole account, its tooltip says so.
3. Real lot sizes. When lots are scaled and the symbol and volume of a trade are known, the new lot is rounded to the lot step, minimum and maximum lot of that symbol at your broker, as a real order would be.
4. Stress grid. The profit factor of your trades when costs rise and losses grow at the same time, colored from healthy to broken, so you can see how much room the strategy has.
5. Breaking point. The extra cost per trade, and the loss multiplier, at which the net result of the history goes to zero. A history without an edge is shown as such.
6. Size ladder and safe size. Simulated drawdown, share of simulated paths in ruin, median result and worst results for smaller and larger lot sizes. The safe size is the largest lot multiplier that keeps the simulated drawdown and the share of paths in ruin inside the limits you set; it is applied to your usual lot on the chart symbol, rounded down to the lot step, with the margin calculated by your broker at the current price. A row is marked with an asterisk when some trades cannot be sized exactly because of the broker's lot step, minimum or maximum lot.
7. Open risk now. For the positions open on the account: how many have no stop loss, the result if every stop loss is hit, the open result, the result of an adverse move measured in average daily ranges, the margin level and how much loss is left before the stop-out. Every amount comes from the broker's own profit and margin calculation, in your account currency; the losses at the stop and in the adverse move include swap and the estimated commission to close.
8. 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 all results, plus CSV files of the results, the trades and the open positions, in the MQL5\Files folder. On live charts the CSV files can also be written after each analysis. Very large histories are handled with fewer simulations so the chart stays responsive, and the footer shows it.
9. 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 minimizes itself until the chart is bigger. It checks for new closed trades, a changed file and the open positions at the interval you set. When the source has fewer than two closed trades, an example strategy is shown instead, clearly marked SAMPLE DATA together with the reason; on live charts this can be switched off.
Inputs
Trade source, history window, filters, file name, folder and currency, and example data on or off; the size of each scenario; number of simulations, starting capital, ruin level, your limits for drawdown and for the share of paths in ruin, and random seed; the adverse move for open positions; CSV export, panel position and refresh interval. Values outside the allowed range are refused at start, with one clear message that names each wrong input.
Any symbol and account currency: forex, gold, indices, crypto and more. Attach it to any chart; the safe lot is shown for the chart symbol.
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 scenarios describe how the trades you supply would have behaved under harder conditions, and the simulations assume that trades are independent. They do not predict future results, and no tool guarantees profits. Trading involves risk.
