Risk management is the part of a trading system that decides how much you are allowed to lose: on one trade, on one bad day, and in total before the bot is shut down. For a bot this is not advice; it is code. It applies every rule you wrote perfectly, and it never applies a rule you forgot. This guide explains the handful of rules that keep an account alive long enough for a strategy to matter.
What is risk management in trading, and what does it mean for a bot?
For a person, risk management is a set of habits: do not bet too much on one idea, get out when you are wrong, stop for the day when it is going badly. For a bot, the same habits become numbers written into the program: a maximum size per trade, an exit price for when the trade is wrong, a loss amount that turns the bot off.
The difference is what happens when the habit is missing. A person who forgets a stop-loss usually notices the losing position at some point and feels bad enough to close it. A bot without a stop-loss notices nothing. It will hold the position through a 40% drop and open the next trade on schedule, because nothing in its rules said otherwise.
Why does risk management matter more than the strategy?
Because losing works differently from winning. Lose 50% of an account and you need a 100% gain just to get back to where you started. Lose 20% and you need 25%. Lose 5% and you need a little over 5%. Small losses are cheap to recover from; large losses are close to permanent. Risk rules exist to keep every loss small enough to recover from.
There is a second reason. Every strategy has losing streaks, including good ones. Eight losses in a row will happen, sooner or later, to a strategy that wins half its trades. If each loss costs 1% of the account, eight in a row is a bad month. If each costs 10%, eight in a row is more than half the account. The strategy and the streak were the same; only the size of each bet changed.
How much should a bot risk on one trade?
Start with a number that feels too small: 1% of the account, or less. Risk means the amount you lose if the trade goes wrong and hits its exit, which is not the same as the size of the position. Work backward from the risk to the size.
Suppose the account is $1,000 and the rule is 1% risk, so $10 per trade. The strategy will exit if the price falls 5% from the entry. A 5% loss must equal $10, so the position is $200. If the exit were 2% away instead, the position could be $500 and the risk would still be $10. The stop distance comes first, and the size follows from it. In a fast market the exit can fill at a worse price than the stop, so treat the $10 as the planned loss rather than a guaranteed maximum.
A bot makes this easy, because it can do the arithmetic on every trade without getting excited and making the position a little bigger than the rule allows. It also makes the opposite mistake easy: a bot that sizes positions by “buy $500 every time” has no idea what it is risking, and neither do you. Sizing methods get their own guide in this series; the 1% rule and this back-calculation are a sound starting point for a first bot.
Where should a bot put its stop-loss?
A stop-loss is a price at which the bot admits the trade is wrong and gets out. Two things go wrong with stops, in opposite directions. Placed too close, the stop is hit by the small random price moves that happen all the time (traders call this noise), and the bot loses many small amounts on trades that would have worked. Placed too far, the stop protects nothing, because by the time it fires the damage is already large.
The useful question is “at what price is the reason for this trade no longer true?” A trade that bought after a drop because the price should return to its average is wrong if the price keeps falling well past that drop. That level is where the stop belongs, and the position size then follows from it, as above.
Some strategies exit by rule rather than by price: the signal reverses, or a time limit passes. That is fine, as long as the exit exists and the bot enforces it. The failure to avoid is a position with no defined way to end.
What does leverage do to risk?
Leverage lets a bot control a position larger than the money in the account. It multiplies gains and losses alike. A 5% price move against a position at 10x leverage is a 50% loss of the money you put up for the position (the margin). If the move continues, then before the margin is fully gone the exchange closes the position for you: this is called liquidation. Where exactly that happens depends on the exchange’s rules. Liquidation is a forced exit at the worst possible time.
For a first bot, the honest recommendation is no leverage at all. Learn how the strategy behaves at 1x, meaning no leverage, where the worst case is losing what you put in. Leverage can be added later, if at all, in small steps, once the risk rules above have been tested and the bot has run for a while without surprises. The mechanics of margin and liquidation get their own guide in this series.
What is a drawdown limit, and why does every bot need a kill switch?
A drawdown is how far the account has fallen from its highest point. A drawdown limit is a rule that says: if the account falls more than this much, stop trading. Two versions are common. A daily loss limit, for example 3% of the account, turns the bot off for the rest of the day. A total drawdown limit, for example 15% from the peak, turns the bot off until a human looks at it.
The point of the limit is that a bot cannot tell the difference between a bad day and a broken strategy. It also cannot tell the difference between a losing streak and a bug that is sending the wrong orders. A drawdown limit does not need to know which one it is. It just stops the losses, and a human decides afterwards what happened.
The kill switch is the same idea in its simplest form: a way to stop the bot immediately, from anywhere, and to close what it holds. Every bot needs one before it trades real money, and every operator should have used it at least once, on purpose, to know that it works.
What risks does a bot have that a human trader does not?
A human trader’s mistakes are limited by how fast a human can click. A bot’s mistakes are not. A bug that places the same order in a loop can empty an account in minutes. A wrong decimal point turns a $100 order into a $10,000 one. A stale price feed makes every decision wrong, and the bot has no way to know it. None of these are trading decisions, but they lose money exactly like a bad trade.
The defenses are simple and boring, and they matter. Cap the size of any single order in the code, separately from the strategy. Give the exchange API key permission to trade but not to withdraw funds. Refuse to trade when the data is older than a few seconds. Log every decision, so that the morning after an incident you can read what happened instead of guessing. The next guide in this series covers running a bot in production, where these habits become a daily routine. This page is Step 7 of the complete guide to algorithmic trading in crypto.
FAQ
What is the 1% rule in trading?
A common starting rule: never risk more than 1% of the account on a single trade. Risk here means the amount lost if the stop-loss is hit, not the size of the position. On a $1,000 account that is $10 per trade, which sounds tiny, and that is the intention: it takes a long run of losses to do serious damage, and a beginner needs that time to learn.
Do trading bots need a stop-loss?
Every bot needs a defined way to be wrong and get out, and a stop-loss is the simplest one. Some strategies exit by rule instead, for example when the signal reverses, and that can serve the same purpose. What no bot should have is an open position with no exit plan at all, because the bot will hold it forever without feeling anything.
Can a trading bot lose more than the money in the account?
Without leverage, no: the most you can lose is what you put in. With leverage, sometimes yes: positions can be closed by the exchange (liquidated) when losses approach your margin, and in a fast market the final loss can be larger than expected. Whether you owe anything beyond your margin depends on the exchange's rules, so read them before using leverage, and add it, if you ever do, only after the risk rules have been tested at 1x.