Skip to main content

Alerts & breaches

Who it’s for
Users with a strategy running that has stopped entering positions
Assumes
You have read The nine order gates

A gate tripping is not an error. It is the system doing what you configured it to do. This page covers what you see when it happens, how to tell which gate it was, and how trading resumes.


What a breach looks like

When a validator blocks an order, it produces a violation carrying four things:

FieldExample
Ruledaily_loss_limit
Reason codeDAILY_LOSS_LIMIT_EXCEEDED
Current value-3,180.00
Limit-3,000.00

That shape is deliberate: you can always answer "which rule, and by how much" without inference. The message states both figures in the strategy's quote currency.

Violations appear on the strategy's risk panel and in its event timeline. If you have Telegram notifications enabled, they arrive there too. See Notifications.


The symptom you will actually notice

A gated strategy looks like a strategy that has stopped taking new trades while its open position continues. That is correct behaviour and it is worth recognising, because the instinct is to assume the strategy has broken.

If a running strategy is not entering:

  1. Check the risk panel for an active violation. This resolves it most of the time.
  2. If there is no violation, check the trading window, the strategy may simply be outside its allowed hours.
  3. If the window is open and there is no violation, check whether the entry condition is actually true. A strategy with no signal is not a strategy with a problem.

How each gate clears

The distinction that matters: some gates clear by themselves, some clear when the day rolls, and some need you to act.

GateClears when
max_order_valueThe next signal produces a smaller order, nothing to clear
per_trade_riskThe next entry's stop distance × quantity fits the budget
max_open_positionsA position closes, freeing a slot
max_trades_per_dayUTC midnight
max_consecutive_lossesThe cooldown elapses, or a winning round-trip resets the streak
daily_loss_limitUTC midnight, or the day's realised P&L improves above the cap
mark_to_market_lossRealised + unrealised recovers above the limit
max_capital_allocationDeployed capital falls, a position closes
available_capitalCapital frees up, or you increase the allocation
UTC midnight, not market open

The daily counters roll at 00:00 UTC. For an Indian equity strategy that is 05:30 IST, inside the overnight gap, not at the 09:15 session open. A strategy that hit its daily loss cap at 14:00 IST resumes the following morning; one that hit it at 05:00 IST resumes half an hour later, mid-gap.


Cooldown

The consecutive-loss gate would otherwise deadlock: it blocks entries until a win, and a win cannot happen while entries are blocked. The cooldown resolves that by time-boxing the halt.

Configured asgates.cooldown_bars_after_loss
UnitBars at the strategy's own timeframe
Default when unset3 bars
Resumes atLast losing exit + (bars × timeframe)

A 5-minute strategy with the default sits out 15 minutes after tripping the streak cap. A daily strategy sits out three days.

Cooldown state is computed on every evaluation, never persisted. There is no stored pause to clear, no stuck state to reset, and restarting a strategy does not skip a cooldown that has not elapsed.


Resuming manually

Some situations you resolve yourself rather than waiting:

SituationWhat to do
The limit was set too tight for how the strategy actually tradesRaise the limit. It takes effect on the next order
The strategy is out of capital because positions are openWait for exits, or increase the allocation
The strategy is losing and you want it stoppedStop it, and close the open position at your broker, because stopping does not flatten
A market order keeps skipping the mark-to-market gateThat gate needs a price on the order. A market order with no price hint cannot be evaluated
Raising a limit to get past a breach

A gate tripping is information. Before you raise the limit, ask whether the limit was wrong or whether the strategy is behaving worse than you expected. Raising a daily loss cap because you hit it is how a bad day becomes a bad week.


What a breach does not do

It does notBecause
Close your open positionGates block entries only. Blocking exits would trap capital
Cancel working ordersExisting orders are not withdrawn by a later violation
Pause the strategy permanentlyEvery gate has a clearing condition
Unwind anything at the brokerStretus does not force-flatten from a risk gate

If a position needs to be closed, close it. The risk system's job is to stop the next order, not to unwind the last one.


Failure modes worth knowing

A gate that cannot evaluate skips. per_trade_risk skips when there is no stop price. mark_to_market_loss skips when a market order carries no usable mark. daily_loss_limit skips when allocated capital is unknown. In each case the gate declines to guess, which is right, and also means the protection is absent for that order.

A malformed configuration disables everything. The parser fails open. See Which limits are on by default.

Gaps do not respect gates. No gate acts between candle evaluations. A market that moves through your stop overnight has already moved.


Next