MQL5 Algo Trading: post #3987 — TG.ME

Prop-firm style daily loss rules often fail in real EAs because checks run per bar, ignore floating P&L (and swap), or don’t hard-block new orders. This module fixes that with an on-tick circuit breaker that measures combined daily P&L using server-midnight as the reset boundary.

CDailyPnlCalculator sums realized exits from deal history plus current position profit and swap, giving a true “today” exposure number every tick. When the limit is breached, the breaker closes all positions and removes all pending orders (using MqlTradeRequest actions), then enters a HALTED state until next server midnight.

A small API (Init/OnTick/IsHalted/GetStatus/ForceReset) makes integration predictable: gate every OrderSend with IsHalted. A chart dashboard and a verification script validate the math, reset timing, and formatting before deployment.

👉 Read | CodeBase | @mql5dev
❤24👍9👌1
August 29, 2026 12.9K 11