Entries, stops and sizing
Once a wall is confirmed, Wallbot plans one order: an entry just in front of the wall, a stop behind it, and the highest leverage whose liquidation price stays safely behind that stop. The trade is then sized from your balance and only placed if every check passes.
Two entry models
entry_model chooses how entries are planned:
- Wall hug (default, shown as "Wall hug (max leverage)"). The entry rests a few ticks in front of the wall and the stop sits behind it. The leverage starts at the highest the exchange allows and steps down until every check passes. The fixed leverage settings are not used.
- Loss budget (older model). The leverage comes from
leverage_mode,leverageandleverage_cap. The entry is placed far enough from the wall that a stop-out costsmax_loss_pctof the margin.
The rest of this page describes wall hug, the default.
Warning. Wall hug trades at very high leverage. At 125x a move of about 0.8% against you wipes out the margin. Slippage, gaps and exchange outages can make a loss larger than planned. Try it in paper mode first.
The entry in front of the wall
The entry is a post-only limit order (maker) at entry_ticks (default 1) ticks in front of the wall's near edge: above a support wall for a long, below a resistance wall for a short. Your order then sits just ahead of the big orders, so it fills before price reaches them.
The near edge comes from the wall's core, not from the raw zone. The core is the fewest largest price levels that together hold wall_core_pct (90%) of the zone's size. Small stray orders at the edge of the zone are ignored, so they cannot pull the entry or push the stop further out. If price is already at or past the planned entry, the plan is skipped with "Price is already inside the entry zone (would chase)".
Example
Illustrative numbers, not a real trade. A support zone 99.95 to 100.00 holds 4 coins at 99.95, 300 at 99.96, 250 at 99.97, 400 at 99.98 and 3 at 99.99, so 957 in total. 90% of that is 861.3. The largest levels, 400 + 300 + 250 = 950, already reach it, so the core is 99.96 to 99.98. The near edge is 99.98 and the far edge 99.96. With a 0.01 tick the entry is 99.99.
The stop behind the wall
The stop is an exchange-side stop-market order, placed the moment the entry fills. stop_mode decides where it goes:
stop_mode | Where the stop goes | Extra checks |
|---|---|---|
wall_pct (default) | stop_beyond_wall_pct (0.5%) behind the wall's far edge, rounded away from the entry | The liquidation buffer (below) |
near_liquidation ("Just before liquidation") | As close to the liquidation price as the buffer allows. A stop-out loses most of the margin that liquidation would take | The stop must still be behind the wall's far edge, or that leverage fails |
wall_ticks ("A few ticks behind the wall") | stop_ticks (3) ticks behind the far edge | Liquidation at least liq_cushion_pct (0.3%) beyond the stop, and the loss at the stop at most max_loss_pct (50%) of margin |
With a wall stack, "the wall's far edge" means the far edge of the farthest wall in the stack. stop_trigger chooses which price fires the stop (by default last price on Binance, fair price on MEXC).
Liquidation checks
A stop is only useful if it fires before the exchange liquidates the position. Every wall-hug plan checks this with care.
Binance's own formula
Wallbot computes the liquidation price with Binance's published formula for isolated positions, in the planner, the paper broker and the backtester alike. The maintenance margin rate comes from the leverage bracket that the position falls into. For a new position, the isolated wallet is the margin minus the whole opening fee, which is the safer assumption. Live, the bracket table and your commission rates are read from your account. Paper mode without a key uses one assumed bracket and default fees, and the dashboard says so.
The buffer before liquidation
The stop's fill price, after the planned stop slippage (below), must sit before the liquidation price by at least the larger of:
liq_buffer_pct_of_margin(8% of margin, turned into a price move at that leverage), andliq_min_ticks(10 ticks),
plus a learned safety offset. Live trading records how far Binance's real liquidation price differs from Wallbot's estimate, and raises the offset when Binance turns out closer.
Planned stop slippage. Until a coin has observed_slippage_min_samples (5) live stop fills, the planner assumes paper_slippage_bps (5 bps). After that, with observed_slippage on (default), it uses the observed_slippage_pct (90th) percentile of that coin's real stop-fill slippage, never less than paper_slippage_bps. A coin whose stops slip more needs more room before liquidation, so it may get a lower leverage. Where the entry and the stop go does not change. The value used is logged per trade, for example "p90 of 7 live stop fills = 9.0 bps".
Isolated margin
Every trade is isolated, so one trade can never draw on your other positions. Before each entry on Binance, the bot checks the coin's margin type, switches it to isolated if needed and reads it back. If it cannot confirm isolated margin, the wall is skipped. After a live fill, it reads Binance's real liquidation price. If the stop is not safely before it, the bot adds isolated margin once, at most max_added_margin_pct (50%) of the original margin. If that is not enough, it moves the stop inward. If even that would put the stop in front of the wall, it closes the position at market and pauses new entries.
Picking the leverage, from the highest down
Wallbot tries the highest leverage first and steps down one leverage at a time until a plan passes. The starting point is the coin's exchange maximum, limited by:
hug_max_leverage, if set (0 = no cap);- the highest leverage in the account's bracket table, re-read every
leverage_bracket_refresh_min(60 minutes) and at once after a leverage mismatch or a leverage-related rejection; - a lower leverage Binance allowed at the last leverage check (see below);
- the leverage already set on the coin, when the other side of that coin has a trade (see Both sides).
At each leverage the plan must pass, in this order:
- Fees cap. Round-trip fees, maker in plus taker out, as a share of margin are (maker fee + taker fee) x leverage. They must be at most
max_fee_pct_of_margin(15%). With 0.02% maker and 0.05% taker, fees are 0.07% x 125 = 8.75% of margin at 125x, which passes. - Exchange minimum. The position, after rounding the quantity down to the coin's step, must reach the exchange's minimum size.
- Stop mode checks from the table above, and the liquidation buffer.
- Bracket. The position's size must fall in a bracket that allows this leverage. The liquidation check then uses that bracket's maintenance rate.
The log names the chosen leverage and why the next higher one failed, for example: "Wall hug at 91x (92x: Stop 99.46 (fill 99.4103 after 5 bps slippage) is 9 ticks before liquidation 99.3204 at 92x; needs 10): stop 0.5% behind the wall, 15 ticks before liquidation; ...".
wall_pct stop. The entry sits just in front of the wall, the stop behind it, and liquidation further out by at least the buffer. Not to scale.Worked example
Illustrative numbers, not a real trade. The wall from the example above, price 101.00, a 0.01 tick, an exchange maximum of 125x, maker 0.02%, taker 0.05%, a 0.4% maintenance rate, 1,000 USDT to size from and the default settings.
| Item | Value |
|---|---|
| Entry | 99.99 (1 tick above the near edge, 99.98) |
| Stop | 99.96 x 0.995 = 99.4602, rounded down to 99.46 |
| Leverage | Every leverage from 125x down to 92x fails the liquidation buffer. At 92x the stop's fill is 9 ticks before liquidation, and 10 are needed. 91x passes |
| Margin and size | 2% of 1,000 = 20 USDT. 20 x 91 / 99.99 = 18.20 coins, rounded down to the 0.1 step: 18.2 coins, 1,819.82 USDT notional, 20.00 USDT margin |
| Liquidation | about 99.31, 0.68% below the entry |
| Loss at the stop | about 11.82 USDT, 59% of margin, fees and slippage included |
| Fees | about 6.3% of margin for the round trip |
The same wall with the other stop modes: near_liquidation keeps 125x with the stop at 99.76 (liquidation about 99.61, loss at the stop about 44% of margin). wall_ticks keeps 125x with the stop at 99.93 (loss about 22%). The exact figures depend on the coin's maintenance rate, its brackets and your fees.
Reward/risk check
With the counter-wall take profit on (tp_mode = counter_wall), the planner looks at the nearest confirmed wall on the other side: resistance above a long, support below a short. The take profit would sit tp_ticks (2) ticks in front of it. The setup is skipped when
(take-profit distance - round-trip fees) / stop distance is below min_reward_risk (1.0).
Setups with no counter wall are allowed. They run on the stop and trailing stop only. The counter wall is read once here, for this check. Take-profit tracking only starts after the fill (see Counter-wall take profit).
Example
Illustrative numbers. A resistance wall's near edge is 101.50, so the take profit would be 101.48. Fees in price terms: 99.99 x 0.0002 + 101.48 x 0.0005 = 0.0707. Reward/risk = (101.48 - 99.99 - 0.0707) / (99.99 - 99.46) = 1.4193 / 0.53 = 2.68, above 1.0, so the setup passes. A failing setup logs, for example, "Skipped wall: reward/risk 0.80 below 1 (take profit ... before the wall at ..., stop ...)".
Sizing
The margin for each entry is margin_pct (default 2%) of the sizing base. sizing_base sets that base:
available_plus_own_pending(default, "Available + own pending entries"): the exchange's available balance plus the margin held by Wallbot's own pending entry orders. Without this, every resting entry would make the next one smaller. Open positions, your manual orders and positions, fees and funding still reduce the base.available: the available balance alone.
When the live safety applies, the base is then capped at safety_balance_cap_usdt (0 = no cap). Money you deposit for manual trading then does not make the bot's trades bigger. Quantities are always rounded down to the coin's step, so rounding only ever makes a position smaller.
Example
Illustrative numbers. The exchange shows 940 USDT available, and one Wallbot entry is pending with 60 USDT margin. The base is 940 + 60 = 1,000, and the margin is 2% of that, 20 USDT. With a live balance cap of 500, the base would be 500 and the margin 10 USDT. The log line reads "Entry sizing: available 940.00 + own pending 60.00 -> base 1000.00; margin 20.00 (2%); free at the check ...".
The free-balance gate: full size or nothing
Just before the order goes out, with require_free_margin on (default), the bot reads the exchange's free balance. Positions and pending orders have already reduced it. It must cover the planned margin plus free_margin_buffer_pct (5%) for fees. If not, the entry is skipped with the reason, for example "not enough free balance: need 21.00, free 14.00 (pending entries hold 6.00, open positions 10.00)". The order is never shrunk to fit.
If Binance still rejects an entry for insufficient margin (error -2019), the bot logs it once and does not retry that wall for 5 minutes. That prevents a retry loop.
Leverage is held while an order or position exists
Binance sets leverage per coin. Changing it re-margins any resting order or open position on that coin. With leverage_hold_while_resting on (default), Wallbot never changes a coin's leverage while it has its own pending entry or open position there.
- A plan that needs the leverage already set goes ahead.
- A re-plan that needs a new leverage waits. The old entry is cancelled first, and only once that cancel is confirmed is the new leverage set and the new entry placed. The log says "Leverage set to 91x after the old entry was cancelled".
- Any other plan that would need a different leverage is skipped with a reason such as "100x needed but Wallbot's long entry rests on this coin at 91x: the leverage is not changed under it".
The real leverage is checked before every order
With verify_leverage_before_entry on (default), Wallbot reads the coin's real leverage on Binance right before every entry, re-place and re-plan:
- If it matches the plan, the entry goes ahead.
- If it differs, Wallbot sets the planned leverage again ("Leverage re-set to 91x (Binance had 20x)"), never under its own resting order or open position on that coin. In that case the entry is not placed.
- If Binance refuses or allows less, the entry is not placed and the next evaluation plans at the leverage Binance allows, with margin, liquidation and every check recomputed.
- A leverage that differs from the one Wallbot last set was changed outside Wallbot: it sends "LEVERAGE CHANGED coin: Ax -> Bx", at most once per coin per hour. See Leverage changed outside Wallbot.
While Wallbot has orders or positions, it also compares the margin Binance reserves for them with the planned margin every margin_check_interval_s (60 s). More than margin_reserve_alert_pct (20%) above plan sends a high-priority "MARGIN" alert; nothing is cancelled.
All the checks in order
A confirmed wall becomes a placed entry only if it gets through all of these:
- The wall was not tried within
wall_retry_cooldown_s(30 s). - The coin and side are free, the open-trade limits and the correlation guard allow it, and no loss cap or rate limit blocks entries (see Coins, movers and limits).
- The wall anchors its stack: it is the nearest confirmed wall.
- The support/resistance filter passes.
- Isolated margin is confirmed and nothing on the coin belongs to someone else.
- A leverage passes the fees cap, the minimum size, the stop checks, the liquidation buffer and the bracket, and it can be set without changing the leverage under an existing order.
- The reward/risk check passes, and the optional
flow_filterif you set one. - Right before the order, the coin's real leverage on Binance matches the plan, or can be set to it (leverage check).
- The free balance covers the margin plus the buffer.