Position Sizing & Risk Management for Algo Traders
Position Sizing & Risk Management for Algo Traders
There is a question we hear constantly from traders setting up their first EA on a VPS: “What lot size should I run?” It sounds simple. It is the single most important decision you will make.
We have watched hundreds of accounts come through our servers. The pattern is always the same. A trader finds a strategy with a 65% win rate, gets excited, sizes up too fast, hits a losing streak that was always statistically inevitable, and blows the account before the edge ever had time to play out. The strategy was fine. The sizing killed it.
This guide is everything we wish someone had told us before our first blown account.
Why Risk Management Beats Strategy
Here is an uncomfortable truth: a mediocre strategy with disciplined risk management will outperform a brilliant strategy with reckless sizing over any meaningful time horizon.
The math is not kind to recovery. If you lose 50% of your account, you need a 100% return just to break even. Lose 75% and you need 300%. These are not theoretical numbers. A strategy risking 10% per trade that hits five consecutive losers (which happens far more often than you think) is down 41%. Now your “great” 55% win rate system needs months of grinding just to get back to where it started.
Risk management is not the boring part of trading. It is the part that determines whether you are still trading six months from now.
The goal is not to maximize returns on any single trade. The goal is to stay in the game long enough for your edge to compound. Every decision you make about sizing should flow from that principle.
Fixed Fractional Sizing
Fixed fractional sizing is the foundation. Risk a fixed percentage of your current equity on every trade. As your account grows, your position size grows. As it shrinks, your position size shrinks. This is automatic anti-martingale: you naturally bet more when winning and less when losing.
The Formula
Lot Size = (Account Equity x Risk %) / (Stop Loss in Pips x Pip Value per Lot)
In plain English: figure out how many dollars you are willing to lose, then divide that by how many dollars you would lose per lot if your stop gets hit.
Worked Example: Forex (EURUSD)
- Account equity: $10,000
- Risk per trade: 1.5%
- Stop loss: 30 pips
- Pip value for 1 standard lot EURUSD: $10/pip
Dollar risk = $10,000 x 0.015 = $150
Lot size = $150 / (30 pips x $10) = $150 / $300 = 0.50 lots
You would trade 0.50 standard lots. If your stop gets hit, you lose exactly $150, which is exactly 1.5% of your account. No guessing, no “feeling” the market.
Worked Example: Indices (US30/Dow Jones)
- Account equity: $10,000
- Risk per trade: 1.0%
- Stop loss: 50 points
- Point value per 1.0 lot US30 (varies by broker): $1/point
Dollar risk = $10,000 x 0.01 = $100
Lot size = $100 / (50 points x $1) = 2.0 lots
Always check your broker’s contract specification for the actual point value. This varies more than you expect, especially on indices and metals.
What Percentage Should You Use?
For most algo traders, 1% to 2% per trade is the sweet spot. Here is a rough guide:
- 0.5% — Ultra-conservative. Good for strategies with high trade frequency (50+ trades/month) or when you are in drawdown and scaling back.
- 1.0% — Standard. Enough to grow meaningfully, survivable through bad streaks.
- 1.5% — Moderate. Where most of our experienced traders land after live testing.
- 2.0% — Aggressive for a single strategy. Only if your win rate and payoff ratio are well-established over hundreds of trades.
- 3%+ — You are gambling. We say this with love.
Kelly Criterion
The Kelly Criterion tells you the theoretically optimal bet size to maximize long-term growth rate. It was developed for gambling but applies directly to trading.
The Formula
Kelly % = W - (1 - W) / R
Where:
- W = Win rate (probability of a winning trade)
- R = Win/loss ratio (average win / average loss)
Worked Example
Your strategy has a 55% win rate and your average win is 1.5x your average loss.
Kelly % = 0.55 - (1 - 0.55) / 1.5
Kelly % = 0.55 - 0.45 / 1.5
Kelly % = 0.55 - 0.30
Kelly % = 0.25 (25%)
Kelly says to risk 25% per trade. Do not do this.
Why Full Kelly Will Destroy You
Full Kelly assumes you know your exact win rate and payoff ratio. You don’t. You have estimates from backtests and limited live data. Full Kelly also produces enormous drawdowns — mathematically optimal in the long run, but psychologically unbearable in practice. A 50-60% peak-to-trough drawdown is normal under full Kelly. Nobody sits through that calmly.
Fractional Kelly
This is what actually works in practice:
- Half-Kelly (divide Kelly by 2): Achieves roughly 75% of the growth rate with dramatically smaller drawdowns. This is the most common recommendation in quantitative finance for a reason.
- Quarter-Kelly (divide Kelly by 4): Very conservative but extremely resilient. Good for strategies where you have limited live data or suspect your backtest overstates performance (which it almost certainly does).
Using our example above: full Kelly says 25%, so half-Kelly says 12.5% and quarter-Kelly says 6.25%.
Even quarter-Kelly at 6.25% is higher than what most traders should be risking on a single trade. This is because Kelly assumes one bet at a time. If you are running multiple strategies or taking correlated trades (see the section on correlation below), you need to divide further.
When Kelly Makes Sense
Kelly is useful as a ceiling, not a target. Calculate it, then size well below it. It is most valuable when comparing strategies: if strategy A has a Kelly of 15% and strategy B has a Kelly of 5%, you know where to allocate more capital relative to the other. The absolute numbers are less important than the ratios.
Max Drawdown Rules
A position sizing formula tells you how much to risk per trade. Drawdown rules tell you when to stop trading entirely. Every algo trader needs both.
Daily Loss Limits
Set a maximum daily loss. When your bot hits it, it shuts down for the rest of the day. Period. No overrides, no “but the setup looks really good.”
A common threshold: 3% daily loss limit. If your account drops 3% from the day’s starting equity, all positions close and no new trades open until the next session.
Weekly and Monthly Limits
Layer your circuit breakers:
- Daily limit: 3% (halt trading for the day)
- Weekly limit: 5% (halt trading for the week, review strategy logs)
- Monthly limit: 10% (halt trading, full strategy audit before resuming)
These numbers are not sacred. Adjust them to your strategy’s normal drawdown profile. A mean-reversion strategy that trades 200 times a month will have different daily variance than a trend follower taking 10 trades a month. The point is to have hard limits that are defined before you are in the middle of a drawdown and making emotional decisions.
Equity Curve Trading
This is an underused technique. Track your strategy’s equity curve and apply a simple rule: if the equity curve drops below its own moving average, stop trading that strategy live (or reduce size to minimum).
For example: plot a 20-trade moving average of your equity curve. When equity is above the MA, trade normally. When it drops below, either stop entirely or cut size to 25% of normal. Resume full size when equity crosses back above.
This is not curve fitting. It is acknowledging that strategies go through favorable and unfavorable regimes. There is no reason to take full-size trades during a regime that is clearly not working.
Consecutive Loss Limits
A simpler version: if your bot hits N consecutive losses, pause trading. Five to eight consecutive losses is a reasonable trigger for most strategies. This is not because the strategy is “broken” after five losses — it is because five consecutive losses may indicate a regime change worth investigating before continuing.
Correlation & Portfolio Risk
This is where most multi-strategy traders get burned. You think you are diversified. You are not.
The Correlation Trap
Say you are running five EAs, each risking 2% per trade on a different instrument: EURUSD, GBPUSD, AUDUSD, NZDUSD, and USDCHF. You feel responsible. No single trade risks more than 2%.
But EURUSD, GBPUSD, AUDUSD, and NZDUSD are all heavily correlated in a dollar move. USDCHF is inversely correlated to the same move. When the dollar surges, four of your five positions lose simultaneously. Your “diversified” 2% risk is actually closer to 8-10% effective risk in a correlated move.
Correlation-Adjusted Sizing
The proper approach:
- Group correlated instruments. If the correlation between two instruments exceeds 0.6 over your strategy’s lookback period, treat them as partially the same bet.
- Set a total risk budget per correlation group. Instead of 2% per pair, set 3-4% maximum total exposure across the entire correlated group.
- Divide accordingly. If you are trading four correlated USD pairs, your per-trade risk on each should be closer to 0.75-1.0%, not 2%.
A rough formula for effective portfolio risk when positions are correlated:
Effective Risk ~ Single Position Risk x sqrt(N) for partially correlated
Effective Risk ~ Single Position Risk x N for perfectly correlated
Where N is the number of simultaneous positions. For four perfectly correlated trades at 2% each, your effective risk is 8%. For four partially correlated trades (correlation around 0.5), it is roughly 2% x sqrt(4) = 4%. Reality is usually somewhere in between.
True Diversification
Real diversification means trading strategies that are uncorrelated in their return streams:
- A trend-following strategy on indices paired with a mean-reversion strategy on forex
- Different timeframes (an intraday scalper and a daily swing system)
- Different asset classes entirely (forex, indices, commodities)
If two strategies draw down at the same time during backtesting, they are not diversifying each other. Simple as that.
Practical Implementation
Theory is worthless if it is not in your code. Here is how to actually implement these rules.
In Your EA/Bot Code
Every EA should enforce these checks before opening a trade:
// Pseudocode - adapt to your language (MQL4/5, Python, etc.)
function canOpenTrade(stopLossPips) {
accountEquity = getAccountEquity()
dailyStartEquity = getDailyStartEquity()
// Check daily loss limit
if ((dailyStartEquity - accountEquity) / dailyStartEquity > 0.03)
return false // 3% daily limit hit
// Calculate position size
riskAmount = accountEquity * 0.015 // 1.5% risk
lotSize = riskAmount / (stopLossPips * pipValue)
// Check max total exposure
currentExposure = getTotalOpenRisk()
if (currentExposure + riskAmount > accountEquity * 0.06)
return false // 6% total portfolio limit
// Check consecutive losses
if (getConsecutiveLosses() >= 5)
return false // Pause after 5 consecutive losses
return true
}
Build these checks into the core of your trading logic, not as optional add-ons. The risk manager should have veto power over the signal generator. Always.
VPS-Level Enforcement
Here is where running on a VPS gives you an edge that local execution cannot match. Your VPS stays on 24/7. Your laptop does not.
Set up monitoring scripts that run independently of your EA:
- Account equity watchdog: A separate script that checks your account equity every 60 seconds. If equity drops below a hard floor (say 80% of the month’s starting equity), it closes all positions and disables the EA. This runs outside the EA itself, so even if your EA has a bug in its risk logic, the watchdog catches it.
- Process monitoring: Alert you (via email, Telegram, webhook) if your EA crashes or disconnects from the broker. An EA that is offline cannot manage open positions.
- Log aggregation: Pipe your EA’s trade logs to a file your monitoring can read. If the EA has opened more trades than expected or is showing abnormal behavior, you want to know immediately — not when you check your phone eight hours later.
The entire point of running on a VPS is that your risk management never sleeps, even when you do.
The Psychology Tax
Everything above is math. This section is about the part that math cannot solve.
The Gap Between Optimal and Tolerable
The mathematically optimal position size is almost always larger than the size you can actually tolerate psychologically. This is not a weakness. It is reality.
A 20% drawdown on a $10,000 account is $2,000. You can read that number calmly right now. Living through it — watching your account drop from $10,000 to $8,000 over two weeks while your bot keeps firing trades — is a completely different experience. The temptation to intervene, to turn off the bot, to override the system at the worst possible time, is overwhelming.
Size for what you can sit through, not what a spreadsheet says is optimal.
The Practical Test
Here is a test we use: imagine your strategy hits its maximum expected drawdown (from backtesting, double it for safety). In dollar terms, how does that number feel? If the answer is anything other than “uncomfortable but manageable,” you are sized too large.
For a $10,000 account with a strategy that showed 15% max drawdown in backtesting, assume 30% is possible live. That is a $3,000 peak-to-trough drop. Can you watch that happen without touching the bot? If not, cut your size until you can.
Sizing for Longevity
The traders who are still running EAs after three years are not the ones who found the best strategy. They are the ones who sized conservatively enough to survive the inevitable bad periods without abandoning their system.
Your first goal is survival. Your second goal is consistency. Returns come third, and they come as a byproduct of the first two.
An account that compounds at 2% per month with controlled drawdowns will dramatically outperform an account that makes 10% one month and blows up the next. The math of compounding rewards the boring, disciplined approach every single time.
Summary
- Fixed fractional sizing (1-2% per trade) is your foundation. Calculate lot size from stop loss distance, not gut feeling.
- Kelly Criterion gives you a ceiling. Use half-Kelly or quarter-Kelly, never full Kelly.
- Drawdown rules (daily, weekly, monthly limits) are non-negotiable circuit breakers. Code them in.
- Correlation kills diversification. Measure it. Budget your risk across correlated groups, not individual instruments.
- Implement risk rules in code and add VPS-level monitoring as a second line of defense.
- Size for psychology, not just mathematics. The best size is the one you can stick with through the bad months.
Risk management is not something you bolt on after building your strategy. It is the structure that everything else sits inside. Get it right and a mediocre strategy can build an account steadily over years. Get it wrong and the best strategy in the world will not save you.
We have seen it from both sides. Trust the math. Size small. Stay in the game.