Risk Management Fundamentals for Algorithmic Traders
Position sizing, stop losses, and portfolio allocation. The essential risk controls every algo trader must implement.
Risk management isn't about avoiding losses—it's about surviving long enough for your edge to play out. The best traders think in terms of risk first, reward second.
The Cardinal Rule: Never Risk More Than You Can Afford to Lose
Before any position sizing calculation, you must determine your maximum acceptable loss. This is the amount that, if lost, wouldn't materially impact your life or trading career.
Position Sizing: The Kelly Criterion
The Kelly Criterion provides a mathematically optimal position size based on your edge and win rate. However, most practitioners use a fraction of Kelly (typically 25-50%) to reduce volatility.
def kelly_fraction(win_rate, win_loss_ratio):
"""
Calculate Kelly Criterion position size
"""
q = 1 - win_rate # probability of loss
kelly = win_rate - (q / win_loss_ratio)
return max(0, kelly) # never go negative
# Example: 55% win rate, 1.5:1 reward/risk
position_pct = kelly_fraction(0.55, 1.5)
# Returns ~0.22 (22% of capital per trade)Stop Losses: Systematic vs Discretionary
For algorithmic traders, stop losses should be systematic and based on market structure, not arbitrary percentages. ATR-based stops adapt to current volatility conditions.