# Loss guards and limits

> What stops a strategy, and for how long.

Source: https://algobarsx.com/docs/guards/

- `max_daily_loss`: at each bar close, the day's closed profit plus open profit is compared with the limit. When it is reached, all trades close and pending orders are cancelled at the next bar's open, and new entries are rejected until the next UTC day.
- `max_drawdown` works the same way against the highest equity reached, and pauses the deployment until you resume it.
- `max_open`, `max_open_per_side`, `pyramiding`, `max_total_risk` and `min_distance` reject an entry, with a reason, at the moment it would fill.

The rule is [E20](https://algobarsx.com/docs/rules-strategy-controls/#E20). You can also write your own guard as an ordinary rule:

```algobarsx
when history.today.pnl < -(2% of account.balance) or account.margin_level < 150%: close_all
```
