Calculate optimal position size for crypto trades with HyroTrader compliance. Use when determining how much to risk, how many contracts to open, or sizing a trade. Triggers: "position size", "how much to risk", "lot size", "sizing", "how many contracts"
Calculate position size respecting HyroTrader risk limits, using ATR-based and fixed-fractional methods.
docs/research/position-sizing-advanced.md — Kelly, fractional, ATR-based methodsdocs/research/math-money-management-timeseries.md — Mathematical foundationsdocs/research/systematic-trading-carver.md — Vol-targeting, FDM, IDM| Setup Quality | Confluence Score | Risk % |
|---|---|---|
| Standard | 3/4 | 1.0% |
| A+ Setup | 4/4 | 1.5% |
| Weak/Uncertain | 2/4 or less | NO TRADE |
dollar_risk = initial_balance * risk_percentage
stop_distance = abs(entry_price - stop_loss_price)
stop_distance_pct = stop_distance / entry_price
position_size_usdt = dollar_risk / stop_distance_pct
contracts = position_size_usdt / entry_price
position_margin = position_size_usdt / leverage
Always round position size DOWN to nearest valid lot size for the pair. Never round up.
## Position Size: {PAIR}
- Risk: {risk_pct}% = ${dollar_risk}
- Entry: {entry_price}
- Stop-Loss: {sl_price} ({sl_distance_pct}%)
- Position Size: {size} contracts (${notional_value})
- Margin Required: ${margin} ({margin_pct}% of balance)
- R:R at TP: {ratio}
### Constraint Check
- [x] Risk per trade: {pct}% <= 3% max
- [x] Margin: {current + new}% <= 25% max
- [x] Notional: ${total} <= ${2x_initial} max
- [x] Portfolio heat: {total_heat}% <= 5% max