Discussing the article: "Building a Prop-Firm Compliance Monitor in MQL5 (Part 1): Account Rules and Persistent Settings"

 

Check out the new article: Building a Prop-Firm Compliance Monitor in MQL5 (Part 1): Account Rules and Persistent Settings.

Establishes the persistence foundation for a prop-firm compliance EA in MetaTrader 5. It introduces rule inputs and status enums, separates live account state from stored settings, validates percentages and thresholds, and implements SQLite open/close, schema creation, and prepared save/load operations. Using the account login and server as a composite key, the EA restores existing settings and updates them when inputs change.

You are deploying an Expert Advisor to monitor a prop-firm account, and you need it to do more than display balance and equity. It must reliably apply the correct rule set to the correct account even after EA removal, terminal restart, or server changes. In practice, two failures occur frequently: settings are lost or re-entered between runs, and identical numeric logins on different trading servers can cause configuration mix-ups. A third risk is late detection of invalid inputs, such as zero, negative, or oversized percentages and incorrectly ordered thresholds. If these values reach later drawdown calculations, the resulting compliance checks become mathematically unreliable.

Part 1 builds the fail-safe foundation required to eliminate these problems before compliance monitoring begins. We separate volatile runtime measurements from persistent rule configuration, enforce fail-fast input validation, and implement account-specific SQLite persistence keyed by account login and trading server. By the end of this part, the EA can identify the active account, validate its rule configuration before continuing initialization, create or open its SQLite database, and save or synchronize the correct rule set for the current account/server pair. We will confirm each behavior through clear success and failure messages in the Experts log.

Author: Chacha Ian Maroa