Partial Position Close Examples
Examples of scaling out of positions. close_ratio is a fraction of the trade's original filled size, capped at what is still open. See Partial close for the full rules.
Close 50% at First Target
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "CLOSE",
"close_ratio": 0.5,
"reason": "First take profit target reached"
}
A CLOSE with close_ratio below 1 is executed as CLOSE_PARTIAL. You can also send CLOSE_PARTIAL directly.
Three-Step Exit Strategy
// Step 1: close one third of the original size at TP1
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "ETHUSDT.P",
"position_side": "CLOSE_PARTIAL",
"close_ratio": 0.33
}
// Step 2: close another third of the original size at TP2
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "ETHUSDT.P",
"position_side": "CLOSE_PARTIAL",
"close_ratio": 0.33
}
// Step 3: close whatever is left at TP3
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "ETHUSDT.P",
"position_side": "CLOSE"
}
Because the ratio refers to the original size, two signals with close_ratio: 0.5 close the whole position.
Close 25% and Tighten the Stop on the Rest
// Close 25% of the original size
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "CLOSE_PARTIAL",
"close_ratio": 0.25
}
// Move the stop (and keep the take profit) for the remaining 75%
{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "MOVE_STOP_LOSS",
"stop_loss_price": 50500,
"take_profit_price": 56000
}
After a partial close, the stop-loss and take-profit are placed again for the remaining quantity automatically. The second signal is only needed to change their prices.
Multi-Symbol Bot: Close Part of One Coin
{
"strategy_key": "your_multi_symbol_bot_key",
"exchange": "BINANCE",
"ticker": "SOLUSDT.P",
"position_side": "CLOSE",
"close_ratio": 0.5
}
Only the coin named in ticker is affected.