Docs / User guides / Risk limits and rules

Risk limits and rules

Set loss limits, guards, trading hours and news windows, step by step.

Updated 26 Oct 2026·Version 0.x
Early access. Risk rules work on MT5 demo accounts only. Rules and limits block new orders; closing positions when one of them trips is not available yet. Time rules can close positions before a market close or news. The rules engine is not yet verified against a real broker’s demo server.

1. What you will do and what you need

You will open an account’s Risk tab, read what already protects the account, add rules for the limits your prop firm or your own plan sets, and add rules for trading hours, market close and news. You will also learn how long a tripped rule keeps blocking orders.

  • A trading account on a demo MT5 deployment. See trading accounts.
  • For the rules to block orders, the account’s deployment must run in risk mode. Section 4 shows how to check.
  • Permission to configure trading on the account. Without it you can read everything, and the buttons to add, change and delete are not shown.

Rules block new orders. They never refuse an order that closes a position, and they never close a position by themselves. Only time rules (section 12) can close positions.

2. Choose an account

  1. In the sidebar, under Security, choose Risks.
  2. Choose Open risk limits on the account you want. If you have only one account, it opens at once.
The Risks page listing trading accounts. Marker 1 is Risks in the sidebar, marker 2 is the Open risk limits link of the first account.
1 Risks in the sidebar. 2 Open risk limits on the account you want.

What you should see: the account’s page with the tabs Overview, Orders, Risk and Routes. You can also open it from Trading accounts and choose the Risk tab. Switch account at the top right goes back to the list.

3. The five sections

The Risk tab has five sections. The number in brackets is how many items each holds.

The Risk tab of an account. Marker 1 is the Risk tab, marker 2 the section tabs starting with Rules, marker 3 the warning that rules can block orders, marker 4 the Add rule button.
1 The Risk tab. 2 The sections: Rules, Guards, Limits, Hours and news, Whole policy. 3 The warning about blocked orders. 4 Add rule.
SECTIONWHAT IT IS FOR
RulesYour own rules: a name, one to four criteria, and where the rule applies.
GuardsRead-only checks that every account has. They come from the limits and cannot be deleted.
LimitsA short form: largest order, open positions, orders per minute and per day, daily loss, and more. Saving it changes the guards.
Hours and newsTime rules: trading hours, market close and news windows.
Whole policyEvery guard and rule written as one expression, with the revision number. Read-only.

The search box next to Add rule filters the rules and guards by name or expression.

4. The warning about blocked orders

On Rules and Whole policy a notice tells you whether your rules are enforced on this account.

  • Rules can block orders on this account (orange): the deployment runs in risk mode. Every saved change is sent to the server, and orders that break a rule are refused. The dashboard cannot yet show which revision the server has applied, so expect a saved rule to start refusing orders soon after you save it.
  • Your rules are stored, not checked on this account (blue): the account has no risk-mode deployment, or no deployment at all. Your rules are saved but nothing enforces them. Only the guards from the limits are checked.
  • Not known whether these rules are enforced (orange): the dashboard could not read the deployment. Treat the rules as active.
Important. Risk mode is chosen when a deployment is created and cannot be changed afterwards. The New deployment form does not offer it yet. See How risk rules work.

5. Add a rule with the form

This example stops new orders for the rest of the day once the account has lost 5 % of its balance that day.

  1. Open Rules and choose Add rule (4 in the picture of section 3).
  2. Type a Name, for example Daily loss 5 %. It is shown when the rule refuses an order and in alerts. Up to 100 characters.
  3. Under Applies to, keep Whole account. Choose Some routes to tick the routes the rule counts. A route rule counts only that route’s orders and positions.
  4. Under Edit as, keep Form.
  5. In the criterion, set Measure to Loss in % of balance, Period to Per day, Counts to Everything it applies to, Is to ≥, and Value (%) to 5. Choose Add criterion for more; all criteria must be true together.
  6. Leave Raise an alert when it trips as it is. See section 15.
  7. Choose Add rule.
The Add a rule form filled in for a 5 percent daily loss. Markers 1 to 7 point to the name, Applies to, Edit as, the criterion, Add criterion, the alert checkbox and the Add rule button.
1 Name. 2 Applies to. 3 Edit as. 4 The criterion. 5 Add criterion (up to four). 6 Raise an alert when it trips. 7 Add rule.

