The client's idea
Yaser Abdi works XAUUSD on M5; the opening brief was: The moment the day's loss hits my limit, trading for that day is over.
Project and starting point
On volatile days the client kept re-entering and blew past the daily loss limit they had set for themselves.
Solution architecture
The day's opening equity is recorded, positions close at the limit, and no new entry is allowed until the next trading day — all logged.
The limit is measured from the day's opening equity so mid-day deposits or withdrawals cannot skew it. It matches how XAUUSD is actually traded and can be tested against the data already available.
Why this design
The limit is measured from the day's opening equity so mid-day deposits or withdrawals cannot skew it. It matches how XAUUSD is actually traded and can be tested against the data already available.
Implemented capabilities
Modules and components built: Position close + halt until next day.
Delivered output:
Daily loss circuit breaker — XAUUSD (M5)
Specification document and the rule-to-code mapping table
Full MQL5 source, commented
Test report: High-volatility day testing
Parameter document and install guide (5 weeks)
Safeguards and risk control
The risk layer sits outside the strategy logic, so a later change to the signal cannot bypass it.
Backtest and forward test method
Test method: High-volatility day testing.
Testing runs in three stages: a backtest on historical data, limited optimisation inside the contract's scope, and a forward run with the parameters frozen.
Tools and stack: MQL5, gold M1 data, halt logs.
Every figure from this project is published together with its measurement conditions: the data window, the tick model, the spread, the commission and the build of the executable. Without them a number cannot be compared with anything.
Publishable results
Replaying the twenty worst days of the test set, no day's loss crossed the limit, and the account survived its first full month.
Limitations and cautions
The risk layer sits outside the strategy logic, so a later change to the signal cannot bypass it.
Every test result depends on the quality of the historical data, the broker's spread and market conditions, and none of it is a promise about the future. Through a severe price gap or a broker disconnection a stop loss cannot be guaranteed, so behaviour in those conditions must be reviewed separately.
Our next-step proposal
The next step is a monthly compliance report that proves the account rules were respected.
Portfolio
Measured results
These are the figures the test produced — not a promise about future performance.
- 3.1 % Max drawdown in test
- 100 % Runtime stability in test
- 1 day Recovery after drawdown
- 20 scenarios Scenario test coverage