Discussing the article: "Building a Prop Firm Compliance Monitor in MQL5 (Part 2): Daily Sessions and Restart-Safe Starting Balances"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Building a Prop Firm Compliance Monitor in MQL5 (Part 2): Daily Sessions and Restart-Safe Starting Balances.
Establishes persistent daily-session management for Prop Firm Guard in MetaTrader 5. The EA derives the session identity from the trading-server date, account login, and server, persists state in SQLite, and adds a confirmation step for the daily starting balance. A timer detects trading-day changes and restores the confirmed baseline after EA removal or terminal restarts, ensuring a stable reference for daily risk checks.
When an Expert Advisor starts, the balance it reads reflects the account at that moment. If trades have already been opened or closed earlier in the session, that value may no longer represent the balance that should serve as the daily reference. Reusing the current balance after every restart or reattachment would therefore allow the baseline to shift during the same trading day.
Part 1 established the account-level foundation for Prop Firm Guard by validating the configured prop firm rules and persisting those settings in SQLite. Part 2 extends that foundation with state specific to a single daily session. The objective is to preserve a trader-confirmed starting balance so the same reference can be restored after the EA is removed, reattached, or restarted.
A new session does not automatically accept the current balance as final. Instead, the EA presents it as a suggested value and requires explicit confirmation. Once confirmed, the session stores the starting balance and the equity captured at that moment and can restore them later.
The measurable goal for Part 2 is straightforward: for the same account and the same configured session day, reattaching the EA should restore the same confirmed baseline rather than create a new one. A new session should begin only after the configured reset boundary identifies a different session day.
Author: Chacha Ian Maroa