The form adapts to the measure you pick:

  • Measure has three groups. Profit and loss: Loss, Loss in % of balance, Profit, Profit in % of balance. Activity: Trades opened, Orders, Open positions, Net volume, Orders in flight. Each order: Order volume, Net volume of the symbol after the order, Price age, Spread.
  • Period is Per minute (orders only), Per day, Per week or Per month for counted measures, in the broker’s server time. For Open positions, Net volume, Orders in flight and the Each order measures it says None: the value is checked now, or on each order.
  • Counts can be the whole account or route, One strategy, One symbol or One strategy on one symbol. A Strategy or Symbol field then appears. Type the strategy as your orders name it, and the symbol as the account names it, for example EURUSD.
  • The unit of Value is in its label: account currency, %, lots, milliseconds or points.
  • P&L counts is active only for profit and loss criteria. Choose Closed and open positions (the default) or Closed positions only.

Under the criteria a sentence says what the rule will do, for example “Once it trips, it blocks new orders until the end of the day in the broker’s server time”.

What you should see: the editor closes and a green Saved notice says the rule was added.

The Risk tab after saving. Marker 1 is the green Saved notice, marker 2 the revision badge, which has gone up by one.
1 The Saved notice. 2 The revision badge: every save is a new revision, and the Rules tab now counts one more rule.

6. Add a rule with the expression editor

The expression editor is for people who prefer to type, and for rules the form cannot show. Both editors describe the same rule, and you can switch between them while you edit.

  1. Choose Add rule and type a Name.
  2. Next to Edit as, choose Expression.
  3. Type the criteria in the Expression box, joined by &&. For example account.open_positions >= 5 && order.volume > 100000000.
  4. Read the Preview below the box. It turns your expression into words, or tells you what is wrong, as you type.
  5. Choose Add rule.
The expression editor with an open-positions and order-volume expression typed in. Marker 1 is the Edit as switch, marker 2 the Expression box, marker 3 the Preview.
1 Edit as set to Expression. 2 The expression. 3 The Preview, which reads “Open positions ≥ 5 and Order volume > 1 lots”.

In an expression, every number is a whole number: money in hundredths of the account currency (50000 is 500.00), percentages in hundredths (500 is 5 %), and volumes in lots times 100 000 000 (100000000 is 1 lot). The form does this conversion for you. All measures and the grammar are in Writing a rule.

A rule has one to four criteria, at most 2,000 characters, and an account has at most 50 rules. Use && only. To block when either of two conditions is true, add two rules.

7. Prop-firm style examples

These use only what the form offers. Set each limit a little tighter than the firm’s, so your rule trips before the firm’s does. A tripped rule blocks new orders; it does not close a position that is already losing.

GOALMEASURE, PERIOD, VALUEEXPRESSION
Daily loss, firm limit 5 %: stop at 4 %Loss in % of balance, Per day, ≥ 4account.day.loss_pct >= 400
Weekly loss of 6 % of balanceLoss in % of balance, Per week, ≥ 6account.week.loss_pct >= 600
Daily loss of 500 in account currencyLoss, Per day, ≥ 500account.day.loss >= 50000
No order above 2 lotsOrder volume, None, > 2order.volume > 200000000
At most 10 open positionsOpen positions, None, ≥ 10account.open_positions >= 10
At most 6 orders a minute on one routeOrders, Per minute, ≥ 6 (Applies to: Some routes)route.minute.orders >= 6
One strategy on gold: stop after a weekly loss and 20 tradesTwo criteria. Loss, Per week, One strategy on one symbol, ≥ 500. Trades opened, Per week, same strategy and symbol, ≥ 20strategy.breakout.symbol.XAUUSD.week.loss >= 50000 && strategy.breakout.symbol.XAUUSD.week.trades >= 20

With ≥ a rule trips when the figure reaches the value. Choose > to block only above it.

Tip. The Limits section has fields for the common cases: Largest order (lots), Open positions at most, Orders per minute at most and Daily loss limit (optional). Use it for a fixed ceiling, and rules when you need a period, a route, a strategy or a combination.

