Home › Investing & Real Estate › Position Size Calculator
Position Size Calculator
Computes how many shares (or units) to buy or short so that hitting the stop-loss loses a fixed percentage of the account, using the fixed-fractional method: risk amount divided by the risk per share.
When to use
You have an entry and stop-loss price and want the number of shares that keeps the potential loss at a chosen fraction of the account.
Do not use when: You want the mathematically optimal fraction to bet from a known edge (Kelly criterion) or the reward side of the trade (use risk-reward-ratio). Informational only; not financial advice.
Formula
risk_amount = account_size × risk_percent/100; risk_per_share = |entry_price − stop_loss_price|; shares = floor(risk_amount / risk_per_share); position_value = shares × entry_price
Fixed-fractional position sizing: the loss at the stop, not the position value, is held to a constant fraction of capital. Slippage, gaps through the stop and commissions can make the real loss larger. Informational mathematics only; not financial advice.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
account_size | number | yes | Total trading capital. Range: > 0, ≤ 1000000000000 | |
risk_percent | number | % | yes | Share of the account you are willing to lose if the stop is hit (commonly 0.5–2 %). Range: > 0, ≤ 100 |
entry_price | number | yes | Planned entry price per share or unit. Range: > 0, ≤ 1000000000 | |
stop_loss_price | number | yes | Price at which the trade is exited at a loss; below the entry for a long, above it for a short. Range: ≥ 0, ≤ 1000000000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
risk_amount | number | account_size × risk_percent / 100. | |
risk_per_share | number | |entry_price − stop_loss_price|. | |
stop_distance_percent | number | % | risk_per_share / entry_price × 100. |
shares | integer | floor(risk_amount / risk_per_share). | |
position_value | number | shares × entry_price. | |
position_percent_of_account | number | % | position_value / account_size × 100 (above 100 % requires leverage). |
actual_risk_amount | number | shares × risk_per_share. | |
direction | string | Long when the stop is below the entry, short when above. |
Example
50,000 account, 1 % risk, entry 100, stop 95: {"account_size":50000,"risk_percent":1,"entry_price":100,"stop_loss_price":95} → {"risk_amount":500,"risk_per_share":5,"stop_distance_percent":5,"shares":100,"position_value":10000,"position_percent_of_account":20,"actual_risk_amount":500,"direction":"Long (stop-loss below entry)"}
Short: 20,000 account, 2 % risk, entry 40, stop 42: {"account_size":20000,"risk_percent":2,"entry_price":40,"stop_loss_price":42} → {"risk_amount":400,"risk_per_share":2,"shares":200,"position_value":8000,"position_percent_of_account":40,"direction":"Short (stop-loss above entry)"}
GET https://tttkmbb.com/api/v1/calculate/position-sizing?account_size=50000&risk_percent=1&entry_price=100&stop_loss_price=95
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/position-sizing(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/position-sizing · Markdown: https://tttkmbb.com/investing/position-sizing.md · JSON definition: https://tttkmbb.com/investing/position-sizing.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="position-sizing" - OpenAPI operationId:
calculate_position_size - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Britannica Money – Calculating position size in trading (reference)
- Wikipedia – Risk return ratio (reference)
FAQ
Why is the share count rounded down?
Rounding up would risk more than the chosen percentage; flooring keeps the actual risk at or below the target, which actual_risk_amount reports.
What if the position is larger than the account?
A tight stop can imply a position above 100 % of capital; that requires margin and the calculator flags it in the position percentage rather than capping it.
Related calculators
- Risk/Reward Ratio Calculator — Reward-to-risk of the same entry, stop and target.
- Stock Profit Calculator — Profit or loss of the position at a given exit price.
- Maximum Drawdown Calculator — Largest peak-to-trough loss of an equity curve.