Quantrivance

Guard: a stop that runs inside MT5

Set an equity floor and a daily loss limit. The Agent checks them every second in your terminal, even when our servers cannot be reached.

By the Quantrivance team4 min readGuard

Why a stop button is not enough

The worst trading days have something in common: they move fast, and they rarely wait for you. A news spike at 3 a.m., an EA that keeps doubling into a trend, a VPS you cannot reach from your phone. A kill-switch helps only if someone is awake to press it, and only if the website, your phone's connection and our servers all work at that moment.

Guard removes the person, and the network, from the moment that matters. You decide your limits calmly, in advance. The Agent in your terminal keeps a copy of them and enforces them on its own.

What Guard watches

You can set either limit, or both, for each account:

  • Minimum equity, in USD. If equity falls below it, the limit is broken.
  • Loss for the day, as a percentage of the balance at the start of the day. The day is your broker's server day; Daily loss limits: whose day is it? explains how it is counted.

You also choose how long a limit must stay broken before the Agent acts. It starts at 10 seconds. This keeps a single bad price tick from stopping the account, while still acting within seconds of a real fall.

The Agent checks every second, using the numbers in your terminal. It does not judge while the terminal is disconnected from the broker, because the numbers would be stale.

What happens when a limit breaks

When a limit has stayed broken for the time you chose, the Agent stops the whole account the same way a kill command does: it closes the charts of your EAs, so they cannot open new trades, then deletes pending orders and closes open positions at the market price.

Then it tells you. You get one Telegram message, the chart's panel shows GUARD TRIPPED, and the Strategies page shows why it acted and how many positions and charts it closed.

Guard acts once. After it has stopped an account, it waits until you save the limits again. For the daily loss limit, it is ready again when your broker's day ends. Restarting the terminal does not make it act twice, and it does not forget to report.

If the broker refuses the orders, or the market is closed, the Agent closes the charts, reports how many positions are left, and does not keep retrying. Those positions are yours to deal with by hand.

Setting your first Guard

  1. In MT5, open the Agent's Inputs and set "Let the web app stop trading here" (AllowControl) to true, and turn on Algo Trading. Only you can do this, at the terminal; we cannot turn it on for you.
  2. In Quantrivance, open Strategies and press Set up Guard for the account.
  3. Set your limits and how long they must stay broken.
  4. Leave dry run on at first. In dry run you are alerted when a limit is reached, and nothing is closed. Watch it for a few days to see whether your limits would have stopped you at the right moments.
  5. Save with your 6-digit code from your authenticator app. The chart's Guard line shows when the Agent has the new limits.

When you are happy with the limits, turn dry run off and save again. Until the Agent confirms it holds a limit, the page does not show it as protecting the account.

A limit set above the account's current equity is broken at once, so saving it stops the account straight away, the same as a kill.

What Guard cannot do

  • It cannot run on a terminal that is off. If MT5 or the machine it runs on is down, nothing in it can act. Run MT5 on a machine that stays on, such as a Windows VPS.
  • It closes at the market price of that moment. When prices move fast, that can be past your limit. Leave a margin.
  • It is not designed or guaranteed to keep you within a prop firm's rules. Prop firms count losses and days in their own ways.
  • It does not watch EAs you attach again afterwards. After Guard has acted, an EA you put back on a chart is not watched until you save the limits again.
  • It only works for accounts in USD or USC, because the limits are set in US dollars.

In Quantrivance

Limits that work while you sleep

Guard comes with every account on a subscription, the free trial included, and needs Agent 1.2.0 or later. A Guard you have set keeps working even after a subscription ends.

See pricing and the free trial

This post is for education and is not investment advice. Examples use made-up figures, not anyone’s results. Trading carries risk.