MT5 research beta · Expert advisor

TF Account Risk Guard for MT5

Monitor loss from a daily equity baseline and current-to-stop portfolio risk. Publish a pause signal for cooperating EAs with the same magic number.

MQL5 source, EX5, README and SHA-256 checksums. Research beta.

Concept illustration for TF Account Risk Guard for MT5; not a software screenshot
Concept illustration; not a software screenshot or a performance result.
New research / Utilities

A management or logging tool, not a standalone return-generating strategy. Functionality is assessed through acceptance checks, not a profitability curve.

Functional workflow

How this utility is used

  1. Records and persists the first attached equity baseline for each broker-server day.
  2. Adjusts monitored equity change for balance and credit deals.
  3. Adds current-to-stop losses and pauses when risk cannot be quantified.

What this MT5 EA does

  1. Records equity at first attachment during each broker-server day and persists that baseline locally.
  2. Adjusts monitored equity change for reported balance and credit deals after its baseline time.
  3. Adds current-to-stop losses across positions and flags positions whose stop risk cannot be quantified.
  4. Publishes a terminal-local pause expiry for the configured magic number; the supplied Position Manager and Session Breakout EA can read it.
  5. Optional emergency closure targets the configured magic number on hedging demo accounts only.

Adjust the utility settings

Adjust the actual MT5 inputs below, then download a .set file. Load it through Strategy Tester → Inputs → Load. The EA ZIP includes source code and the compiled file.

Source defaults loaded.

Utility settings · 5 inputs

Changes apply to your downloaded file. They do not change the published tests.

Preview the .set file

Limitations and failure conditions

  • The daily baseline is the first attachment of that day, not a reconstructed midnight balance. Start the guard before the trading session.
  • The pause does not block manual orders, unrelated EAs or another terminal. It is not an account-wide guaranteed loss limit.
  • Stop-risk estimates exclude gaps, costs and pending-order exposure; missing stops trigger the pause.
  • EmergencyCloseDemoPositions is false by default and is unavailable on netting or real accounts.
  • If the guard stops, exposure-based pause expires after ten server-time seconds; a daily-loss latch lasts until the next broker-server day.
  • Cash adjustments other than balance and credit deals are not classified separately. A positive equity is required at initialization.

Install in MetaTrader 5

  1. Extract the ZIP and read its README before attaching any file.
  2. In MT5, choose File → Open Data Folder. Copy the MQ5, EX5 and TFCommon.mqh files together into MQL5/Experts/TradeForex.
  3. Refresh Navigator and attach the EA to a chart in an isolated demo or tester. Review its inputs and data requirements.
  4. Use one instance per chart. Reattach after changing accounts; retain the documented state files and settings when testing restarts.

No broker password, web API key or DLL permission is required by this package.

Acceptance checks before relying on it

Native functional checks cover the recorded subset. The checklist below also includes cases that still require your own demo validation; not every scenario is certified as passed.

  • Compare the displayed baseline and cash-adjusted loss with a controlled demo ledger.
  • Check midnight rollover, restart, missing stops and changes in current-to-stop exposure.
  • Use a matching and a different magic number to confirm the pause is cooperative and scoped.
  • Test optional emergency closing only on disposable demo positions and verify unrelated tickets remain untouched.

Download contents and integrity

The ZIP contains MQL5 source, the compiled EX5, TFCommon.mqh, README.md, MIT licence, TEST-STATUS.json and SHA256SUMS.txt.

ZIP size: 27,524 bytes. SHA-256: 49e757ec0bacabfa6f5204f6c600006bc9bf5d63a91da9fd8bf4d83c367bd8f0.

Download EA source and EX5

See how we distinguish compilation, demo testing and trading evidence.

Frequently asked questions

Does this tool work in MT4?

No. This package contains MQL5 source and an EX5 build for MetaTrader 5 desktop. MT4 requires a different codebase; mobile and web charts do not run this desktop file.

What has been tested?

The updated research build compiled with zero errors and zero warnings and passed the documented native functional acceptance checks. Netting and prolonged forward operation remain unverified. No profitability result is assigned to a management or logging utility.

Can it trade on a live account?

Order-changing functions in this release refuse real accounts and are disabled by default. Use an isolated demo or the Strategy Tester. The Execution Logger only records events and never sends orders.

Related tools and guides

Educational research, not personal investment advice. CFDs are leveraged products and can cause rapid losses. A calculation, indicator or stop cannot guarantee an account outcome.

Follow on Facebook