🧪 Portfolio Optimizer
The question it answers: with this strategy and this universe, which combination of leverage, sizing method, position limits and signal selection would have produced the best robust result — not the flashiest one, the one that holds up out of sample?
You get in through Stocks → Backtest → 🧪 Optimizer (it inherits the strategy, the stocks you ticked and the portfolio card's settings).
Why it is fast: the same recipe in thousands of pans
The strategy's signals do not depend on any of the swept parameters: they are collected once (the slow phase, and it stays cached in the window) and each combination is just a re-simulation of the same raw material. The result: around 10,000 combinations in some 10 minutes the first time — and near-instant sweeps after that.
Leverage, min./max. value per position and Max. positions as ranges; 6 sizing methods (Equal Weight, % of capital, fixed number of shares, fixed amount, % risk and $ risk — the risk ones with a synthetic stop at k×ATR) and 3 selections (ROC momentum, lowest volatility, random averaged over several seeds) as checkboxes.
If some limits never actually bite (a fixed 10k amount with a 50k cap, say), dozens of combinations are THE SAME strategy: they are grouped into one row marked ×N with the range collapsed. 30 copies are not 30 pieces of evidence.
The anti-luck defenses (built in, not optional)
Trying thousands of configurations on the same history is a machine for finding coincidences. Which is why the module is armored from birth:
- ·IS/OOS by dates — every combination is simulated in both stretches with fresh capital. The default ranking is 🛡️Rob: the WORSE Ret/DD of the two — the gem is not the best in IS, it is the one that holds up outside.
- ·Anti-overfitting map — an IS↔OOS scatter synced with the grid (click a point = select its row and vice versa): hugging the diagonal = robust; bottom-right = IS mirages.
- ·💀 Blowups, undisguised — with leverage the equity can reach 0 (a margin call). Those combinations sink to the bottom of the ranking and count as the worst value in every median and in the heatmap: a cell full of ruins cannot come out green for "survival".
- ·🔥 Sensitivity heatmap — pick two parameters and see the median robustness per cell. Look for green plateaus, not lone peaks: an isolated peak is luck; a plateau is an edge that tolerates getting a parameter slightly wrong.
The card, the reports and their charts
Select a row (mouse or arrow keys, PgDn, Home/End) and you see its parameters and its equity curve simulated on the fly, with the OOS stretch shaded.
Instant and in plain language: the verdict, the robust winner, the methods and leverages compared, which parameters matter (the drivers) and IS↔OOS coherence.
The AI analyzes the sweep's summary and writes its own report. Both include 4 embedded charts with commentary (equity of the top 5, CAGR↔DD frontier, robustness histogram, methods) and are saved as self-contained HTML.
Sizing rarely creates the edge — the signal selection does that — but it does decide how much you suffer and whether you survive to collect it. Use the optimizer to find the zone where almost everything works, not the exact peak. And remember: the cost of financing the margin is not modeled — mentally subtract several points of annual CAGR from the leveraged combos.
AniQuant can be tried free for 30 days, with every module and no card.