Why position sizing breaks on sharp moves
A typical position sizing system is calibrated on a calm period: the stop is set as a multiple of the average price range over recent weeks, and position size is derived from the allowable risk per trade — say, a fraction of a percent of capital.
In a flat market, the design converges perfectly: a losing streak is limited, account drawdown is predictable, and the calculation matches the fact on closing.
Failure arrives at the moment of a liquidity gap. Price passes the stop level without trades at that price, the order executes noticeably farther away, and the actual loss exceeds the calculated one several times over.
Market volatility grows multiples within minutes, but the rule continues to calculate size based on a range that no longer exists.
Worse, the failure is rarely isolated. After the first gap, the strategy receives false signals and opens trades in succession, each with the same inflated volume.
Risk per trade ceases to be independent: positions become linked, and account drawdown adds up not by formula but by worst-case scenario.
So position sizing is tested not on historical statistics but on scenarios: a price gap, a thin order book, a cascade of forced closures, a long losing streak.
We break down how this is covered — which limiters are built into the position sizing system and how their triggering is tested.
What a risk-based position sizing calculation provides
The algorithm calculates position size from allowable risk per trade, not from free account balance. Inputs are instrument volatility, distance to the stop, and available liquidity; the output is a volume at which a forecast error costs exactly as much as the limit allows.
Four effects that are tested on historical data before putting the system into operation:
- Predictable drawdown. Risk share per trade is fixed, so a losing streak produces a pre-calculated depth rather than a random one. Risk management becomes a strategy parameter, not a consequence of luck.
- Unified risk sizing. Instruments with different volatility make an equal contribution to portfolio risk: a fast-moving asset automatically receives a smaller volume, a calm one a larger volume.
- Removed class of failures during liquidity gaps. Volume is limited by order book depth and expected slippage, so the entry does not move price or disrupt the protective stop.
- Reproducible results. The same inputs produce the same volume on history, in the test environment, and in live trading — the discrepancy is explainable, not blamed on "the market."
Each point is covered by a historical test and a run in the test environment with real liquidity data, including on-chain pools on Ethereum. What remains is calibration of the risk limit for a specific strategy — we discuss it after measurements.
Comparison of approaches to risk management per trade
The choice of position sizing scheme determines how the system behaves during a losing streak and a sharp change in market regime.
Each option is a compromise between ease of verification and precision of control: the more precise the model, the higher the requirements for input data quality.
| Approach | When it fits | Limitations |
|---|---|---|
| Fixed volume | One instrument, stable liquidity, need predictable accounting of results | Does not account for range expansion: the same position under increased volatility carries multiples more risk; the per-trade limit effectively stops working |
| Volatility-based approach | Instruments with a changing range, transferring rules between markets | Depends on the stability of volatility estimation: during gaps the window lags, and position size is recalculated with a delay |
| Portfolio risk | Several correlated instruments, need an overall per-trade limit | Relies on a matrix of relationships between assets: when the regime changes, relationships break, and total risk turns out higher than calculated |
| Manual rules | Rare trades, hypothesis testing, initial stage | Not reproducible and not scalable: the result depends on the executor's discipline, not the algorithm |
In practice, approaches are combined: the base per-trade limit is set at the portfolio level, within it size is calculated from volatility, and fixed volume remains a hard ceiling that cannot be exceeded under any signals.
We run such a contour on historical data — it is important to see behavior not in a calm period but during a consecutive losing streak, when the main work is done by the limiter, not the model itself.
Implementation stages: from trade audit to regulation
Work proceeds sequentially: first we record how position size is determined now, then transfer the logic into a verifiable scheme, and only then allow it into real trades.
The order is fundamental — without an audit of trading rules, configuration turns into fitting to the past, and without a risk management regulation, the result is not reproducible when the executor or instrument changes.
- Audit of trading rules. We export trade history and reconstruct what actually limited volume: free funds, trader intuition, or a formal limit. Discrepancies between declared and actual behavior are the starting point for calculation.
- Calculation scheme. We fix risk per trade in fractions of capital, the distance of the protective order, and the coefficient linking it to instrument volatility. We get a formula that can be verified, not a descriptive instruction.
- Instrument-specific configuration. We account for the minimum volume step, liquidity, and entry-exit cost: in a thin order book the calculated size may be physically unexecutable, and this is allowed for in advance.
- Testing on historical data. We run the algorithm across several market regimes — trend, sideways, sharp drawdowns. We look not at return, but at drawdown depth and its recovery.
- Testing with small volume. We launch on limited capital and compare calculated size with actual execution: where slippage occurred, where the risk limit triggered.
- Risk management regulation. We provide the limits table, the procedure for reaching the drawdown threshold, and rules for revising parameters when volatility changes.
Each stage is covered by an artifact: an export, a formula, a verification report, a regulation document. Implementation of the algorithm is considered complete when another person can reproduce the calculation from the document — without contacting the author.
Documentation, diagrams, and regulations instead of manual settings
The position sizing algorithm lives not in an engineer's head or in chat, but in artifacts by which the system is maintained for years.
A typical reason a risk model degrades is edits to thresholds directly in the production environment without recording the cause and result: six months later no one can say where the current limit value came from.
Therefore, along with the working contour, the client receives a set of documents by which the calculation can be verified, changed, and handed over to another team.
- Documentation on the algorithm: calculation formulas, input parameters, permissible value boundaries, and system behavior with incomplete market data.
- Risk calculation diagrams: the path of market data from source to position decision, the points where limits are calculated, and the moment when a trade is rejected.
- Rule configurations: files with risk thresholds and restrictions per instrument and per portfolio, with a comment for each parameter.
- Change regulation: who edits thresholds and in what order, which checks are mandatory, how to act during an urgent edit in an emergency.
- Rule version control: each change is a separate version with cause, author, and historical test run result.
- Access policies: separation of roles for editing parameters, reading the journal, and exporting risk reporting.
- Change and incident journal: what changed, what deviation it led to, what restriction was added after review.
- Maintenance instructions: standard operations — recalculating limits, stopping the calculation, rolling back to a previous version of the rules.
All of this sits next to the code, not in separate folders: during the next enhancement, the team sees not the final numbers but the logic from which they are derived.
Case: how drawdown decreased threefold with the same turnover
How it was before implementation
Position size was calculated in a spreadsheet, rules were in a regulation, and limits were checked manually before each entry. In a volatile market, decisions diverged from the regulation: the share of trades exceeding risk reached 6.8%, and maximum quarterly drawdown was 34%.
Editing rules took up to three days: an analyst described the new logic, a developer transferred it into the trading script and ran it on history.
What was changed and what was achieved
The calculation was moved into a separate service: it receives a price stream from the Chainlink oracle, calculates volatility over a rolling window, and outputs a position size that the trading contract can reduce but not exceed.
Daily risk and drawdown limits live in the contract itself and are checked on every entry without human involvement — exceeding risk becomes technically impossible, not "not recommended."
Over a comparable period, drawdown was 11% versus 34%, the share of trades exceeding risk was 0.4% versus 6.8%, and rule edits took 15–20 minutes instead of three days: parameters are changed in the service configuration and picked up without rebuilding the contract.
Turnover remained the same, while resilience to volatility increased through risk management, not through a pause in trading.
How a per-trade risk model differs from fixed volume
A fixed lot sets trade volume but not risk. With the same position size, the loss to the protective level depends on the distance to it, and that distance changes with volatility.
In a calm range, the same lot gives moderate exposure, while during an expansion it gives multiples more, and a series of trades in identical volume accumulates different drawdown that can neither be planned nor compared across instruments.
The risk model works in reverse: first the allowable share of capital per trade and the exit point are fixed, and volume is derived from them.
The position sizing system receives current volatility, a liquidity estimate, and the protective level price as inputs, then calculates size so that potential loss remains within the specified boundary. Recalculation under volatility occurs on every market regime change, not once during setup.
Liquidity enters the calculation as a separate component.
In a thin order book, the actual execution volume differs from the calculated one, so the model preemptively lowers size for instruments with high expected execution price slippage — otherwise calculated risk remains on paper while actual risk grows. On liquid pairs, the same capital allows taking a larger volume without crossing the risk boundary.
In execution, it looks like this: before each trade, the module recalculates position size from fresh data, and model parameters are stored in a verifiable form — a change in volatility automatically changes volume but not the logic.
The result is comparable exposure across different market regimes: drawdown no longer depends on which phase a series of trades landed in, and strategy comparison becomes correct.
Technical concerns: volatility, slippage, liquidity
Engineering concerns rarely concern the idea itself — they are about data and limits of applicability. We address four that come up at almost every meeting.
What to do if trade history is incomplete?
Exports arrive with gaps: some trades are not recorded, others lack an exact timestamp. The algorithm does not fill gaps with guesses — it marks such intervals as unsuitable and excludes them from calibration. You see the share of data that actually participated in the calculation.
How does the system behave when liquidity falls?
With a thin order book, the calculated execution price diverges from the actual one, and slippage eats into the expectation. Therefore position size is calculated from the available volume on the book side, not from notional: liquidity narrows — the position shrinks itself.
Should trading be stopped during implementation?
No. The contour runs in shadow mode on live data: it outputs position size, but orders are not sent to the exchange. Existing strategies work as before, while discrepancies between calculated and actual execution accumulate in a report.
How can the algorithm be verified before going live?
Three steps: a historical run with commissions and slippage, a shadow period on the stream, and a limited account limit. Each has its own transition criterion — rejection rate, deviation of calculated size from actual, behavior in volatile periods. If the criterion is not met, we remain in the previous contour.
Let's discuss the task: where to start implementation
To keep the conversation substantive rather than overview-level, we start with input data for analysis. The more precisely you describe the current risk logic and constraints, the faster we can say what needs rework and what can be left as is.
- current risk logic: how allowable risk per trade is calculated and what sets position size — share of capital, instrument volatility, directional limit;
- an export of trades or orders for a representative period — it shows in which market regimes the calculation goes into drawdown;
- hard constraints: maximum position size, allowable leverage, forced trading halt conditions;
- failure rules: how the position sizing system should behave if price or liquidity data did not arrive or arrived with a delay;
- reporting requirements: which calculation parameters and decisions must be recorded and how often they should be checked;
- environment and access: where the calculation is integrated, which systems it affects, and who on your side is responsible for approvals.
At the first meeting, we will analyze where the boundary lies between position sizing and execution, which checks are needed before each trade, and how the system should behave in borderline market regimes.
In response, we will send a staged implementation plan, a timeline estimate, and a list of what will be required from your side. Describe the task — we will come back with an estimate and a plan.







