Risk Sizing

Risk Sizing answers a sizing question: how many contracts should each trade take, across several strategies, so the book respects a daily-loss budget and a per-trade risk cap — optionally letting size compound as capital grows.

The same engine now lives in the Workspace

You can switch any strategy of your live session to dynamic sizing directly from the Workspace rail (the ×/% toggle) and mix fixed and sized legs in the same portfolio — including the daily budget, compounding, the rolling windows and the per-trade allocation table. See Weights, sizing & capital for the composition rules. With sizing active, the workspace's Monte Carlo also switches automatically to the per-path re-allocation engine described below. This standalone module remains the dedicated bench for sizing experiments on their own CSV catalog.

It runs on its own data

Risk Sizing is independent of the analysis session. It works on trade-level CSVs, requiring at least: Date Opened, Premium, P/L and Time Opened. Upload them directly, or use Import from workspace to pull in the strategies of your current live session — exactly what you have loaded right now, so any strategy you added, renamed or removed (or a full workspace reset) is reflected. With an empty workspace the picker has nothing to offer. Only Option Omega strategies carry this trade-by-trade detail; strategies with daily P/L only won't appear in the picker.

Simulations run in the background

Both the run and its Monte Carlo execute on the server, not inside the browser request. When you press run the calculation is handed to a background job and the page just polls for the result — so it keeps going if you switch tabs, lock your phone, or move to another app, and picks the result back up when you return. It even survives a full page reload or a backend restart mid-run. You don't need to keep the tab in the foreground.

Inputs

Global, for the whole run:

Initial capital
Starting capital for the simulation.
Max daily loss %
The daily risk budget, as a % of capital.
Compounding
On: size scales with current equity. Off: size is fixed from day one.
Date range
Optional start/end to restrict the trades (can sync from your session period).

Per strategy:

Sizing basis
Risk (premium / stop-loss) or Margin (margin requirement).
Stop loss
As a % of premium or a fixed $ per contract (risk basis).
Cap %
Share of capital to put at risk per trade.
Min / max contracts
Floor and ceiling on contracts per trade (min can force at least one).

Sizing logic

For each trading day the tool sets the available capital (fixed, or compounded from realised P/L), then for each trade:

unit       = stop-loss $ per contract   (or premium × SL%, or the margin requirement)
contracts  = floor( capital × cap% / unit )
# then capped so the day's cumulative risk stays within max-daily-loss × capital,
# and finally clamped to the min / max contracts you set.

Realised P/L is contracts × per-contract P/L, accumulated into an equity curve.

Where to read the per-trade loss

To choose a stop-loss or cap from the strategy's own history, use the Per-trade risk ($) block in each strategy's Metrics detail — the 5% threshold loss and worst-5% mean loss in dollars on 1 contract. That is the per-trade loss distribution you are sizing against (not the account-level VaR %, which is diluted by idle days).

