Discussing the article: "The MQL5 Standard Library Explorer (Part 19): Developing a Reusable Portfolio Risk Manager"

Check out the new article: The MQL5 Standard Library Explorer (Part 19): Developing a Reusable Portfolio Risk Manager.

This article explores CAccountInfo through a shared risk authority for a multi-symbol Expert Advisor. We model requests, decisions, and reservations, then apply portfolio, symbol, position, direction, and margin checks before submitting trades. The example also explains the limits of its reservation and execution handling.

Per-node position sizing cannot prevent several strategy nodes from committing the same account capacity during one processing cycle. This article builds a portfolio risk authority around Trade\AccountInfo.mqh and its CAccountInfo class, combining account values, managed-position risk, and same-cycle reservations before approving, reducing, or rejecting an entry. In Part 18, we established shared indicator caching; the present step extends that architecture from shared market data to shared risk permission.

The host Expert Advisor (EA) still routes timer and trade events. CRiskPortfolioManager owns the strategy-node collection and coordinates two shared services: the Part 18 indicator cache and the new portfolio risk authority. Each node reads its cached indicators, constructs a proposal, and waits for a decision before reaching CTrade.

Author: Clemence Benjamin