TradeLabs AILearn

Risk Controls and Kill Switches

Pre trade risk checks and kill switches stop a trading algorithm before a bug becomes a disaster. Learn the essential limits, how to layer them and how to test them.

Intermediate3 min readUpdated 3 Oct 2026
Markdown
Lesson 6 of 11

An algorithm can send thousands of orders before a human notices anything is wrong. Risk controls are automatic checks that sit between the strategy and the market, blocking orders that break predefined limits. A kill switch is the emergency brake: a way to stop all trading, cancel open orders and, if needed, flatten positions immediately. Regulators require broker dealers to have such controls; in the US, the SEC's Market Access Rule (Rule 15c3-5) requires firms with market access to have pre trade risk controls. Individual traders running bots need the same thinking on a smaller scale.

Layers of protection#

LayerWho runs itExamples
Strategy levelYour own codePosition limits, signal sanity checks
System levelYour order gatewayOrder size, rate and daily loss limits
Broker levelYour brokerBuying power checks, credit limits
Exchange levelThe exchangePrice bands, limit up and limit down, circuit breakers. See Trading Halts and Circuit Breakers

Never rely on only one layer. Your own controls should trigger well before the broker's.

Essential pre trade checks#

CheckBlocks
Maximum order sizeFat finger errors, such as 10,000 shares instead of 100
Maximum positionRunaway accumulation from repeated orders
Price collarOrders far from the current market price
Order rate limitLoops that send orders too fast
Daily loss limitContinued trading after large losses. See Maximum Trade Risk and Daily Loss Limits
Gross and net exposureToo much total risk
Duplicate order detectionRepeated identical orders within seconds
Allowed instrumentsTrading symbols the strategy should never touch
Stale data checkTrading on prices that stopped updating

Designing a kill switch#

A good kill switch:

  • Is fast: one command or button, no navigation.
  • Works when the strategy is broken: it runs separately from the strategy code.
  • Cancels all open orders first, then optionally closes positions.
  • Blocks restart until a human reviews and re-enables trading.
  • Triggers automatically on breaches such as the daily loss limit or a rate limit.
  • Logs everything for later review. See Logging, Audit Trails and Incident Response.

Setting limit levels#

LimitStarting point
Order sizeNo larger than the biggest order the strategy should ever send
PositionSlightly above the maximum intended position
Daily lossA level that matches your risk plan, such as 2% to 3% of the account
Price collarA few percent from the last price for liquid stocks; wider for volatile assets
Order rateWell above normal activity but far below runaway levels

Review limits regularly and whenever the strategy or account size changes. See Risk, Position, Loss and Drawdown Limits.

Testing the controls#

Controls that are never tested may fail when needed. Test them in a paper or test environment by deliberately sending orders that should be blocked, simulating a loss breach and pressing the kill switch. Repeat after every major code change.

Lessons from Knight Capital#

In August 2012, Knight Capital lost about $440 million in roughly 45 minutes after a faulty deployment. The SEC later found that Knight lacked adequate controls to prevent erroneous orders and did not have procedures to respond quickly. The firm was fined $12 million under the Market Access Rule. Strong pre trade limits and a fast kill switch could have reduced the damage. See Lessons From Market Failures.

Frequently asked questions#

What is a kill switch in trading?#

An emergency control that immediately stops an algorithm, cancels its open orders and can close its positions.

What risk controls should a trading bot have?#

At minimum: maximum order size, maximum position, price collars, order rate limits, a daily loss limit, stale data checks and a kill switch.

Do brokers provide risk controls?#

Yes, brokers run their own checks, but they are usually loose. Your own controls should be tighter and trigger first.

Next, learn how to move a strategy safely from testing to real money in From Backtest to Live: Paper, Shadow and Canary.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonFrom Backtest to Live: Paper, Shadow and CanaryWhy live results almost always trail backtests, how to measure the gap, and a staged plan for taking a strategy from backtest to paper trading to real money.

Mentioned in