Skip to content
All library documents

Persisting and Validating Prop-Firm Account Rules in MQL5

Article MQL5 articles

Summary

This article presents the setup stage for an MQL5 Expert Advisor intended to monitor prop-firm compliance. It organizes inputs for account rules, warning thresholds, news restrictions, and protective responses, then separates persistent rule settings from changing account measurements such as balance and equity. It also defines status types for compliance severity, target progress, and possible protection actions.

The central implementation method is fail-fast validation followed by SQLite persistence keyed by both account login and trading server. This composite identity is meant to prevent settings from being confused when numeric logins overlap across servers. On startup, the EA checks the inputs, opens or creates the database, ensures the schema exists, and synchronizes the current inputs to the matching account record; on removal it closes the connection. The article describes log messages and expected first-run and repeat-run behavior as checks. This is an engineering foundation rather than a trading strategy, and the described part does not yet implement live compliance calculations or protective actions.

Key ideas

  • Persistent rule configuration is kept separate from volatile account measurements.
  • Inputs are validated before the EA proceeds to later compliance calculations.
  • Account login and trading server together identify the settings record in SQLite.
  • Current inputs are used to synchronize the stored rule configuration at startup.
  • This part establishes storage and initialization behavior but leaves monitoring logic for later work.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.