Protections: out of range, crash, margin, liquidation
A Grid bot regularly checks the price, the position and the orders, and in emergencies it pauses itself or closes. The protections are always on and cannot be configured, but they do not replace a Stop-Loss, a moderate leverage and a wide range.
How it works
| Protection | When it fires | What the bot does |
|---|---|---|
| Out of range | the price is more than 2 % beyond the bound and has moved more than 5 % from the middle of the range; checked about every 3 minutes | a soft pause, the orders stay; the status “Out of range (above)” or “Out of range (below)” |
| Automatic return | the price is strictly inside the range; checked every 60 seconds | the bot resumes by itself |
| Crash protection | 80 % or more of all levels are already in position (for Long — bought); checked about every 3 minutes; works on spot as well | a hard pause: all orders are removed, the sells included; the exit from the position comes after ▶️ Resume |
| Margin overload (futures) | the used margin of the whole account reached 80 % of its capital | a forced stop: the orders are cancelled, the position is closed at market, the status is “Closed” |
| Closeness to liquidation (futures, leverage above 1) | less than 15 % is left to the real liquidation price | the same forced stop |
| Position control (futures) | the position on the exchange is smaller than the expected one: closed or reduced outside the bot; checked about every 3 minutes | the exit orders are resized to the real position; when it is zero — the levels are released, the entry orders keep working |
| Exit restored | a level with a position has no sell order (for example, it was removed by hand) for two checks in a row, about 10 minutes | the exit order is placed again |
| Series of errors | 3 permanent refusals of the exchange in a row: not enough balance, a wrong lot, a key | a soft pause; after the cause is removed — ▶️ Resume |
| Order reconciliation | every 5 minutes the number of orders on the pair does not match the expected one | the missing ones are placed again; the extra ones are not touched |
| Safety stop (futures) | every 60 seconds, during a pause as well | a stop 0.5 % before the liquidation price; visible in Bybit → Positions → TP/SL, it is not your SL |
Account events: a change of the position mode on the exchange — a hard pause, “🚨 Position mode changed on the exchange” (see Position mode changed); a pair being delisted — a pause with “paused by the system”, and a full stop a day before the delisting; the kill switch — a hard pause of all running Grid bots (see Kill switch).
What the bot sends
Pauses and closes caused by the protections arrive immediately, in any notification mode:
- “⏸️ BTC grid (BTCUSDT) Grid bot paused. Reason: price 67500 went above the range (top 66000). Orders stay on the exchange; the bot resumes by itself when the price returns to the range, or recreate the grid” — there is no ▶️ Resume button in this status.
- “⏸️ … Reason: crash protection: 4 of 5 levels are already in position. All orders were removed, the position is open — check the market and tap 'Resume'”.
- “🔒 … Grid bot closed: used account margin 82 % reached 80 %. Orders cancelled, position closed at market. Total PnL: -4.10 USDT” — the same for “less than 15 % left to the liquidation price (liquidation ≈ 52000, price 59500)”.
- “⚠️ … The position for this pair was closed on the exchange outside the bot (expected 0.005, on exchange 0). Exit orders were removed, levels released, entry orders keep working. If this was not you, check your account.” — see Position closed outside the bot.
- “🔁 … The SELL exit order at level 60600 was cancelled on the exchange outside the bot — placed again.”
- “⏸️ … Reason: 3 consecutive order placement errors (last: …). Check the balance, API keys and settings, then tap 'Resume'”.
Example with a calculation
A Long grid 60,000 — 66,000, the middle of the range is 63,000.
| Price | Beyond the bound | From the middle | Result |
|---|---|---|---|
| 67,000 | 67,000 / 66,000 = +1.5 % | +6.3 % | no pause needed: less than 2 % beyond the bound |
| 67,500 | +2.3 % | +7.1 % | both conditions are met — “Out of range (above)” |
| 65,900 after the pause | inside | — | the automatic return within a minute |
Crash protection: in a grid of 5 levels 4 are bought — that is 80 %, the bot removes all orders and waits for your decision; in a grid of 20 levels it takes 16 bought levels.
Limits and allowed values
| Parameter | Value |
|---|---|
| Out-of-range threshold | 2 % beyond the bound and 5 % from the middle |
| Crash protection threshold | 80 % of the levels in position |
| Margin overload | 80 % of the account capital |
| Closeness to liquidation | less than 15 % |
| Series of errors | 3 refusals in a row |
| Safety stop | 0.5 % before the liquidation |
Common mistakes and what the bot says
- Manual orders on the same pair from the same keys break the order reconciliation — trade the bot's pair only through the bot.
- You removed a buy order by hand — it is not restored, the level stays empty; the bot brings a sell order back within about 10 minutes.
- “🔒 … used account margin…” on a bot with a small leverage — check the other positions on the same account: the margin is counted across the whole account.
