Research by conversation
Ask the agent to investigate markets, companies, filings, strategies, and your connected account context.
Automated trading risk-control guide
Define limits before deployment, reject orders that violate them, monitor broker state continuously, and make stopping and recovery explicit parts of the strategy design.
Ask the agent to investigate markets, companies, filings, strategies, and your connected account context.
When direct trading is enabled, request a one-time trade in plain English, inspect the order, and approve it before submission.
Create, revise, backtest, connect, and operate Lumibot strategies without assembling the full application stack yourself.
Work in BotSpot or connect through ChatGPT, Claude, Cursor, Codex, and other compatible MCP clients.
One exit rule cannot control every failure. Strategy risk covers how much one idea may lose. Portfolio risk covers combined positions, correlations, leverage, and concentration. Operational risk covers incorrect data, duplicate orders, rejected orders, disconnects, stale state, and software defects.
Write limits at each layer before deployment. Broker and exchange protections remain valuable backstops, but they do not replace controls inside the strategy.
No single position-size percentage fits every strategy or account. Define a maximum order quantity or notional value, maximum position exposure, and maximum combined exposure using documented capital and tested strategy behavior.
Include existing positions and working orders when calculating exposure. Otherwise, several pending fills can individually pass a check while jointly breaching the intended limit.
Broker-reported buying power describes what an account may currently submit. It does not define a prudent strategy allocation. Margin can magnify losses, create maintenance calls, and allow broker liquidation under changing house requirements.
Read current account state before opening risk, reserve capacity for adverse movement and working orders, and stop submitting new exposure when margin or buying-power data is missing or stale.
Pre-trade controls should block an order before it reaches the broker when required data is unavailable or a declared limit would be exceeded. Sending an unsafe order and attempting to cancel it afterward still leaves execution risk.
Apply controls to every order path, including retries, replacements, exits, scheduled actions, and manually triggered strategy operations.
Daily-loss and peak-to-trough drawdown controls need an explicit data source, calculation method, threshold, action, and reset process. A threshold cannot protect an account when equity, realized profit and loss, or open-position values are stale.
When a loss control triggers, block new risk first, identify outstanding orders, reconcile positions, notify the responsible operator, and require a deliberate recovery decision. Do not silently reset a breached control because the clock changed or the process restarted.
A submitted order is not a completed trade. Monitor acknowledgements, fills, partial fills, rejections, cancellations, expirations, and replacements. Compare internal state with broker open orders, positions, balances, and buying power.
Streaming updates reduce delay, but reconnects and missed messages require periodic reconciliation against broker state. Missing confirmation should create an unknown state, not permission to submit another order.
A kill switch should have defined scope and observable confirmation. Blocking new orders, canceling working orders, stopping strategy evaluation, and closing positions are different actions. Closing positions automatically can introduce new execution and liquidity risk.
Design the safest supported stop sequence for each broker and market. Confirm cancellation and current positions through broker state, then keep new order entry disabled until the cause is understood and recovery checks pass.
Test risk controls independently from expected strategy behavior. Simulate stale data, extreme prices, malformed quantities, duplicate signals, partial fills, order rejection, disconnects, restarts, rate limits, and unavailable broker services.
Keep code, configuration, tests, and control parameters versioned. Deploy material changes with limited exposure and heightened monitoring before considering broader use.
Risk controls can reduce selected failure modes; they cannot guarantee a maximum loss or profitable result. Markets can gap, orders can partially fill, liquidity can disappear, brokers can reject actions, and infrastructure can fail.
Regulatory materials cited here describe obligations or practices for regulated firms and trading venues. They provide useful control-design evidence, but this guide does not determine which legal requirements apply to a particular person, strategy, broker, or jurisdiction.
Start with maximum order and position exposure, allowed instruments and order types, fresh-data checks, duplicate-order protection, broker-state reconciliation, monitoring alerts, and a tested stop process. Exact thresholds depend on strategy, account, products, broker, and risk tolerance.
No. A triggered stop order may become a market order and execute away from its stop price. Gaps, volatility, liquidity, slippage, and partial fills can produce a larger loss.
Its behavior must be explicit. Common actions include blocking new orders, canceling working orders, and stopping strategy evaluation. Closing positions is a separate trading decision that can create additional execution risk.
Yes. Brokers apply current buying-power, margin, permission, asset, session, price, quantity, and regulatory checks. Strategy controls should treat rejection as a state to reconcile, not a signal to retry indefinitely.
Sources verified 2026-08-14.
Past performance does not guarantee future results. Automated trading involves risk of loss.