8. Edit and delete a rule

  1. On Rules, find the rule and choose Edit. The same editor opens with the rule’s values.
  2. Change what you need and choose Save rule. Choose Cancel to leave the rule unchanged.
  3. To remove a rule, choose Delete, then confirm with the second Delete. Choose Cancel to keep it.
The editor open on an existing rule called Change Large order with many positions. Markers 1 to 4 point to the name, the Edit as switch, Save rule and Cancel.
1 Name. 2 Edit as. 3 Save rule. 4 Cancel.
A rule with the delete confirmation shown: the question asks to confirm deleting the rule, with Delete and Cancel buttons. Marker 1 is the confirming Delete button.
1 Confirm with Delete. The rule is gone and orders are no longer checked against it.
  • While one editor is open, Edit and Delete on the other rules are switched off. Finish or cancel first.
  • A rule the form cannot show opens in the expression editor.
  • If someone else saved the policy while your editor was open, a notice says The policy changed meanwhile and your save will be refused. Choose Cancel and edit again.
  • Deleting a rule that has tripped removes its block. Delete one only on purpose.

9. What saving, enforcement and revision mean

  • Revision. The badge on each section, for example “Revision 8 (rules changed)”, is the version number of the account’s whole policy. Each save of rules, time rules, limits or routes makes a new one, with the time it was issued.
  • Saved is not the same as applied. The green message ends with “It is a new policy revision; the dashboard cannot yet show when the host applies it.” The server applies it shortly after. Until it does, new opening orders can be refused with the code risk_policy_pending. Closes are not held.
  • Enforcement. A saved rule only blocks orders where the notice in section 4 says so. A stored rule on an account without risk mode does nothing.
  • Limits work the same way, with Save risk limits, and apply to orders placed from then on.
  • If the dashboard cannot read the account’s data fresh, saving is paused with a message until it can.

10. Guards and limits

Open Guards. Each line is one check with its name, its condition in words, and what it covers (Whole account or a route). You cannot edit or delete a guard. Choose Limits to change them.

The Guards section listing checks such as Volume per order, Open positions and Orders per minute. Marker 1 is the Guards tab, marker 2 the Limits tab.
1 Guards. 2 Limits, where the guards are set.

In Limits, fill in the fields and choose Save risk limits. Discard changes goes back to the saved values.

The Limits section with fields for largest order, largest position per symbol, open positions, orders per minute, orders per day and daily loss. Marker 1 is the Limits tab, marker 2 the Daily loss limit field, marker 3 the Advanced part, marker 4 the Save risk limits button.
1 Limits. 2 Daily loss limit (optional), in the account currency; empty means no limit. 3 Advanced: prices, spread and automatic stop. 4 Save risk limits.
  • Largest order (lots) and Largest position per symbol (lots) accept decimals, such as 0.50.
  • Open positions at most takes 1 to 50, Orders per minute at most 1 to 120 and Orders per day at most 1 to 100000. The dashboard shows the range under each field.
  • Advanced holds the oldest usable price in milliseconds, the widest spread in points (optional), and Automatic stop after refused orders: this many refused orders within a minute turn trading off.
  • A badge “Not saved yet: demo defaults filled in” means nobody has saved limits for this account yet.
  • There is no unlimited setting, except an empty daily loss limit or spread.

A route can also have its own limits. They are set on the Routes tab. See routes.

11. Rules on one route

To see what applies to one route, open the account’s Routes tab and choose Risk rules under the route’s name.

The Routes tab with a table of routes. Marker 1 is the Risk rules link under the first route.
1 Risk rules under the route name.
The risk view of one route with sections Rules, Guards and Whole policy. Marker 1 is the All routes link, marker 2 the Rules assigned to this route heading, marker 3 the Account-wide rules heading.
1 All routes goes back. 2 Rules assigned to this route: add, edit and delete them here. 3 Account-wide rules: they apply to this route too and are changed on the account’s Risk tab.

The route view has only Rules, Guards and Whole policy. Limits and Hours and news belong to the account. A rule you add here is assigned to this route and counts only its orders and positions. An order on a route must pass the route’s rules and every account-wide rule.

12. Trading hours, market close and news

Open Hours and news. Time rules decide when new positions may open. They need risk mode: if the account is not in risk mode, a notice says Time rules need risk mode and a rule cannot be saved. They apply to orders sent through the platform. Other Expert Advisors and manual trading in the terminal are not stopped.

