The client's idea
Hossein Azarnia works EURUSD on M5; the opening brief was: Do not touch the grid logic — just stop a one-way market from wiping the account.
Project and starting point
The existing grid EA kept opening positions through strong trends with no cap, pushing drawdown past the tolerable range.
Solution architecture
An independent guard layer over the existing EA that checks equity, daily drawdown, position count and total volume before every order.
Why this design
The original code was preserved so the behaviour stays familiar, with the change confined to an outer layer. It matches how EURUSD is actually traded and can be tested against the data already available.
Implemented capabilities
Equity-based daily loss cap, position limit, aggregate volume cap, forced behaviour through price gaps and rule-violation logging with error codes.
Safeguards and risk control
Every change starts from a saved backup, and the previous behaviour is kept as the test reference.
Backtest and forward test method
Scenario testing on historical strong-trend and high-volatility data, together with a manual review of the event log.
Publishable results
The EA's core logic stayed untouched, and the guard layer did not breach its configured caps in any tested scenario.
Limitations and cautions
Through severe gaps or broker disconnections a stop loss cannot be guaranteed, so behaviour in those conditions needs separate review.
Our next-step proposal
The next step is a full technical review of the expert and clearing the old code's debts.
Portfolio
Measured results
These are the figures the test produced — not a promise about future performance.
- 7 Defects fixed
- 6 Concurrent position cap
- 13.5 % Max drawdown in test
- 5 days Recovery after drawdown