DEV Community

Propfirmkey
Propfirmkey

Posted on

Position Sizing Algorithms Every Trader Should Know

Position sizing determines how much you risk on each trade. It's arguably more important than your entry strategy.

Fixed Fractional

The most common method. Risk a fixed percentage of your account on each trade.

def fixed_fractional(account_balance, risk_percent, stop_loss_distance):
    risk_amount = account_balance * (risk_percent / 100)
    position_size = risk_amount / stop_loss_distance
    return position_size

# Example: $100K account, 1% risk, $50 stop
size = fixed_fractional(100000, 1, 50)
# = 20 contracts/shares
Enter fullscreen mode Exit fullscreen mode

Pros: Simple, scales with account
Cons: Doesn't adapt to strategy performance

Kelly Criterion

Mathematically optimal sizing based on your edge.

def kelly_criterion(win_rate, avg_win, avg_loss):
    # Kelly % = W - (1-W)/R
    # W = win probability, R = win/loss ratio
    R = abs(avg_win / avg_loss)
    kelly = win_rate - (1 - win_rate) / R
    return max(0, kelly)

# Example: 55% win rate, avg win $500, avg loss $400
k = kelly_criterion(0.55, 500, 400)
# = 0.55 - 0.45/1.25 = 0.19 = 19% of capital

# In practice, use half-Kelly or quarter-Kelly
half_kelly = k / 2  # 9.5%
Enter fullscreen mode Exit fullscreen mode

Warning: Full Kelly is extremely aggressive. Most professionals use quarter-Kelly at most.

Volatility-Based (ATR)

Adjust size based on how volatile the instrument is.

def atr_position_size(account_balance, risk_percent, atr, atr_multiplier=2):
    risk_amount = account_balance * (risk_percent / 100)
    stop_distance = atr * atr_multiplier
    position_size = risk_amount / stop_distance
    return position_size

# Volatile market (ATR = $30): smaller position
size_volatile = atr_position_size(100000, 1, 30)  # = 16.7

# Calm market (ATR = $10): larger position
size_calm = atr_position_size(100000, 1, 10)  # = 50
Enter fullscreen mode Exit fullscreen mode

This automatically adjusts for market conditions.

Anti-Martingale

Increase size after wins, decrease after losses.

def anti_martingale(base_size, consecutive_wins, scale_factor=1.5):
    if consecutive_wins <= 0:
        return base_size
    return base_size * (scale_factor ** min(consecutive_wins, 3))

# Base: 1 contract
# After 1 win: 1.5 contracts
# After 2 wins: 2.25 contracts
# After 3 wins: 3.375 contracts (capped)
Enter fullscreen mode Exit fullscreen mode

Comparison

def compare_sizing_methods(trades, initial_capital=100000):
    methods = {
        'fixed_1pct': [],
        'kelly': [],
        'atr_based': [],
    }

    for method in methods:
        balance = initial_capital
        for trade in trades:
            if method == 'fixed_1pct':
                risk = balance * 0.01
            elif method == 'kelly':
                risk = balance * 0.05  # quarter-kelly
            elif method == 'atr_based':
                risk = balance * (0.01 * (20 / trade['atr']))

            pnl = risk * trade['r_multiple']
            balance += pnl
            methods[method].append(balance)

    return methods
Enter fullscreen mode Exit fullscreen mode

Key Principles

  1. Never risk more than 2% per trade — even if Kelly says otherwise
  2. Account for correlation — 5 trades in the same sector = 1 big trade
  3. Reduce size during drawdowns — capital preservation first
  4. Match sizing to your firm's rules — prop firms have specific daily loss limits

Position sizing is where most traders fail. The right strategy with wrong sizing blows up. The mediocre strategy with right sizing survives.

For prop firm traders, understanding how position sizing interacts with daily drawdown limits is critical. Each firm has different rules — resources like propfirmkey.com break down these parameters for 30+ firms.


Which position sizing method do you use?

Top comments (0)