Max Exposure Multiple: Cap Total Position Notional
maxExposureMultiplecaps the total notional of the resulting position at equity × multiple. With 1,000 USDT of equity,"maxExposureMultiple": 3holds the position under 3,000 USDT of notional.- The check runs before every entry and every add. An order that would breach the cap is trimmed to what fits rather than rejected.
- Exits are never affected: closes, stop losses, take profits and reduce-only orders always go through.
- Equity includes unrealised PnL, so the ceiling moves with the account. Profits raise it, losses lower it.
- OKX perpetual swaps and dated futures only, linear and inverse. There is no checkbox for it; the field goes into your webhook JSON.
maxExposureMultiple is not in the Trade Command Builder. You enable it by adding one line to the JSON you paste into your TradingView alert.
What it does
Every sizing mode answers one question: how big is this order? None of them answers how big the position is allowed to get, which is what matters when a strategy keeps firing entries in the same direction.
maxExposureMultiple is that second ceiling. It is expressed as a multiple of the equity in the contract's settlement currency (USDT on a BTC-USDT-SWAP, BTC on an inverse BTC-USD-SWAP):
max position notional = settlement-currency equity (incl. unrealised PnL) × maxExposureMultiple
Before each entry or add, TVH values your open position and works out how much of the cap is left:
- If the order fits, it goes through unchanged.
- If the order overshoots, its size is trimmed to the remaining allowance.
- If nothing is left (the remainder is below the exchange's minimum order size), the signal is skipped and the reason lands in your Activity Log.
Enable it
Add one field to the payload. Any decimal above 0 is valid: 0.5 is a deliberately conservative half-equity cap, 3 is a typical setting, 10 is aggressive.
{
"exchange": "okx",
"pair": "BTC-USDT-SWAP",
"instrumentType": "swap",
"apiKey": "okx-main",
"isBuy": true,
"isMarket": true,
"unitsType": "percentWallet",
"unitsPercent": 40,
"leverage": 5,
"maxExposureMultiple": 3,
"token": "YOUR_TOKEN"
}
The field is read per signal, not stored on your account, so it belongs on every entry alert of the strategy. A value of 0 or below is rejected with a message naming the field. Omit the field entirely to turn the cap off.
How the cap is measured
| Term | How TVH reads it |
|---|---|
| Equity | Your OKX equity in the contract's settlement currency, including unrealised PnL. USDT for a linear swap, the base coin for an inverse one. |
| Position | The open position on that pair and in that direction, valued at OKX's mark price. Linear: contracts × contract value × price. Inverse: contracts × contract value ÷ price. |
| Order | The size after sizing has been applied (percent, fixed-quote, risk, absolute), valued at the order price. That is the best bid/ask for market and best-price limit orders, and your price for a fixed limit. |
| Allowance | cap - position for an order that adds to the position. cap + position for an order on the opposite side, which first works the position off and can then build a full cap on the other side. |
Only the open position counts. Resting DCA or limit orders are not exposure until they fill, so they are not measured, and they are not re-checked at fill time either. The cap is evaluated when the signal arrives.
In hedge mode (positionSide: "long" / "short") the two sides are capped independently: each may grow to a full equity × multiple.
How it combines with everything else
| Together with | Behaviour |
|---|---|
unitsType: "percentWallet" / percentBalance / risk / absolute | Sizing runs first, the cap runs after. The cap never grows an order; it is a ceiling, not a sizer. |
useFixedSize + fixedQuoteSize | Same order of operations: the fixed quote amount is computed, then trimmed if it breaches the cap. |
conditionalPyramiding + pyramidingValue | Both checks run, pyramiding first. Each can only shrink the order, so the smaller result wins. conditionalPyramiding caps at a fixed size, maxExposureMultiple at an equity-relative one. |
useDca | The cap applies to the whole signal before the DCA ladder is split, so all legs together stay inside the ceiling. |
leverage | The cap is on notional, not on margin. At 5x, a 3,000 USDT cap is reached with 600 USDT of margin. |
Closes, stop losses, take profits, reduceOnly | Never affected. An exit can only lower exposure, so it is not measured and never trimmed or skipped. |
| Position flip | Allowed. The opposite-side order closes the old position, and the newly opened side is trimmed to fit the cap. |
Worked example
Equity 1,000 USDT with "maxExposureMultiple": 3 gives a cap of 3,000 USDT of position notional. The strategy fires repeated long entries with unitsType: "percentWallet", unitsPercent: 40 and leverage: 5, so each entry asks for roughly 1,000 × 40% × 5 = 2,000 USDT of notional.
| # | Signal | Position before | Cap | Allowance | What TVH does | Position after |
|---|---|---|---|---|---|---|
| 1 | Long entry, wants 2,000 | 0 | 3,000 | 3,000 | Submits the full size | 2,000 |
| 2 | Long add, wants 2,000 | 2,000 | 3,000 | 1,000 | Trims the order to 1,000 | 3,000 |
| 3 | Long add, wants 2,000 | 3,000 | 3,000 | 0 | Skips the signal and logs it | 3,000 |
The strategy can keep firing; the position stops at the ceiling.
The ceiling moves with your account
From the 3,000 USDT position above:
- Price rises 10%. The position is worth 3,300 USDT and carries +300 USDT of unrealised PnL, so equity is 1,300 and the cap is 3,900. That leaves 600 USDT of allowance. The next entry is sized off the higher equity (1,300 × 40% × 5 = 2,600) and is trimmed to 600.
- Price falls 10%. The position is worth 2,700 USDT with -300 USDT of unrealised PnL, equity is 700 and the cap is 2,100, below the position you already hold. Further adds are skipped until the account recovers. Nothing is force-closed: the cap only ever blocks new exposure.
Exits always work
{
"exchange": "okx",
"pair": "BTC-USDT-SWAP",
"instrumentType": "swap",
"apiKey": "okx-main",
"isClose": true,
"token": "YOUR_TOKEN"
}
At the cap, over it after a drawdown, or well below it, the behaviour is the same: a close, a stop loss, a take profit and any reduce-only order execute unchanged. Getting out is never blocked by the cap.
Flipping direction
Long 2,700 USDT of notional, equity 700, cap 2,100. A short entry arrives. Because the order works against the position, the allowance is cap + position, or 4,800 USDT: 2,700 flattens the long, and up to 2,100 opens the new short. Anything beyond that is trimmed away.
What you see in the Activity Log
| Situation | Log line |
|---|---|
| Order trimmed | BTC-USDT-SWAP order size reduced to not exceed the max exposure of 3000 USDT (3x your USDT equity of 1000) |
| Nothing left to trade | BTC-USDT-SWAP signal ignored because the max exposure of 3000 USDT (3x your USDT equity of 1000) is reached |
| Sent on spot | BTC-USDT: maxExposureMultiple is not supported for spot, ignored. The trade then executes normally. |
| Sent with scaled orders | BTC-USDT-SWAP: maxExposureMultiple is not applied to scaled orders, ignored. |
| Equity or position unreadable | Signal NOT executed ... See fail-closed below. |
Every trim, skip and ignore is visible in the Activity Log. Nothing happens silently.
Fail-closed
If OKX does not return your equity, your position, or a usable price, TVH does not guess. The entry is skipped and the reason is logged, because placing an unchecked order is the one outcome a risk cap must never produce. Check your open orders and your position, then re-send the signal once the exchange responds again.
Exits are exempt from this too. A close or a stop loss never runs the check, so a failed read cannot block it.
Scope and limits
- OKX perpetual swaps and dated futures only (
instrumentType: "swap"or"futures"), linear and inverse. Other exchanges ignore the field for now. - Spot and margin signals: a warning is logged and the trade executes normally, uncapped.
- Scaled orders (
useScaledOrders: true): the cap is not applied, and a warning is logged. - MT5: a signal carrying
maxExposureMultipleis rejected, because MT5 does not support the field. - Resting orders are not exposure. A DCA leg placed under the cap and filled much later is not re-measured.
Copy trading
The value travels with the broadcast: if the signal source sets maxExposureMultiple, followers inherit it. A follower who sets their own value always wins, the same rule that applies to size, leverage and stop loss in the override hierarchy. If you want a hard ceiling on what a provider can build in your account, set it yourself rather than relying on the broadcast.
Use cases
- Bounded liability per strategy: one number caps what a strategy can be holding, whatever its entry logic does.
- Pyramiding runaways: a stuck alert, a flapping indicator or a repeated webhook stacks entries up to the cap and no further.
- Accounts that grow and shrink: the ceiling is a multiple of equity rather than a fixed number, so it widens as you profit and tightens as you draw down.
- Existing strategies: Pine script, alert conditions and sizing stay as they are, the cap is one extra field on the payload.
- Partial participation near the ceiling: an oversized order is trimmed rather than rejected, so the part that fits is still traded.
Common pitfalls
- Sending it on spot.
instrumentType: "spot"logs a warning and trades uncapped. The cap needs a position to measure, so use it onswaporfutures. - Confusing notional with margin. The cap is on position notional. At 10x leverage a 3,000 USDT cap commits only 300 USDT of margin, so set the multiple against the exposure you want, not the capital you want to commit.
- Expecting it to close things. It never reduces an existing position. Sitting above the cap after a drawdown is normal and only blocks new entries.
- Setting it once and forgetting it. It is read per signal. Leave it off one alert of the strategy and that alert is uncapped.
- Using
0to disable.0and negative values are rejected with an error. Omit the field instead.
Related
- Conditional Logic:
preventPyramidingandconditionalPyramiding, the fixed-size siblings of this cap. - Sizing: how the order size is computed before the cap trims it.
- OKX: instrument types,
positionSide, demo trading. - Activity Log: where trims and skips show up.