PnD Protection
What it does
Detects unusually rapid chains of close fills and temporarily pauses the bot from reopening positions. This prevents the bot from chasing a sharp price move by repeatedly placing OPEN orders into a spike or flush. CLOSE orders continue to execute normally throughout. PnD protection is on by default.
How it triggers
The bot maintains a sliding window of recent close fills. If the number of close fills within the window reaches the threshold, the bot enters cooldown.
The default threshold is 8 close fills within 60 seconds.
| Config field | Default | What it controls |
|---|---|---|
closeFillsThreshold | 8 | Number of close fills that triggers cooldown |
withinSeconds | 60 | Size of the sliding fill window |
cooldownDurationMinutes | 14 | How long cooldown lasts (clamped 5–120 min) |
reconstructOnExpire | true | Whether to rebuild the grid when cooldown ends |
enabled | true | Master switch |
Fills at exactly the boundary of the window are included. The window prunes old fills automatically as time passes.
The cooldown timer does not reset if more close fills occur while already in cooldown. If 5 more fills happen during an active cooldown, the timer keeps counting from the original trigger. This prevents an extreme move from creating an indefinite pause.
What happens during cooldown
| What | Behavior |
|---|---|
| OPEN orders | Suppressed. When a CLOSE order fills, the bot normally places an OPEN order on the opposite side. During cooldown, those OPEN orders are skipped to avoid chasing the move. |
| CLOSE orders | Execute normally. The bot never blocks you from reducing exposure. |
| Grid reconstruction | Blocked until cooldown expires. |
| OPEN-side grid extension | Paused. CLOSE-side extension still runs. |
When cooldown expires, the bot reconstructs the grid from scratch around the current market price. This fills any coverage gaps created by the suppressed OPEN orders. If rebalancing is configured, the bot also runs deficit detection at expiry to account for position shortfall from the suppressed fills.
Interaction with other features
PnD cooldown takes priority over everything on the OPEN side. Even if Hedge Guard, Exo Indicator, and deficit rebalancing would all produce an amplified OPEN order, cooldown still blocks it. See Feature Priority for the full picture.
Tuning tips
The defaults are conservative and work well for most assets. If you need to adjust:
- Too many false triggers on a volatile asset: Raise
closeFillsThreshold(e.g.,12) or shortenwithinSeconds(e.g.,30). - Cooldown ends but grid feels stale: Ensure
reconstructOnExpire = true(default). This rebuilds coverage around the current price. - Want to disable entirely (not recommended for live trading): Set
enabled = false.