Outputs

  • Headline metrics — P/L, CAGR, Max Drawdown, MAR (CAGR ÷ |Max DD|), Sharpe, Sortino, plus total premium and capture rate (P/L ÷ premium).
  • Equity and drawdown curves (dollar or percent).
  • Margin employed histogram (dollar or percent) — the capital tied up as margin, one bar per trading day, Σ contracts × margin per contract, using each trade's margin (the CSV's margin column, or the reference margin when you size on the margin basis). Because it uses the sized contract count, the bars reflect the margin the re-sized book would actually post. A pinned badge shows the median and mean across the trading days. In percent it is the utilisation rate (margin ÷ starting capital). It appears only when the trades carry a margin; otherwise the panel explains how to supply one.
  • Trade-by-trade table — for every trade: contracts allocated, the realised P&L (contracts × per-contract P/L), the risk taken, cumulative daily risk and the capital available that day. Export CSV (button in the table header) downloads the whole list as a CSV — one trade per row, raw numbers (no currency formatting) ready to re-open in Excel or another tool.
  • Rolling returns across windows (week → year). With compounding off, sizing is fixed on the starting capital, so each window's return is the outcome of a fresh account entering with that capital at that moment. Any window whose loss falls past −100% is flagged as a blown account ("Conto bruciato"): whoever had started in the worst period would have lost more than their entire capital. Along your actual history you may have crossed that stretch with more capital (and survived), but it is the worst possible entry timing. Beyond −100% the figure is theoretical — a real account would have stopped at zero. Reduce Cap %, the stop-loss, or the daily risk budget to stay above the line.
  • Monte Carlo (optional) — block-bootstraps the trades and reports ruin probability, median final capital, tail percentiles and tail P/L (VaR/CVaR) for dynamic (compounding) sizing: it resizes contracts from the current capital each day, so its growth is genuinely exponential — that is the point of compounding, not an artefact. The bootstrap resamples whole calendar blocks of trades (not single days, to keep each period's multi-trade structure intact): pick weekly (≈ 5 days), monthly (≈ 21) or quarterly (≈ 63) — the same three granularities as the Monte Carlo module's 5/21/63-day blocks, expressed in the calendar units this engine resamples. The risk metrics are reported honestly:
    • VaR/CVaR are the terminal P/L in dollars (not a percentage of starting capital), so a profitable strategy shows a positive tail P/L ("even the worst 5% still ends up +$X") instead of the nonsensical "−7,000%" you get when dividing a compounded final value by a tiny starting capital.
    • Probability of ruin counts paths whose equity ever touches the ruin threshold (and reports the count of scenarios that touched it). It can be a true 0.0% here: the simulation enforces your daily-loss budget and shrinks position size as capital falls, so with a real edge the account rarely revisits a low floor. If it's positive but rounds to zero, the readout shows < 0.1%.
    • Winsorize (low/high %) — note this is different from the Monte Carlo module's winsorize. Here it does not clip the P/L distribution; it makes the sizing reference robust. For each strategy the reference premium and margin (used to compute how many contracts to trade) are the average of the trades between the low and high percentiles, dropping the extremes — so a few unusually large or small premiums/margins don't distort the contract count. The trades' P/L are resampled untouched. Default 5–95%.

Run history

Every time you press Run, Risk Sizing keeps a snapshot of it. Open it from History on the run toolbar, or from the Risk Sizing history button on the session History (Timeline) page. The list shows every run — its PnL, CAGR, Max Drawdown, MAR and Sharpe at that moment and a small equity sparkline, newest first. It is the same idea as the session Timeline, applied to this module.

  • Recall a run to restore its exact parameters (per-strategy stop-loss, Cap %, sizing basis, plus capital, daily-loss budget, compounding and date range) into the form and recompute it — on your current CSVs, so the result stays consistent with the data you have now. It is a restore-and-re-run, not a frozen copy of the old numbers.
  • Undo / Redo step to the previous / next run.
  • Re-running with the same parameters does not add a duplicate entry.

The history lives in your browser (local to this device), like the module's configuration: it survives a reload but is not synced across devices, and Clear empties it. Only base runs are recorded — Monte Carlo is a sub-analysis of the current run, not a separate history entry.

Stop when blown (rolling windows)

The rolling windows ask "what if I had entered at this moment?". Without compounding, sizing stays fixed on the starting capital, so a single window's path can fall past −100% of that capital — meaning a fresh account starting there would have lost everything. By default the window still shows the whole path (e.g. a −350% trough that "recovers" to +250%), with a "Conto bruciato" badge warning you the figure is theoretical: a real account would have stopped at zero and never seen that recovery.

Turn on Settings → Risk Sizing → "Stop when blown (rolling windows)" to make the windows realistic: any window whose path touches −100% is truncated there and pinned to −100% — the worst window reads −100% with no closing return, because the account is blown. Default off: you see each window's full path with the warning badge.

This is purely a display choice for the rolling windows. It does not change the main equity curve (where a real blow-up already shows as the line crossing zero), the trade-by-trade table, or the Monte Carlo. Flip it, then re-run.

When sizing returns zero

If a strategy keeps allocating 0 contracts, the per-trade risk budget is too small to cover one contract. Common fixes: raise Cap %, raise the initial capital, reduce the stop-loss, or enable minimum 1 contract. Risk Sizing surfaces a plain-language warning in exactly these cases (for example, when both a % and a $ stop-loss are set, or when a margin basis has no margin available).