Resize Open Position Webhook Explained
Learn how the resize webhook action sets your target position size and lets TradersPost calculate the difference order automatically.
Marketing
The resize webhook action follows one rule: send the position size you want, not the number of shares or contracts to trade. TradersPost reads the current open position, computes the difference, and submits only the order needed to reach your target. That single mechanic covers every scenario a strategy encounters, from entering flat to scaling in, partially reducing exposure, or closing entirely.
Understanding how resize handles resting bracket orders, which platform settings affect it, and how quantityType interacts with the target calculation will help you build cleaner alert logic and avoid leaving positions unprotected after a partial exit.
One Rule Explains Every Case
Target size, not trade size
The resize action takes the absolute quantity you want the position to end at. If you hold 3 contracts and send a resize with quantity 5, the platform submits a buy order for 2, not 5. If you hold 5 and send quantity 2, it submits a sell order for 3. The payload always carries the desired end state, and the platform works out what order to place.
This matters because it eliminates the mental arithmetic of computing incremental amounts in Pine Script or any other alert source. Your signal logic only needs to know the target size, not the current position.
quantity is required for resize
Unlike most actions where quantity is optional and defaults to the strategy subscription setting or 1, resize requires a quantity field. Without a target size, the platform has nothing to compare against the open position and the signal will not process as intended.
A quantity of 0 is valid for resize and instructs the platform to flatten the position entirely. This is the one case where omitting a quantity on a resize signal is guaranteed to cause a problem: the signal needs a number, even if that number is zero.
The Four Behaviors a Resize Produces
Growing an existing position
When the target quantity exceeds the current open position size, the difference order is an add. The platform buys or sells additional contracts or shares to reach the target. This is mechanically identical to sending an add action for that difference amount. Resting take profit and stop loss orders are left untouched when a resize grows a position, which matches how the add action has always behaved.
Shrinking an existing position
When the target quantity is less than the current position size, the difference order is a partial exit. Existing take profit and stop loss orders protecting the full position are cancelled before the partial exit order is submitted. If part of the position remains open after the shrink, new protection orders must arrive in the same payload or a follow-up signal, because the old bracket has been removed.
Flattening with target zero
Sending quantity 0 on a resize signal closes the entire open position, equivalent to an exit action. All resting bracket orders are cancelled as part of the flatten, the same sequence that applies to any full exit.
Entering from flat
If no position is currently open, a resize signal behaves as an entry, opening a new position at the specified target quantity. The action field in the payload still says resize. The platform detects the flat state and treats the full target quantity as the entry order, so no special handling is needed on the signal side.
Resting Orders and the Shrink Case
Why brackets are cancelled on a shrink
A stop loss or take profit placed at entry is sized for the full position. After a partial exit, that bracket no longer matches the remaining exposure. If the original stop loss were left in place after reducing from 5 contracts to 2, it would still be sized to exit 5, creating an overshoot that would reverse the position rather than protect it.
TradersPost cancels existing take profit and stop loss orders before submitting a partial exit when a resize shrinks the position, so the remaining open position is unprotected until new bracket orders arrive. This is the behavior that generates the most support questions, and the fix is straightforward: include new protection in the same payload.
Sending new protection after a shrink
Include stopLoss and takeProfit fields in the resize payload to re-establish protection for the remaining position in a single webhook call. All sub-fields documented in the webhook specification are available for both objects.
- For stopLoss: stopPrice, limitPrice, trailAmount, trailPercent, percent, amount, pnlAmount, and type
- For takeProfit: limitPrice, percent, amount, and pnlAmount
If the resize is growing the position instead of shrinking it, those resting orders are left in place and no new protection needs to be sent unless the strategy logic requires updated levels.
Settings That Gate a Resize
Ignore exit signals and shrinks
The Ignore exit signals setting blocks a resize that would shrink the position or flatten it entirely, because those operations are partial or full exits. A resize that grows the position is not blocked, since growing is classified as an add, not an exit.
This asymmetry is useful: a strategy can be configured to only ever scale in, never out, via the resize action. Any shrink or flatten signal sent while Ignore exit signals is active will be dropped before an order is submitted.
Allow add to position does not gate resize
The Allow add to position setting controls whether the add action can increase an open position, but it does not gate resize signals at all. A resize that grows a position will proceed regardless of how Allow add to position is configured.
Traders who want to restrict scaling should use Ignore exit signals logic or strategy-level trading window controls rather than relying on Allow add to position to block a resize.
Expressing Target Size Beyond Fixed Quantity
quantityType options for resize
A resize accepts three quantity types: fixed_quantity, dollar_amount and percent_of_equity. The other three are rejected on a resize, with the errors invalid-risk-dollar-amount-action, invalid-risk-percent-action and invalid-percent-of-position-action. When quantityType is dollar_amount, the platform converts the dollar value to a share or contract count using the current price, and that count becomes the target end size.
risk_dollar_amount and risk_percent size a position from the distance to its stop, which is why a resize refuses them: a resize states the size you want to end at, so there is nothing to size from risk. Use them on the entry that opens the position instead.
Why percent_of_position cannot resize
percent_of_position calculates a quantity as a percentage of the currently open position, and it is accepted on buy, sell, exit and reverse. A resize rejects it with invalid-percent-of-position-action. To halve a position, send a resize with percent_of_equity or a fixed_quantity naming the size you want to end at, or send an exit with percent_of_position 50 instead.
This is particularly clean for de-pyramid strategies where each tier closes a defined fraction of the remaining position rather than a fixed number of shares or contracts.
Using Sentiment as a Directional Guard
What sentiment does in a resize payload
The sentiment field accepts bullish, bearish, or flat, and describes the direction of the order the resize will send, not the position you expect to hold afterwards. On a reduction that is the opposite of the position's own direction, so trimming a long sends a bearish order. If the declared sentiment does not match the order the resize works out, the signal is rejected before an order is submitted.
This acts as a sanity check. A resize intended to reduce a long position declares sentiment bearish, because the order that trims it sells. Declaring the direction you expect stops a signal going through when the platform has worked out the opposite, which is what would happen if the open position were not what the strategy assumed.
flat sentiment as an alternative to zero quantity
Sending sentiment flat on a resize signal with quantity 0 is equivalent to requesting a full exit: no position should remain open after execution. Using sentiment flat without quantity 0 still requires an explicit quantity, because resize always needs a target size to calculate the difference order.
Sentiment is optional. Most resize payloads omit it and rely on the quantity alone to define the target.
When to Use Resize vs. Other Actions
Resize vs. add and exit
Use add when the strategy always scales by a known fixed increment and does not need to reason about the current position size. Use exit when the strategy always closes the entire position and no partial-close logic is needed. Use resize when the strategy needs to set the position to a specific absolute size regardless of what is currently open, covering entry, scaling, partial exit, and full exit in a single action type.
Pyramid and de-pyramid strategies
Strategies that scale into a position in defined tiers can express each tier as an absolute target quantity with resize, rather than computing incremental add amounts in Pine Script. Instead of tracking how many contracts are already open and calculating the delta, the alert just carries the desired end state: 1 contract at tier one, 2 at tier two, 3 at tier three.
Strategies that reduce exposure as price moves toward a target can express each reduction level as a decreasing target quantity, letting the platform handle the partial exit math. Resize at 2, then 1, then 0 expresses a full unwind in three signals without any position-tracking logic on the alert side.
Minimal payload for a resize
A valid resize payload requires only ticker, action set to resize, and quantity. Every other field is optional and follows the same rules it does for other actions.
{
"ticker": "AAPL",
"action": "resize",
"quantity": 3
}
Optional fields like orderType, limitPrice, stopPrice, timeInForce, takeProfit, stopLoss, sentiment, and quantityType all follow the same rules they do for other actions. Including price or signalPrice is recommended to enable slippage tracking in the trade signal logs.
Bottom Line
- Resize takes the position size you want to end at, not the amount to trade. TradersPost calculates and submits the difference.
- Growing a position leaves resting bracket orders in place. Shrinking cancels them before the partial exit, so include new stopLoss and takeProfit fields in the same payload if part of the position remains.
- A resize from flat opens a new position. A resize with quantity 0 closes the entire position.
- Ignore exit signals blocks shrinks and flattens but never a grow. Allow add to position does not gate resize signals at all.
- quantityType works the same way it does for other actions, including percent_of_position for relative targets and risk-based types that require a stopLoss.
If you are building automated strategies on TradersPost and want to test resize logic before going live, use paper trading mode to verify that the difference orders, bracket cancellations, and new protection levels all behave as expected before connecting to a live broker.
Frequently Asked Questions
What happens to my stop loss when I resize a position smaller?
TradersPost cancels any resting take profit and stop loss orders before submitting the partial exit order. The remaining open position has no protection after the shrink unless you include new stopLoss and takeProfit fields in the resize payload.
Can I send a resize signal when I have no open position?
Yes. If the position is flat, a resize signal opens a new position at the target quantity, behaving like an entry. The action field still says resize; the platform detects the flat state and submits the full target quantity as the entry order.
Does Allow add to position block a resize that grows my position?
No. The Allow add to position setting does not gate resize signals at all, in either direction. Only Ignore exit signals affects resize behavior, and only for signals that would shrink or flatten the position.
Can I use percent_of_equity or dollar_amount as the quantityType on a resize?
Yes, within limits. A resize accepts fixed_quantity, dollar_amount and percent_of_equity, and rejects risk_dollar_amount, risk_percent and percent_of_position. The platform resolves the accepted type to an absolute share or contract count, then compares that count to the open position to determine the difference order.
Does a resize that grows a position cancel my existing take profit and stop loss?
No. When a resize grows the position, resting take profit and stop loss orders are left untouched. This matches how the add action behaves: existing bracket orders remain in place and the new larger position is only partially covered by them unless the strategy logic sends updated protection.