The Hours and news section with three existing time rules. Marker 1 is the Hours and news tab, markers 2 to 4 are the buttons Trading hours, Market close and News window, marker 5 is the Change button of the first rule.
1 Hours and news. 2 Trading hours. 3 Market close. 4 News window. 5 Change; Delete is next to it.

Every time rule has a Name and an optional Only these symbols field (broker symbols separated by commas; empty means everything the rule covers). An account can have up to 20 time rules.

Trading hours

  1. Choose Trading hours, then type a Name such as Office hours.
  2. Set Clock. broker follows the broker’s server clock. Or type a time zone such as Europe/Berlin, which follows daylight saving.
  3. Tick the days of the first window and set From and To as HH:MM. A window that ends before it starts crosses midnight, and 24:00 is the next midnight. Add a window adds another (up to 14). Remove window deletes one.
  4. Decide what happens when the rule blocks (section 13), then choose Save.
The trading hours editor with the name Office hours, the clock Europe/Berlin and a Monday to Friday window from 09:00 to 18:00. Markers point to the name, clock, days, From time, the close positions checkbox and Save.
1 Name. 2 Clock. 3 The days of the window. 4 From and To. 5 Close open positions before the block. 6 Save.

New orders outside the windows are refused with risk_outside_trading_hours.

Market close

  1. Choose Market close and type a Name.
  2. In Which close, choose Weekly close (the weekend) or Daily close (every break of the symbol’s trading sessions). Times come from the broker’s sessions.
  3. Set Block new orders before it (minutes), 0 to 240.
  4. Choose Save.
The market close editor with a weekly close, 30 minutes of blocking, and the close positions and cancel pending orders checkboxes. Markers point to the name, the close type, the minutes, the two checkboxes and Save.
1 Name. 2 Which close. 3 Block new orders before it (minutes). 4 Close open positions before the block. 5 Cancel pending orders while it blocks. 6 Save.

Orders are refused with risk_market_closing until the market opens again.

News window

News comes from the economic calendar built into MetaTrader 5. A news rule blocks new orders from some minutes before to some minutes after an event.

  1. Choose News window and type a Name.
  2. In Which news, choose All events of the chosen impact (then pick High impact or High and moderate impact) or Only these events (see the next part).
  3. Set Currencies. auto uses the currencies of the symbol being traded. Or type codes such as USD, EUR.
  4. Set Block before the news (minutes) and Block after the news (minutes), 0 to 240 each. Both start at 15.
  5. Set Events without an exact time: Block the whole day or Ignore them. The calendar lists some events by date only.
  6. Choose Save.

Orders are refused with risk_news_window while the window is open.

Choose exact events with the event picker

Use Only these events to react to the events you choose, such as central bank rate decisions, and ignore the rest. A chosen event counts whatever its impact, for the currencies you set.

  1. In the news editor, set Which news to Only these events.
  2. Under Find events in the economic calendar, type part of a name in Search events, for example Rate. You can also narrow the list by Currency and Minimum impact.
  3. In the list, choose Add next to each event you want. The button changes to Added and the event appears under Chosen events. Choose the cross on a chosen event to remove it.
  4. Choose Save. The rule cannot be saved without at least one chosen event.
The news editor set to Only these events. Marker 1 is the Which news choice, marker 2 the Chosen events list with one event, marker 3 the Search events box, marker 4 the Added button of the chosen event.
1 Which news: Only these events. 2 Chosen events (up to 50). 3 Search events. 4 Add turns into Added.
  • The list needs a running terminal with a calendar. If it cannot load, a notice says so and offers Retry. Events you chose before stay and can be removed.
  • You can choose up to 50 events. For more, make a second rule.
  • The list can show Load more. The search covers the first 20 000 events of the calendar, so narrow it if the event you want is missing.

13. Close positions and cancel orders around the block

At the bottom of every time rule, under When the rule blocks:

  • Close open positions before the block is on by default. Set how many minutes before (1 to 240, 10 by default): before a window ends, before the market closes or before the news. Every position in the rule’s scope is closed, and on a rule for the whole account that includes positions that were not opened through the platform. Turn it off if you do not want positions closed.
  • Cancel pending orders while it blocks is on by default. A pending order left in place can fill when the price jumps during the block.
  • Raise an alert when the rule leaves positions open or cannot decide is on by default. The alert goes to the channels set up under Notifications, Rules. See alert notifications.

