
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 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.2
Continue reading on Dev.to Tutorial
Opens in a new tab




