Algo trading risk management: a practical guide
Risk management for an algorithm means hard limits built into the system: a fixed small risk per trade sized from the stop, a leverage cap, a stop on every position, circuit breakers that halt after consecutive losses, a daily loss cap, and alerts when data or margin fails. They bound the ways a strategy can fail. They do not create an edge and they cannot prevent loss.
Key takeaways
- An algorithm will keep following its rule after the rule has stopped working. The limits have to be built in.
- Sizing matters more than entries. Risk a fixed small fraction of capital per trade, sized from the stop.
- A stop bounds a trade's risk but does not guarantee its exit price.
- A circuit breaker and a daily loss cap bound the damage from the strategy continuing.
- Plumbing failures such as stale data are a separate risk, and often the more dangerous one because they look like working.
Why does an algorithm need hard limits?
A discretionary trader having a terrible day eventually gets up and leaves. An algorithm does not. It will take the setup it was told to take, at the size it was told to use, for as long as it runs, and it has no idea the market regime it was built for ended on Tuesday.
The real risk in automated trading is rarely one catastrophic trade. It is a strategy that kept going: a run of losses that compounded, a position that grew because sizing scaled with equity, a data feed that stopped updating while signals kept firing. Every control below puts a floor under one of those.
Layer 1: size every trade from the stop
Position sizing is deciding how large each trade is. The common, sound method risks a fixed percentage of equity per trade: divide the money you are willing to lose by the distance to the stop, and the answer is the size. A wider stop therefore means a smaller position, so every trade risks the same amount regardless of the setup.
Check the sizing against the worst case, not the average. If ten losses in a row is plausible for the strategy, work out what that does at your chosen risk. Then include costs: when the stop is tight, fees and slippage are a large fraction of the risk and belong in the sum. AKQX sizes with fees in mind, and a fee-to-risk breaker refuses trades where estimated cost is large next to the risk taken.
Layer 2: a stop on every position, and a sensible one
A stop loss is a decision made in advance, which is its value: it removes the temptation to hold a loser in the hope it recovers. Place it from the market, such as beyond a recent swing or a multiple of average range, not from the loss you would like to take.
Too tight and routine noise or the spread takes you out before the idea has a chance. AKQX enforces a minimum stop distance for exactly this reason. Remember what a stop does not do: in a gap or a fast market the fill can be worse than the level, so a stop is not a guarantee of the maximum loss.
Managing the open position is part of the same layer. A trailing stop protects a gain as price advances, and a partial take profit banks part of a position while the rest runs. Both change the distribution of outcomes, and both should be backtested rather than assumed to help.
Layer 3: cap the leverage
Leverage scales both gains and losses on the same move. With 10x, a 1% move changes your equity by 10%, and a 10% move the wrong way erases the margin. It does not change whether a strategy has an edge, so treat it as a risk limit and not a performance dial.
Work backwards from the loss you can tolerate. Find how far price has to move against you before the position is closed out, and compare that with a normal swing on your timeframe. If an ordinary swing could liquidate you, the leverage is too high for the strategy whatever its edge. AKQX applies a maximum leverage cap to every strategy, including in paper trading.
Layer 4: make the strategy stop itself
A circuit breaker halts the strategy when a limit is hit, then waits through a cool-down before allowing it to resume. The usual triggers are a number of consecutive losses and a total loss for the day. The cool-down matters as much as the stop: without it, a halted strategy re-enters on the very next signal, which is the same conditions that just failed.
A daily loss cap is the same idea over a day. Set it relative to your typical daily range, so ordinary bad days do not trip it but a runaway day does, and express it as a percentage so it scales with the account. Decide in advance whether open losses count as well as realised ones.
Layer 5: watch the plumbing
A separate class of risk has nothing to do with strategy quality. Market data can go stale, a broker balance can stop updating, an order can be rejected, margin can run short. The most dangerous of these is stale data, because a strategy acting on prices that stopped moving looks like it is working.
AKQX skips a signal rather than trading on prices it knows are old, and sends Telegram alerts for stale data, rejections and margin or capital problems. For real crypto trades, positions are reconciled against the exchange's own records rather than assumed. These are operational safeguards: they tell you something is wrong, not what to trade.
A worked example, with made-up numbers
Illustrative only. An account of 1,00,000 risks 1% per trade, so 1,000. A setup has its stop 20 points away, giving a size of 50 units. If the next setup has a 40-point stop, the size halves to 25 units and the risk stays at 1,000.
Now stress it. Ten consecutive losses at 1% each leave the account near 90,400, a fall of roughly 9.6%, because each loss is taken from a slightly smaller balance. At 5% per trade the same ten losses leave about 59,900, a fall of around 40%. The strategy and the entries are identical. Only the sizing differs, and one of the two accounts is in serious trouble. A breaker set to halt after four losses would have stopped the first account at about 96,100 and the second at about 81,500 and given you a chance to look at what changed.
What these controls will not do
- They will not make a losing strategy profitable. Risk management limits damage, it does not create an edge.
- They cannot prevent loss, and they offer no protection against market gaps, exchange outages or a strategy that was simply wrong.
- They can occasionally stop a strategy just before a recovery. That is the price of the protection.
Test them before they matter. Run the guards in paper trading and see which one trips first, so you learn whether the rule or the strategy needs changing while the money is virtual.
A reminder about what this is. AKQX is software only. It is not a SEBI-registered Investment Adviser or Research Analyst and gives no investment advice, and the risk figures above are examples, not recommendations. Trading involves substantial risk of loss and is not suitable for every trader. Crypto products are unregulated and can be highly risky.
Questions about algo trading risk management
What is risk management in algorithmic trading?
It is the set of hard limits that stop one bad trade, one bad day or one broken data feed from doing disproportionate damage: how much to risk per trade, where the stop sits, how much leverage is allowed, and when the strategy must stop itself. It limits damage. It does not create an edge.
How much should I risk per trade?
There is no universally correct figure, and nobody can responsibly give you one without knowing your situation. What matters is that it is a fixed, small fraction of capital, decided in advance, and sized from the stop distance, so a long losing streak is survivable. Work out what ten losses in a row would do to your account.
Why do algorithms need circuit breakers?
A person on a bad day eventually walks away. An algorithm does not. It keeps taking the setup it was told to take for as long as it runs, even after the conditions it was built for have gone. A breaker puts the walking away into the system.
Does a stop loss guarantee my maximum loss?
No. A stop converts an open-ended risk into a bounded one, but the exit price is not guaranteed. In a gap or a fast market the fill can be worse than the stop level, which is why position size and a daily loss cap matter as well as the stop itself.
Is leverage a risk setting or a performance setting?
A risk setting. Leverage does not change whether a strategy has an edge. It scales the consequences of being wrong, including the chance of being closed out before a trade has time to work. That is why AKQX applies a maximum leverage cap to every strategy.
What risks are not covered by these controls?
Market gaps, exchange outages, a strategy that was simply wrong, and a regime change. Risk controls bound certain ways of failing. They do not make a losing strategy profitable and they cannot prevent loss.
Keep reading
Test a strategy with the guards switched on
A free account includes 1 paper algo and 10 backtests a month, with every risk control active.