13.Risk + position sizing
Kelly criterion with sensible caps, correlation-aware multi-position sizing, R-multiple bucketing, drawdown / discipline metrics, and the Pre-trade Plan workflow that pins your thesis before the order goes in.
R-multiple in one line
R = net P&L ÷ planned risk. Planned risk is the dollar amount you decided you'd lose if the trade hit your stop, set at trade-entry time. R = 1 means you made one unit of risk; R = -1 means the trade hit stop. Reports thinking in R-multiples (rather than raw dollars) makes per-trade comparison meaningful across different sizing regimes.
The Reports → R-Distribution view plots a histogram of historical R-multiples; expectancy = mean(R) × win-rate − loss-rate. Positive expectancy with a sample size > ~50 trades and tight standard error is the bar for "is this strategy working?".
The position-size calculator
The same calculator appears as the standalone Position Size tile and inline in the New Trade form. Inputs:
- Account equity — auto-filled from the active account's current equity (cash + open-position mark-to-market).
- Risk % — typical 0.25 – 1.0%. Below 0.25% rounds your stop noise above your edge; above 1% blows you up faster than you can learn.
- Stop distance — entry price minus stop price (long) or stop price minus entry (short).
- Symbol / asset class — drives the contract multiplier (options × 100; futures per-contract; FX per-lot).
Output:
- Suggested shares / contracts.
- Dollar at risk per unit and total.
- % of account at risk — sanity-check against the requested risk %.
- Kelly-fractional alternative — see below.
Kelly criterion — implemented with caps
Full Kelly maximizes expected log return but is too aggressive in practice (drawdowns of 50% are routine; one parameter mis-estimate ruins you). The calculator computes full Kelly from your historical R-distribution for the symbol (or for the universe if symbol-level history is thin), then offers three cap modes:
- Half Kelly — most-recommended default. Roughly the same growth rate, materially smaller drawdowns.
- Quarter Kelly — for slow, capital-preservation regimes.
- Capped Kelly — full Kelly × X, with a hard cap on per-trade risk %.
The calculator surfaces the actual computed full-Kelly fraction so you can sanity-check (a Kelly fraction > 0.5 on a single trade means your inputs are probably wrong; expectancy estimates from small samples are noisy).
Correlation-aware sizing
If you have N open positions and you're entering an N+1th, sizing in isolation is wrong — the correlation between your open positions and the new one means total portfolio risk is larger than the sum of per-trade risks if you size each one at the same %.
The calculator pulls the active account's open positions, computes pairwise correlations against the candidate symbol on a configurable lookback (default 60 days), and shrinks the suggested size to keep portfolio-level R at risk within the configured cap:
portfolio_R_at_risk = sqrt( sum_i sum_j corr(i, j) * R_i * R_j ) target_size = solve_for_qty( portfolio_R_at_risk == cap )
When you're long NVDA, AMD, and ASML, the recommended size for a new long on TSM will be smaller than the in-isolation Kelly fraction — because they all move together.
The Pre-trade Plan workflow
Pre-trade Plans (plans table) are a thin layer over the New Trade form that forces you to write down your thesis before the order goes in. A plan has:
- Symbol.
- Setup name — references the Setups taxonomy (Settings → Setups).
- Entry trigger — what would cause you to enter.
- Stop — price level + the reason.
- Target — price level or R-multiple goal.
- Sizing — auto-filled from the position-size calculator.
- Invalidation — what would make you abandon the plan unfilled.
Plans are searchable; reports can compare planned-vs-actual outcomes (did you actually wait for the trigger? did the trade hit your planned target?). The discipline report (GET /api/discipline/{account_id}) surfaces % of trades that had a plan attached.
Drawdown management
Drawdown report (step 05) shows the equity curve's max drawdown, time-underwater, and recovery distribution. Use the metric to set risk-down rules:
- "Cut size to 50% after 3 consecutive losses" — encode as a custom indicator that exposes a session-level "losses today" count; reference it in the position-size calc default.
- "No new trades after 2R drawdown for the session" — encode as a strategy alert that pings you (and optionally blocks paper-trade hotkeys, configurable).