📐 Position Size
While the Sizing Lab helps you choose the method, this makes it REAL: position size becomes part of the strategy and genuinely changes the equity of the backtest, the Portfolio and the basket — and it travels to the exports. It is the second of AniQuant's three engines: Edge → Position Size → Portfolio.
A design principle: generation and ranking stay at a fixed size (they measure the pure edge, without leverage distorting the search). Sizing is applied afterwards: to the performance you see, to the Portfolio and basket, and to the exported code.
The methods (with their layer of limits)
A constant N contracts/shares.
Invest a $ amount per position.
Exposure = X% of the balance. Ideal on stocks/ETFs; on futures the notional distorts it.
Risks X% of the account using the real stop. The most useful one for systematic trading.
Risks a fixed $ amount per trade (÷ the risk per contract).
Scales with the balance (contracts-per-equity).
Sizes by each entry's volatility: smaller size when the market gets choppy.
On top of any method: min/max contracts, max exposure %, max risk per trade, whole units. The formula may ask for 37; you say "never more than 8".
In the performance
In View Performance, the Position Size tab applies the plan and the equity, the drawdown, the Monte Carlo and the metrics all become sized.
It travels with the strategy
The plan is saved with the strategy (right click → Position Size in the Portfolio). The Portfolio and the basket use each one's real equity. A ⚖ in the table marks the ones carrying a plan.
In the AQ language
AQL describes it with the positionsize: directive — for example positionsize: risk 1% — with a full round trip (see AQ Language).
And in all five exports
The exported code sizes the position just as AniQuant does, each in its own native idiom (not always 1 contract):
AQ_* inputs + the AQ_Contr calculation using BigPointValue/NetProfit → Buy AQ_Contr contracts.
An AQ_CalcVol() function using the account equity and the tick value, normalized to the symbol's lot.
ONCE AQ_* parameters + a per-bar block → BUY AQ_Contr CONTRACT.
SetPositionSize in its native mode: spsShares / spsValue / spsPercentOfEquity depending on the method.
Native default_qty_type: strategy.fixed / strategy.cash / strategy.percent_of_equity. The methods that depend on equity trade by trade (per each X, ATR, Fixed Ratio, target volatility) have no equivalent and come out as 1 contract, with a warning in the code.
Position Size Optimizer — by brute force
Knowing the sizing methods is one thing; choosing the best one for YOUR strategy is quite another. The Optimizer does it for you: it takes a strategy's real trades (or the whole portfolio's) and tries dozens of sizing configurations the hard way — every method with its parameters (Risk 0.25%…3%, % of Capital, 1-per-X, ATR, Fixed Ratio, full/half/quarter Kelly, Target Vol…). It does not keep the one that makes the most, but the one that best combines growing and surviving.
One strategy
It re-tests the chosen strategy and sweeps the entire sizing catalog over its trades. You get a ranking and a recommendation.
Portfolio (all of them)
It optimizes the sizing of every active strategy in the portfolio and shows you the combined effect (normalized vs optimized equity, % improvement). With an "Apply all" button.
How it picks the winner: growing and surviving
- ·MAR = annual return ÷ maximum drawdown. It measures how much growth you get for each unit of pain. The higher the better.
- ·Risk of ruin = with a Monte Carlo (shuffling the trade order many times) we measure how often the capital would fall to 50%. That is the survival test.
- ·Ruin ≤ (you set it, 5% say) = the maximum probability of ruin you accept. The recommendation is the best MAR whose ruin stays below your threshold. If nothing survives, it tells you: lower the risk or revisit the strategy.
Equity · cumulative P&L
The capital curve at 1 contract (gray) against the sizing applied (green). You see at a glance what money management adds.
Growing vs surviving
CAGR (growing) against the probability of ruin (surviving). The green zone to the left of your threshold is where it holds; the best spot is top-left.
Risk · return map
Each point is one sizing configuration (CAGR vs maximum drawdown), colored by method. The recommended one carries a white ring.
MAR ranking
Bars with the best configurations by MAR, colored by method. Click a bar to select that configuration.
Monte Carlo · final capital
A histogram of the distribution of final capital across the simulations: red = wiped out, orange = below the starting point, green = above. With lines for the starting capital and the ruin level.
Engine: GPU or CPU (Auto)
The Monte Carlo is the heavy part (dozens of configurations × hundreds of simulations × every trade). It can run on the GPU (graphics card), which speeds it up enormously. The Engine selector offers Auto (GPU if available, otherwise CPU), GPU or CPU. The results are identical on both engines — the GPU is simply faster. When it finishes, the status tells you which engine was used.
In Portfolio mode
The same two-column layout: on the left the table with each strategy's best sizing (MAR, CAGR, Max DD, Ruin, and Net 1c / Net opt. / Net ×), sortable by any header, with the selection in orange and ↑/↓ keyboard navigation. On the right, the charts:
- ·Combined equity — the whole portfolio's curve, 1 contract (gray) vs optimized sizing (green), with the before/after summary and the % improvement.
- ·The selected strategy's equity — pick a row (click or keyboard) and you see its individual curve.
- ·Improvement per strategy — bars of the Net × (how much the sizing multiplies each one's profit); their height adapts to the number of strategies and clicking a bar selects that strategy.
Each strategy is optimized on its own capital (there is no capital shared between them — that is a separate portfolio engine).
Sizing does not change which signals have an edge — the search measures that at a fixed size. It changes how much you risk, which is what decides whether you survive. That is why we keep the two apart: first you find the edge, then you choose the size you would hold on to without bailing out.
AniQuant can be tried free for 30 days, with every module and no card.