A sentence under the checkboxes spells out the timing, for example “New orders are blocked from 30 min before the close; closing starts 10 min before the close.” Read it before you save.

Time rules never latch: the block ends when its window ends. They never refuse an order that closes a position. When a time rule cannot decide, for example because the news calendar is more than 30 minutes old or a symbol’s sessions are unknown, it refuses new orders instead of guessing (risk_news_unavailable, risk_sessions_unavailable).

Below the rules, What the host reports (shown when the account is in risk mode) lists for each rule its state, the next block, when closing starts, and what it would do now, such as “5 positions to close, 0 pending orders to cancel”. Check it after you save.

Important. Broker session tables do not list holidays or early closes, and a news event missing from the terminal’s calendar cannot be seen. Do not rely on a time rule alone on those days.

14. What blocks until when

When a rule with a period trips, it latches: it keeps blocking new orders until the end of its longest period in the broker’s server time, even if the figure drops back. Each rule says so in words.

RULEBLOCKS NEW ORDERS
Loss, Per dayUntil the broker’s midnight (00:00).
Loss, Per weekUntil the end of the week. The week starts on Monday 00:00.
Loss, Per monthUntil the 1st of next month at 00:00.
Orders, Per minuteUntil the end of that minute.
A day and a week criterion in one ruleUntil the end of the longest period, the week.
Open positions, Net volume, Orders in flightOnly while the condition is true. It does not stay tripped.
Order volume, Price age, SpreadRefuses each order it is true for. It does not stay tripped.
Time rulesNever latch. The block ends when the window ends.

Because the broker’s clock decides, a daily rule resets at the broker’s midnight, which may be a different hour from yours.

Important. The dashboard does not show which rules are latched and cannot clear a latch. Clearing is available through the API only. It needs a dashboard sign-in and the permission to configure trading, and it is audit-logged. It closes nothing, and the rule trips again at once if its condition is still true. The calls are in Writing a rule.

15. What is not available yet

  • Close positions when a rule or limit trips. The form shows Block and close positions greyed out with “Closing positions is not available yet.” Rules and limits only block new orders. Only time rules close positions, before a window ends, a market close or news.
  • Alerts for rule and limit trips. Raise an alert when it trips is saved with the rule (it is on by default for profit and loss rules), but trip alerts are not raised yet. A tripped rule shows as a refused order and in the account’s events. Time rules do raise alerts.
  • Showing and clearing latches in the dashboard. API only, see section 14.
  • Showing which revision the server has applied.
  • Choosing risk mode in the New deployment form.
  • Real accounts. Only demo accounts are accepted, and the engine is not yet verified against a real broker’s demo server.

16. Read the whole policy

Open Whole policy to see everything in one place: the guards, then your rules, each written as an expression. A rule with several criteria is put in brackets. Rules are joined by ||, which means that any tripped rule blocks. This is the saved revision, not proof that the server has applied it.

The Whole policy section listing the guards and then the account's rules as expressions. Marker 1 is the Whole policy tab, marker 2 the list of your rules.
1 Whole policy. 2 Your rules as one expression, joined by ||.

17. If something looks wrong

  • No Add rule button, or Edit and Delete are missing. You can read the account but not configure it. Ask an administrator for the trading configure permission.
  • Add rule is greyed out. The policy has not loaded fresh, or the account already has 50 rules.
  • “Your rules are stored, not checked on this account”. The deployment is not in risk mode. Rules and time rules block nothing until it is.
  • The expression is refused. Each value must be a whole number without a decimal point, in the unit explained in section 6. Names with a dash go in brackets, for example strategy[“mean-rev.v2”].
  • A rule seems to keep blocking. It has probably latched. See section 14 for when it ends.
  • Orders refused with risk_policy_pending. A saved revision is not yet applied on the server. Wait a moment, then try again.
  • Your save is refused after a long edit. Someone else changed the policy. Cancel and edit again.

Related: Writing a rule (measures, units and the API), How risk rules work, routes, trading accounts and alert notifications.

Was this page helpful?