Risk and capital

Trading bot position sizing: stop risk and capital limits

A worked sizing example separates the loss budget from position value and shows which limit determines the final quantity.

Account capital, position value and modeled loss shown separately

Calculate a trading bot's position size from a defined loss budget and the distance to the planned exit, then apply cash, exposure and venue limits. “Risk 1%” does not mean “buy with 1% of the account.” It describes a conditional loss estimate whose assumptions must be written down.

A small stop distance can produce a surprisingly large position. The resulting calculation is a request to check exposure, rather than permission to use leverage or squeeze the stop closer. The following examples use hypothetical unleveraged spot trades. Their percentages are arithmetic inputs, not suggested risk settings.

Separate capital, position value and planned loss

Account equity is the value of cash and holdings at a stated time. Position value is quantity multiplied by price. Planned loss is the estimated value decrease if the position exits under the specified conditions, including the costs included in the model.

For a long position, begin with the difference between entry and stop reference prices. A stop trigger is not a guaranteed execution price. Gaps, liquidity and the chosen order type can produce a larger loss. If a bot reports an exact maximum loss without stating these limitations, the label needs scrutiny.

Write the account currency, the equity timestamp and whether other bots share the balance. An apparently affordable trade can consume funds already committed to pending orders.

Work through the basic calculation

Assume equity of 10,000 USDT and an educational loss budget of 0.5%, or 50 USDT. The planned entry is 100 USDT per unit and the stop reference is 98 USDT. Ignoring costs, the estimated loss per unit is 2 USDT, giving a quantity of 50 / 2 = 25 units. Position value is 2,500 USDT, or 25% of equity.

Now add assumed entry and exit fees of 0.1% each, charged in the quote currency. At these reference prices, fees per unit are 0.100 + 0.098 = 0.198 USDT. Adding a hypothetical 0.20 USDT adverse execution allowance gives 2.398 USDT of modeled loss per unit.

Quantity becomes 50 / 2.398, approximately 20.8507 units. If the permitted quantity increment were 0.01, rounding down gives 20.85 units. The modeled loss is 20.85 × 2.398 = 49.9983 USDT. Rounding up would exceed the budget. Actual fees and quantity increments depend on the venue and instrument; these example values are not current exchange settings.

Apply exposure limits after the risk calculation

Suppose the strategy also caps position value at 15% of equity: 1,500 USDT. At the example entry price, that allows only 15 units. The final quantity is the smallest permitted by the loss calculation, position-value cap, available cash and other account restrictions. Here the exposure cap binds, even though the loss budget would allow more.

Pending buys must also count where they can create exposure. Three bots each requesting a modest position may be making the same directional bet on correlated assets. Separate account-wide limits from per-bot limits so they cannot all spend the same unused capacity.

Exchange rules add another gate. Binance documents spot quantity and notional filters. A valid risk calculation can still produce an order below the venue minimum. Rejecting that trade is preferable to silently increasing it beyond the approved budget.

Test a losing sequence and uncertain inputs

With a fixed fraction of current equity, losses reduce the base used for subsequent sizing. Five losses of exactly 0.5% each would leave 10,000 × 0.995⁵, approximately 9,752.49 USDT, before effects outside that model. That is a decline of about 2.48%, rather than exactly 2.5%.

Real losses can cluster and exceed modeled exits. Test wider execution costs, several simultaneous stops, missing prices and rejected exits. Do not infer a reliable win probability from a short backtest and feed it into an aggressive allocation formula. Treat a material sizing-rule change as a new strategy version requiring its own historical validation.

A sizing checklist for the specification

  • Define equity, its valuation time and the currency of every input.
  • Record entry, exit reference, fees and adverse execution assumptions.
  • Cap total position value separately from estimated stop loss.
  • Include pending orders and other bots using the account.
  • Round down to the permitted quantity increment and recheck all filters.
  • Define rejection behavior when data, balance or protection is missing.

Save the inputs and binding limit with each proposed order. That lets a reviewer explain why the bot requested 15 units when the loss formula suggested 20.85.

Use Clerix's rules and risk workflow to examine these distinctions in the website's illustrative process. Its testing engines and live execution are in development. The local example is not an exchange risk control; confirm available capabilities before relying on any calculated limit.

Frequently asked questions

Should I move the stop closer to increase size?

Changing the stop changes the strategy. First justify the exit rule, then calculate size from it. A convenient position value is not evidence that a tighter exit fits the market behavior being tested.

Is planned stop loss the largest possible loss?

No. The calculation depends on execution and cost assumptions. A stop can fill worse than expected, and a stop-limit order may not fill at all.

Can several bots share one risk budget?

They can share an explicitly enforced account limit. Independent limits that ignore simultaneous positions and pending orders do not establish a shared budget.

Clerix Editorial

Clerix educational content on strategy rules, testing methods and the limitations of trading simulations.

Explore the Clerix workflow