An MQL5 prop-firm guard must evaluate account rules before it acts and verify that protective actions have completed. This article examines eight rules, two-phase directive resolution, position closing, Algo Trading state checks and restart recovery. A demo and synthetic tests show how to use the guard and verify its rule logic.
The observation half of a prop-firm rule guard freezes the account into one immutable record per pass. It separates a finding from an action and defines the contract that every rule implements. Part 1 built this observation layer. A session clock, a profit ledger, an excursion tracker, and a calendar feed fill that record.
Part 2 covers the deciding half and the acting half. The eight rules come first, then the table that holds them, then the pass that turns eight independent opinions into at most one directive. After that come the actuators, the state file, the facade, the demo, and the verification script.
Part 1 also numbered nine failure modes of the hand-written guard, from C1 to C9. They are referenced below by number, because almost every decision here exists to make one of them unreachable. One note on scope carries over: this is a guard and not a strategy, and it never decides when to enter.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Building a Prop-Firm Rule Guard in MQL5 (Part 2): Eight Rules, One Directive, and the Action Layer.
The observation half of a prop-firm rule guard freezes the account into one immutable record per pass. It separates a finding from an action and defines the contract that every rule implements. Part 1 built this observation layer. A session clock, a profit ledger, an excursion tracker, and a calendar feed fill that record.
Part 2 covers the deciding half and the acting half. The eight rules come first, then the table that holds them, then the pass that turns eight independent opinions into at most one directive. After that come the actuators, the state file, the facade, the demo, and the verification script.
Part 1 also numbered nine failure modes of the hand-written guard, from C1 to C9. They are referenced below by number, because almost every decision here exists to make one of them unreachable. One note on scope carries over: this is a guard and not a strategy, and it never decides when to enter.
Author: Bruno Nunes Myrrha Ribeiro