Metis Risk Guardian
- Utilities
-
Victor Gomez Sanchez
Industrial electronics and automation engineer, with over ten years trading and investing in the markets. I design trading systems for MetaTrader 5 with the same discipline applied to a work of engineering: clear structure, exact calculation, and every component with a verifiable purpose. - Version: 1.0
Metis Risk Guardian is an account protection utility for MetaTrader 5. It watches your equity in real time and, when a limit you set is reached, it closes every open position, deletes every pending order and keeps the account flat until you lift the lock. If you would rather stay in control, an alert-only mode warns you and touches nothing.
What it protects you fromMost accounts are not lost in a single bad trade. They are lost in the hour after one, when the decision to stop has already been made and is not being followed. This utility holds you to limits you set in advance, at the moment you are least willing to respect them.
It does not open trades, it has no opinion on the market, and everything it does is the consequence of a threshold you typed in yourself.
The five limitsThe daily loss limit stops the trading day when equity falls a set percent, or amount of money, below the equity at the start of that day. The starting figure is reconstructed from your account history, so it is correct even if you attach the utility with the session already running, and deposits or withdrawals during the day do not distort it. The session start hour follows your broker's server time and is configurable.
The maximum drawdown can be measured two ways, and both can run at once: trailing, as the fall from the highest equity ever reached, or static, from a fixed baseline. This lock can be kept until you clear it deliberately, which is the point of having it.
The losing streak counts consecutive losing trades and stops you at the count you choose; a winning trade resets it. Only your own trades count. The closes ordered by the utility itself are signed internally and excluded, so enforcing one limit can never inflate the streak that would trigger another.
The daily profit target works the other way round: once the day reaches your goal, it closes everything and keeps the day in profit until the next session.
The news lockout uses the economic calendar built into MetaTrader 5 to block trading a set number of minutes before and after important events, filtered by importance and by currency. With an empty currency list it uses the currencies of the chart symbol.
What "blocking" really meansMetaTrader does not allow a program to forbid placing an order. Any product that claims otherwise is describing something the platform cannot do.
What this utility does instead is undo what appears: while a lock is active it closes any new position and deletes any new pending order as soon as it detects them, checking at least once per second, including weekends without ticks. Measured on a demo account, an order placed during a lock was removed in between a quarter and six tenths of a second. Every enforcement is written to the log with what it actually did, so you can audit it afterwards.
What the magic filter does, and what it does notBy default the utility watches and protects the whole account. If you set a magic number it will only close the trades carrying that magic, which is what you want when you run one Expert Advisor and would rather the guardian never touched your manual trades. The losing streak follows the filter as well.
What the filter does not narrow is the measurement. The three money limits are still computed on the equity of the whole account, because MetaTrader has no such thing as the equity of a magic number. That means a loss caused by trades outside the filter can trigger a lock the utility is not allowed to act on.
It does not hide this. While such a lock is active the panel border turns amber, a red row states how many positions and orders are outside the filter and were not closed, and the log and the alert say the same, so you can close them yourself or switch the filter off. Measuring per magic number is planned for a future version.
Out of the boxIt starts in alert-only mode. The limits are already set to values most traders will recognise — five percent daily loss, ten percent trailing drawdown, a news lockout around high-impact events — so the panel is useful from the first minute and you can see how close you are to each one.
What it will not do until you say so is close anything. Watch it for a session, check the figures against your terminal, and when they look right switch the action to close and block. A tool that flattens accounts should not do it before you have asked it to.
The on-chart panelThe state is the largest line and the background is tinted to match it, so a locked account reads at a glance from across the room. The border is a separate channel: it turns amber whenever something needs your attention — AutoTrading disabled, the reset switch left on, closes failing — even while the state itself is normal.
Right below the state, the panel says what is actually in force: close and block or alert only, whole account or a single magic number, and which account login it is watching. Then the day's result with a balance, equity and floating breakdown you can reconcile against the terminal; how far equity can still fall before each limit fires; the drawdown with the peak and baseline it is measured from; the losing streak; the next relevant news event; and the countdown to the daily reset. Problems such as an unavailable calendar or AutoTrading being off are shown on the panel rather than hidden.
Alerts that stay readableA breach opens a pop-up, followed by at most two reminders while that same lock lasts. Then it goes quiet and records that it has done so. A lock that lasts a whole session does not become a stream of pop-ups, because an alert you have learned to dismiss without reading protects nobody. A new lock alerts again.
If the broker gets in the wayAround news releases brokers widen the freeze level, a band around the price where orders cannot be touched. If that stops a close, the message names the broker as the cause instead of blaming your terminal, and how loudly it complains depends on whether you are still exposed: a frozen pending order is at rest, so it is reported calmly and retried, while a frozen position means you are still in the market and is flagged immediately.
A log you can auditThe startup line prints the thresholds in force, not just which rules are switched on: the reset hour, each limit with its value and mode, the news window with the currencies it resolved, and which trades the magic filter covers. Locks, releases, streak changes and every enforcement action are recorded, so you can reconstruct why the utility acted, or did not act, at any point of the session.
Main inputs- Action on breach: close and block, or alert only, which is the default.
- Magic number filter: the whole account by default, or the trades of one magic number.
- Daily reset hour, in server time.
- One enable switch and one threshold per rule.
- News importance, minutes before and after, and currency list.
- Panel corner and offsets.
MetaTrader 5, hedging or netting account, demo or real. Attach it to one chart only, one instance per account; the chart symbol is used solely to auto-select the news currencies when the currency list is empty. AutoTrading must be enabled or the utility can detect a breach but cannot close anything, and the panel warns you about that.
On a netting account each symbol holds a single merged position, so its magic number identifies whichever order touched it last rather than an owner. If you use the magic filter there, treat it as approximate.
The economic calendar needs a connected terminal; in the Strategy Tester the news rule reports itself as unavailable. When a limit is breached, positions are closed at market price, so in fast markets the final loss can differ slightly from the exact limit because of slippage.
What it does not doIt does not open trades, it does not manage them, and it does not promise any trading result. It enforces a decision you already made. Whether that decision was a good one is not something a utility can know.

A very useful app. Thanks!