Algorithmic Risk Management for Forex Bots: The Six Circuit Breakers Every Bot Needs
Algorithmic risk management for forex trading bots: fixed risk per trade, daily and drawdown limits, exposure limits, news blackouts and a kill switch, with the logic to code them.
An entry signal decides when a bot trades. Risk management decides whether the account survives. Most trading accounts are not destroyed by bad entries but by one oversized position, a string of revenge trades after a loss, or a news spike through a stop. Algorithmic risk management means encoding rules that prevent those events, rules the bot enforces and the human cannot override in the heat of the moment.
The six circuit breakers
1. Fixed risk per trade
Every position is sized so that hitting the stop loses a fixed fraction of the account, typically 0.25 to 1 percent.
Position size = (balance x risk %) / (stop in pips x pip value per lot)
Example: a 10,000 dollar account risking 0.5 percent can lose 50 dollars. With a 25-pip stop on EUR/USD, where a standard lot is worth about 10 dollars per pip, the size is 50 / (25 x 10) = 0.2 lots. The stop decides the size, never the other way round.
2. Daily loss limit
When the day's losses, including open positions, reach a set level such as 2 percent, the bot closes everything and stops until the next day. This single rule prevents most catastrophic days.
3. Maximum drawdown limits
When the account falls a set distance below its highest value, for example 6 percent, the bot halves its risk. At a second level, for example 8 percent, it stops completely until a human reviews the strategy. Professional multi-manager hedge funds apply the same idea to their traders.
4. Exposure limits
Limit the number of open trades and the total risk on any single currency. Short EUR/USD, short GBP/USD and long USD/JPY are three trades but one bet on the US dollar.
5. News blackout
No new trades from, for example, 30 minutes before to 30 minutes after high-impact releases such as central bank decisions, US employment reports and inflation data. Spreads widen and stops can fill far from their price.
6. Kill switch
One action, available at any time, that closes all positions and stops the bot. Test it before you need it.
Build risk as a separate module
The most common mistake is scattering risk settings throughout the strategy code. Instead, build one function that every order must pass, which returns either "allowed" or the reason it is blocked: kill switch on, daily limit reached, drawdown stop, too many trades, too much currency exposure, or news blackout. A second function calculates position size, halving it above the first drawdown level.
With an AI assistant such as ChatGPT or Claude, you can describe these rules in plain English and get working code for MetaTrader 5, TradingView alerts or Python. Our ebook The Hybrid Trader includes the full logic and the prompts we use.
Two details that catch traders out
- Measure daily loss on equity, not closed trades. Open losses count, and that is how prop firms measure it. See our prop firm bot guide.
- Set limits below any external limit. Slippage, gaps and spread widening can push losses past a stop, so leave a margin.
What never belongs in a bot
- Martingale: doubling size after a loss.
- Averaging down without a stop.
- Trading without a stop loss.
- Risk that grows after wins without a written rule.
These features make backtests beautiful and live accounts short-lived. If you are evaluating a commercial bot, their presence is a reason to walk away; our guide to no-risk forex Expert Advisors explains why.
Risk first, strategy second
A mediocre strategy with excellent risk control survives long enough to improve. A brilliant strategy with no risk control eventually meets the one market day that ends it. Build the circuit breakers first.
Frequently Asked Questions
What is algorithmic risk management?
Rules coded into a trading system that control position size and losses automatically: risk per trade, daily and drawdown limits, exposure limits, news blackouts and a kill switch.
How much should a trading bot risk per trade?
Commonly 0.25% to 1% of the account per trade, sized from the stop distance so a hit stop loses only that amount.
Should daily loss include open trades?
Yes. Measure daily loss on equity including open positions; that is how prop firms measure it and it gives a true picture of risk.
Ready to unlock your market intelligence?
Run AI-powered keyword research, market pain discovery, and GEO visibility checks in seconds.