Unacceptable exposure
The client wants to close several positions without waiting for their normal exit rules.
Reference guide · Support Bots
When and how to use this exceptional tool, what safeguards it checks, and why every closure must be confirmed at IBKR.
An exceptional operation to reduce unwanted market exposure quickly.
Emergency Close allows the client to request closure of open positions on the configured Interactive Brokers account when the normal portfolio lifecycle no longer meets an immediate need. It does not select new stocks and does not replace Entry Bot for entries or Risk Bot for protection management.
This is an exceptional, manually initiated action from Control Center. It can have irreversible financial consequences: closed positions do not automatically reappear in the portfolio.
Remember: an emergency close is not a pause button. It submits actual market orders to IBKR.
Reserve it for circumstances requiring immediate risk reduction.
The client wants to close several positions without waiting for their normal exit rules.
A verified issue justifies a liquidation decision after reviewing actual open positions.
The client chooses to liquidate during the session, understanding potential costs and execution risks.
A temporarily unavailable monitoring screen, an unrealized loss, or simple uncertainty does not by itself justify liquidating a portfolio. Review the situation and contact Support if necessary.
Do not confuse closing holdings, blocking new entries, and adjusting protective orders.
| Need | Appropriate component | Practical meaning |
|---|---|---|
| Prevent future purchases | Trading Mode NONE | Blocks new entries while existing positions remain managed. |
| Manage TP, SL, and trailing | Risk Bot | Maintains protective orders according to active rules. |
| Exceptionally replace TP/SL orders | Emergency TP/SL Override | Changes protection orders; does not request full liquidation. |
| Close positions immediately | Emergency Close | Submits liquidation requests subject to the safeguards below. |
Important: these tools have different objectives. Emergency Close is not the right choice merely to disable new buys.
A Support Bots function started deliberately by the client.
Under Support Bots → Emergency Close, Control Center shows the procedure status and the configured IBKR account’s open positions. The user can refresh the position list, choose which positions to close, and review execution status.
There is no need to use a command line, edit configuration files, or run a program directly on the VPS.
The same VPS can be connected to the selected IBKR environment.
PAPER simulates orders, whereas LIVE involves actual transactions. Emergency Close is not inherently restricted to PAPER: LIVE execution is possible when operationally authorized.
Always verify the active IBKR environment and the account shown before approval. Do not assume an operation is simulated merely because it starts from a test VPS or a familiar screen.
Real financial risk: in LIVE, market orders can realize losses, incur fees, and execute at prices different from those displayed.
Only during regular market hours confirmed by IBKR.
The bot checks the general 9:30 AM–4:00 PM New York time window along with actual liquid trading hours returned by IBKR. It performs a pre-intervention check and checks the relevant instruments again as they are processed.
A holiday, early close, or unconfirmed contract schedule may prevent an operation even during the typical clock window. This procedure does not permit outside-RTH execution.
Actions depend on verifiable conditions, not assumptions.
If status information is missing, ambiguous, or invalid, the bot refuses the operation instead of assuming the system is healthy.
Two different scopes, both requiring explicit approval.
Choose one to five distinct positions for targeted closure.
The “All positions” option targets all open holdings visible in the configured IBKR account.
A dialog summarizes the number of holdings, their symbols, and quantities before confirmation.
The five-position limit applies only to selected mode. It does not cap the number of positions when “All positions” is used.
A read-only preview, not a locked reservation of holdings.
Refresh positions requests an up-to-date IBKR snapshot via a separate read-only connection. Positions are identified by the broker’s contract identity to distinguish instruments accurately.
The snapshot may become stale if another trade fills between preview and execution. Emergency Close therefore checks positions again after approval and refuses a selection that is no longer coherent.
Human approval before any liquidation orders.
Control Center presents a confirmation dialog containing the intended symbols and quantities. The user may cancel or choose “I confirm”. Approval is passed to the execution component with an internal confirmation tied to the account and chosen scope.
Do not confuse: confirming the request permits execution checks and orders to begin. It does not certify execution prices, final filled quantities, or closure of every position.
Prevent concurrent coordinators from controlling the same account.
The operation acquires an exclusive lock and publishes Emergency_in_progress. A second operation cannot start while another one is underway or an earlier unresolved state remains.
Other ecosystem components consult this state to avoid incompatible actions. If something fails, the status can remain Emergency_failed until reconciliation and controlled recovery.
Prevent Risk Bot from rebuilding protections during liquidation.
Before taking control, the coordinator requests Risk Bot to stop and verifies that it is no longer running. It then temporarily handles the relevant order operations through a controlled IBKR connection.
If Risk Bot remains running or restarts during the emergency, the unsafe stage is refused. Stopping Risk Bot does not mean its existing IBKR protective orders have disappeared; these require separate checks.
Avoid stacking liquidation orders on still-active protective orders.
For each holding, Emergency Close locates associated open IBKR orders, requests their cancellation, and checks that no relevant order remains active. If order ownership is ambiguous or cancellation cannot be confirmed, the bot refuses to send a liquidation order for that holding.
This procedure is repeated per instrument, reducing the chance that an existing take-profit, stop-loss, or trailing order conflicts with the new closing order.
Sensitive interval: between confirmed cancellation of protections and actual closure, the position may remain exposed to market moves. Emergency operation does not eliminate that risk.
MARKET orders sized to the actual position.
Once checks succeed for a position, the bot submits a MARKET order valid for the trading day and restricted to regular hours. It sells a long position or buys back a short position.
It verifies the IBKR contract and current position quantity before submission. MARKET orders prioritize execution but do not guarantee price; slippage can be substantial in fast markets.
Check each symbol separately without waiting for every prior fill.
Account, contract, trading session, and quantity are checked.
Associated protective orders are canceled, and their absence is verified.
The symbol’s liquidation order is submitted and its identity is recorded.
Another holding can be prepared while an earlier submitted order is still filling.
All holdings and orders are inspected after the observation window.
This is neither blind simultaneous submission nor strict completion of one instrument before proceeding. Each holding has its own cancellation proof before its close order.
A lost API response does not prove IBKR never received the order.
The program records order intent before sending it. If IBKR’s response is uncertain or the connection drops, it does not assume failure and does not submit another MARKET order blindly for the same instrument.
Replaying an uncertain close could over-trade or even open the opposite position. Orders, executions, and remaining positions must first be reconciled against broker records.
Different outcomes require different follow-up checks.
| Situation | How to interpret it |
|---|---|
| Submitted but still active | The holding may continue changing; “Submitted” does not mean “closed.” |
| Partially filled | A residual quantity may remain and require protection or a controlled intervention. |
| Rejected | The broker may leave the position unchanged; review the rejection and remaining protection. |
| Connection lost | No API response does not establish that no trade occurred; prioritize broker verification. |
| Position flat, no active order | Necessary condition for confirmed closure of that instrument. |
Avoid: do not immediately run Emergency Close again just to “finish” without checking what remains live at IBKR.
No residual holding and no associated active order at the broker.
After monitoring, the bot refreshes IBKR positions, open orders, and executions. A holding is recorded as FLAT_CONFIRMED only when the broker shows no residual position or active order for that instrument and its order submission was not left uncertain.
The full operation is marked completed only after every requested holding is reconciled. A submission acknowledgment alone is insufficient.
Three primary conditions, with particular attention to blocked states.
| Displayed status | Practical meaning |
|---|---|
| No Emergency Procedure in Progress | The current status does not indicate an active emergency. |
| Emergency Procedure in Progress | Liquidation is being prepared, submitted, monitored, or reconciled. |
| Emergency Procedure Failed — Recovery Required | A step failed or outcome is uncertain; reconciliation is required. |
| Emergency Status Invalid / Unavailable | The system cannot establish safe status and dependent actions remain blocked. |
Control Center can show a count of confirmed closed holdings against requested holdings. An incomplete count does not prove remaining orders were canceled.
Reconcile actual broker state before considering another action.
Changed quantities, unconfirmed cancellations, IBKR errors, disconnections, or unresolved closures may result in Emergency_failed. This state preserves evidence that the intervention was not fully verified.
Resetting an emergency status must never be used to conceal unknown executions or open orders.
Block new entries during an active or unresolved emergency.
Entry Bot checks the shared emergency status before new entry submissions. While an emergency is active, failed, or unreadable, new entry submissions are blocked rather than treated as safe.
This safeguard does not manage IBKR orders already submitted before the emergency: they may still change status. Emergency Close is not a universal cancellation of every outstanding entry order.
Allow Risk Bot recovery only after a safe release of emergency control.
Watchdog respects emergency status and avoids restarting Risk Bot while Emergency Close controls the process. After a successful operation releases its emergency state, Watchdog may resume normal supervision.
Following failure or ambiguous status, never assume Risk Bot has restarted or residual holdings are protected. Review the real broker and service state.
Record actual broker events without inventing executions.
Emergency Close records an operation reference, intended orders, and executions received from IBKR. Broker order and execution identifiers support later reconciliation, including potentially delayed fills.
These records support audits and diagnosis. They do not replace broker statements, and the bot does not directly fabricate missing Trade Register entries.
An illustrative “Selected positions” workflow.
A client sees three holdings whose exposure is no longer acceptable. They refresh positions, select the three stocks, review quantities, and confirm.
For each holding, the system checks IBKR state, cancels and verifies protection orders, and submits a market close order. The final reconciliation may report three holdings closed out of three.
If even one remains open, the overall procedure is not confirmed successful; the broker state must be checked before acting again.
A broader operation does not bypass safety checks.
The client selects “All positions” on an account with many holdings. The interface summarizes the visible holdings and asks for explicit approval.
The program attempts to handle instruments independently. A failure on one symbol does not erase orders already submitted for another.
Even if most holdings are closed, any residual contract, uncertain order, or disconnection requires reconciliation: “close all” does not promise immediate 100% fills.
A conservative system may refuse action when evidence is insufficient.
The tool depends on IBKR connectivity, permissions, contracts, trading hours, and confirmations.
Liquidity and volatility affect the actual execution price.
Ambiguous status or unconfirmed cancellations can block unsafe actions.
Behavior described here was inspected in the supplied code; no LIVE liquidation certification is claimed on this page.
Limit unsafe interventions and preserve useful diagnostics.
If the objective is simply to prevent new purchases, use the appropriate Trading Mode instead of liquidation.
Direct answers before a potentially irreversible action.
Yes, using “All positions.” The limit of five applies to selected mode only.
No. The bot requires regular US trading hours and verified IBKR liquid hours for the instruments.
No. The final execution price and timing depend on market conditions and IBKR.
No. Service state and actual protections must be independently reviewed when holdings remain or the procedure failed.
No. LIVE execution is possible when authorized, with real financial consequences.