Risk Management for Algo Traders: Layers of Protection
Risk management layers for automated trading: per-trade stops, daily loss limits, max position size, trade limits, kill switch, monitoring and handling misbehaving automation.
In automated trading, risk management is not an add-on - it is part of the system itself. A computer can send hundreds of orders without stopping to ask whether something looks wrong. That is why it pays to build several layers of protection, so that if one fails, the next one stops the damage.
Why automated trading needs a different approach
For a manual trader, the last line of defense is the person: they see something strange and close it. In an automated system that brake is not always there. A duplicated alert can open a double position. A logic bug can cause repeated entries. A dropped connection can leave a position without a stop.
So think about risk on two levels: market risk - price moves against you, and operational risk - the system does something you did not intend. Good risk management deals with both.
Layer 1: a stop on every trade
The foundation is that every trade has a predefined exit in case it is wrong. A few principles:
- The stop should be sent to the broker as a real order, not just exist inside your code. If your system disconnects, an order resting at the broker still protects you.
- Place the stop based on structure or volatility, then size the position to fit the stop - not the other way round. See position sizing methods.
- Remember that a stop order becomes a market order, and in a fast market it may fill well away from the level.
Layer 2: a daily loss limit
Even with a stop on every trade, a string of losses on the same day can add up. A daily limit says: after losing a set amount, the system stops trading until the next day.
A hypothetical example: on an account risking $200 per trade, a $500 daily limit stops trading after two or three losses. If you trade with a prop firm, set your personal limit clearly below the firm's, leaving a safety margin for slippage and open positions. Details in daily loss limits explained.
Decide in advance whether the limit counts only realized losses or open losses too, and whether the system flattens existing positions when it hits the limit or only blocks new entries.
Layer 3: maximum position size
This is one of the most important defenses against bugs. Even if your logic calculates a dynamic position size, set a hard cap on the number of contracts that must never be exceeded, for any reason. If a garbled alert asks for 50 contracts instead of 5, the cap stops it.
It is worth setting a cap per direction (long or short) and on total exposure, especially if several strategies run on the same account or on correlated markets such as NQ and ES.
Layer 4: trade count and trading hours
- Maximum trades per day: a strategy that normally takes three trades a day and suddenly takes twenty is telling you something is wrong. A limit like this stops runaway loops.
- Time windows: restrict trading to the hours the strategy was tested on. Many traders also avoid entries around major data releases.
- Flatten before the session ends: if you do not intend to hold overnight, make sure positions close automatically before the end of the session. Some prop firms require this.
Layer 5: kill switch and monitoring
A kill switch is one fast, simple way to stop everything: cancel working orders, close positions and block new signals. Make sure you know exactly where it is and that it works from your phone too.
Monitoring includes:
- Notifications when a trade executes, when a limit is hit, or when there is an error.
- Regular comparison between what the system "thinks" is open and what is actually open in the account.
- A trade log that lets you check afterwards what happened and why.
What to do when automation misbehaves
When something looks wrong, the order of operations is:
- Stop: hit the kill switch. Do not try to fix things while the system is still trading.
- Verify: log in directly to the broker's platform and check open positions and orders.
- Close manually anything that should not be open.
- Document: save the alerts, logs and timestamps.
- Investigate the cause before restarting, then come back gradually, preferably through simulation.
Risk of ruin
Risk of ruin is the probability that a run of losses takes the account below the point where you can no longer continue - in a prop firm account, for example, the maximum drawdown level. Even a strategy with a real edge can hit a long losing streak by chance.
A hypothetical example: if you risk 25% of the allowed drawdown on each trade, four losses in a row end the account - and such a streak is an entirely ordinary event. If you risk 5%, it takes twenty consecutive losses. Small risk per trade does not remove risk, but it gives the strategy time to show whether it has an edge. More on drawdown in prop firm drawdown types.
Key takeaways
- Automated trading carries both market risk and operational risk, and you need to guard against both.
- Build layers: per-trade stop, daily limit, contract cap, trade-count and hours limits.
- A kill switch and monitoring are part of the system, not extras.
- When something goes wrong: stop, verify at the broker, close, document, and only then investigate.
- Small risk per trade sharply reduces risk of ruin.
WeCore includes automated risk rules such as a daily loss limit, maximum contracts, trading hours and position flattening, enforced on every connected account. You can set them stricter than the prop firm's rules and test them in simulation mode. Details in the guide how to set risk limits in WeCore.