We present a dependency-free MQL5 library that tests risk limits instead of simply using them. It grades any loss limit with six coverage tests, validates the battery on synthetic data, compares four standard forecasters on EURUSD daily history, and feeds the verdict back into position sizing.
Almost every risk-sized Expert Advisor begins the same way: it picks a volatility measure (an ATR, a rolling standard deviation or a Value at Risk figure), turns it into a stop distance and a lot size, and trades. And then nothing in the program ever asks whether that number was right. The volatility model can be breached three times as often as it claims, for a year, and the sizing code will keep dividing by it, with no error and no warning.
Yet a risk limit is easy to test. A limit at 99% confidence is falsifiable: losses should exceed it on about one day in a hundred, and the machinery for turning that count into a verdict was worked out in the 1990s.
In this article we build a dependency-free library that grades any loss limit with six tests, check it on synthetic data, grade four standard risk models on EURUSD, put the verdict on the chart, and feed it back into an Expert Advisor's sizing.
The central claim, which the rest of the article supports, is that counting breaches is the least informative thing you can do with a risk limit, and that the model a breach count declares healthiest may be the one to trust least.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Counting Breaches Is Not Backtesting: Six Tests for a Loss Limit.
Almost every risk-sized Expert Advisor begins the same way: it picks a volatility measure (an ATR, a rolling standard deviation or a Value at Risk figure), turns it into a stop distance and a lot size, and trades. And then nothing in the program ever asks whether that number was right. The volatility model can be breached three times as often as it claims, for a year, and the sizing code will keep dividing by it, with no error and no warning.
Yet a risk limit is easy to test. A limit at 99% confidence is falsifiable: losses should exceed it on about one day in a hundred, and the machinery for turning that count into a verdict was worked out in the 1990s.
In this article we build a dependency-free library that grades any loss limit with six tests, check it on synthetic data, grade four standard risk models on EURUSD, put the verdict on the chart, and feed it back into an Expert Advisor's sizing.
The central claim, which the rest of the article supports, is that counting breaches is the least informative thing you can do with a risk limit, and that the model a breach count declares healthiest may be the one to trust least.
Author: Adeolu Kayode Gbadebo