Wallbot

Protection, re-plans and exits

After an entry is placed, Wallbot keeps reacting to the order book. It re-plans a pending entry when the walls change, re-anchors an open trade when its wall goes, takes profit in front of the counter wall, trails the stop, and moves the stop to breakeven when no wall protects the trade any more.

What "protected" means

A wall only helps a trade if price has to get through it before reaching the stop. With protection_by_wall_between on (default), a position counts as protected only if a confirmed wall on its own side starts between the current price and the stop:

A wall behind the stop protects nothing. Price would hit the stop first. Walls on the other side never count as protection either: bids under a short or asks over a long are counter walls, the take-profit targets. The trade card shows "Protected by wall lo–hi" or "Not protected by a wall · stop only / stop at breakeven".

Two longs side by side. Left: a support wall sits between price and the stop, so the trade is protected. Right: the stop has moved above the wall, so the wall is behind the stop and the trade is not protected Protected price wall stop price must get through the wall first Not protected price stop (moved up) wall the stop fires before the wall matters
Left: the wall lies between price and the stop, so it protects the trade. Right: the wall is behind the stop, so the trade runs on the stop alone and the breakeven rule applies.

This definition drives the breakeven rule further down. A protected position keeps its stop behind the wall. A position that is not protected, and is far enough in profit, has its stop moved to breakeven.

Re-plans of a pending entry

While an entry is still resting, the walls around it can change. Wallbot re-plans when a closer wall appears, after the front wall is pulled, and when its stack loses a wall. With nearest_side_priority on it can also switch to the other side. A re-plan always runs the full planning logic again: a rebuilt stack, a new entry, stop and leverage, and every entry check. For a closer wall the old order is only replaced if the new plan passes; when the stack lost a wall, the old order is cancelled unless the new plan is the same.

A closer wall appears

With replan_on_closer_wall on (default), a new confirmed wall on the entry's own side that sits between price and the pending entry triggers a re-plan. For a long that means a higher bid wall below price. For a short it means a lower ask wall above price. The new wall must be confirmed and must become the new nearest wall. The old entry is cancelled, and the new one placed, only after the new plan passed. If the old entry filled in the meantime, the fill wins and no new entry is placed.

The log and a trade-update notification say "Re-planned (a closer confirmed wall appeared): entry ... -> ..., stop ... -> ..., leverage ...x -> ...x". If the closer wall is not used, log_replan_reasons logs why, for example "SHORT XRPUSDT: closer wall 0.5412-0.5415 not used: reward/risk 0.80 below 1; keeping the pending entry at 0.5409".

Limits on closer-wall re-plans

After the front wall is pulled

When the wall in front of a pending entry is pulled or fades, the entry is always cancelled. With replan_after_front_pull on (default) and other confirmed walls still on that side, the bot waits replan_cooldown_s (60 s). Then it tries one new entry on the nearest remaining confirmed wall. A wall that reappears during the wait is a new wall and must confirm again. The log reads "Front wall pulled; 1 confirmed wall(s) remain: re-planning in 60 s". With the setting off, the normal entry logic may place a new entry on the remaining walls right away.

When the stack loses a wall

With replan_on_stack_loss on (default, wall hug only), a pending entry on a stack of several walls is planned again at once when one of its walls fades, is pulled, absorbed or broken before the fill. The same happens when the front wall is absorbed or broken; a pulled or faded front wall keeps the wait above.

Switching to the closer side

Without both sides, a pending entry on one side of a coin blocks a setup on the other side. With nearest_side_priority on (off by default, wall hug only), a setup on the other side that passes every entry check takes over when its entry is at least side_switch_closer_pct (30%) closer to the price than the pending one:

If the new entry cannot be placed after the cancel, "SIDE SWITCH FAILED" is sent and the old entry is not re-placed automatically.

When the anchor wall goes after the fill

An open trade is tied to its anchor wall. What happens when that wall ends depends on how it ended (see What happens to a wall).

Pulled

pulled_wall_exit decides:

The hold rule (hold_unprotected_in_profit, on) applies when no backup wall is left. If the trade is up at least min_net_roe_to_hold_unprotected (5% of margin, after fees), it stays in. Its stop moves to breakeven, unless the trailing stop already locks more. Trailing and the take profit stay active. Below that threshold the trade exits at market: "Wall vanished after entry: exiting at market".

Warning. At high leverage the entry fills well before price reaches the wall, and spoofers tend to pull when price gets close. An exit after a pull can therefore cost a large share of the margin. Watch this number in paper trading.

Absorbed

An absorbed wall was eaten by trades, which is a real fight at that price, not a spoof. With on_absorbed_after_fill = protect (default), the bot never exits because of it:

none only marks the wall as absorbed and takes no action.

Faded or broken

A fade keeps the trade unless exit_on_wall_faded is on, in which case it is handled exactly like a pull. A broken wall needs no action: price went through the wall and the exchange stop does its job.

Stack walls disappearing

With tighten_stop_on_stack_change on (default), when walls of an open trade's stack disappear and the farthest remaining wall is closer to price, the stop moves to that wall's far edge plus stop_beyond_wall_pct. It only moves if that tightens the stop by at least min_stop_tighten_ticks (5). It never loosens a stop, never touches a trailing or breakeven lock, and never changes the leverage.

Counter-wall take profit

With tp_mode = counter_wall (default), the target is the nearest confirmed wall on the other side, in the direction of profit: resistance above a long, support below a short. Only counter walls within wall_max_dist_pct of price are used.

The target

Arming

The take profit is tracked locally. The exchange order, a close-only limit order, is only placed when price comes within tp_arm_distance_pct (0.3%). If price jumps past the target before the order is armed, the bot closes at market. If the take profit fills partly, the stop is resized to what is left, and trailing continues on the rest.

When the counter wall changes

Opposite entry after the take profit

When the take profit fills in front of a counter wall, price has just stopped at that wall. With tp_opposite_priority on (the default), that same wall gets priority for an opposite entry for tp_opposite_priority_s (90 s): a short in front of the resistance after a long, a long in front of the support after a short.

Real example. In a replay of 1 Oct 2026 on HYPEUSDT the take profit filled at 91.316 in front of a wall at 91.31-91.356. At that moment the wall no longer passed the size rules, so the window ended with no short; a quarter of a second later the wall was pulled (98% cancellation). The check kept the bot from shorting in front of a spoof.

Trailing stop

Trailing switches on once the trade's best ROE (return on margin, before fees) reaches trail_activate_roe (default +100%). From then on the stop locks part of the best ROE reached. trailing_mode decides how much:

ModeLockBest ROE +150%+200%+400%
fixed_gap (default)Best ROE minus trail_gap_roe (50 points)+100%+150%+350%
keep_pcttrail_keep_pct (50%) of the best ROE+75%+100%+200%

With a fixed gap, the room for a pullback stays the same however far the trade runs. With a kept share, the room grows with the profit. With the defaults, both lock +50% at the +100% trigger, and above it keep_pct leaves more room than fixed_gap.

Both modes follow the same rules:

The log reads, for example, "Trailing stop moved to ... (locks +150% ROE, peak +200%; fixed gap 50 ROE points behind the best)". With persist_trailing_state on, the "trailing active" marker survives a restart, so the trade card keeps showing "(trailing)".

Two charts of the same trade's ROE over time. Left, fixed gap: the stop lock follows 50 points below the best ROE and ends at plus 210 percent. Right, keep share: the lock is half the best ROE and ends at plus 130 percent, leaving more room fixed_gap (gap 50) +100 0 +260 lock +210% time keep_pct (keep 50%) +100 0 lock +130% time
The solid line is the trade's ROE, the dashed line the ROE the stop locks. Trailing starts at the +100% trigger (dotted). The best ROE here is +260%: a fixed 50-point gap locks +210%, keeping half locks +130%. Illustrative path.

Breakeven and hold rules

Several rules move the stop to breakeven. They all use the same two ideas.

Example

Illustrative numbers. A long filled at 100.00 with maker 0.02%, taker 0.05% and 5 bps slippage: 100.00 x 1.0002 / (0.9995 x 0.9995) = 100.12, rounded up to the next 0.01 tick, 100.13. Without the slippage part the breakeven stop is 100.08.

Where breakeven is used:

SituationRuleBelow the hold minimum
No wall protects the position (definition above)breakeven_when_unprotected: stop to breakeven when net ROE is at least min_net_roe_to_hold_unprotectedThe stop stays. No exit
Anchor wall pulled, no backup wallhold_unprotected_in_profit: hold with the stop at breakevenExit at market
Anchor wall absorbed, no backup wallon_absorbed_after_fill = protect: stop to breakevenThe stop stays. No exit

In every case the stop only moves if breakeven is tighter than the current stop and still on the right side of price. A better lock, for example from trailing, is never loosened. Each move is logged and notified, for example "No confirmed wall between price and the stop; net ROE +6.2% >= 5%: stop moved ... -> ... (breakeven + fees + slippage)".

All the ways a trade ends

ExitOrder typeWhen
StopExchange stop-marketPrice reaches the stop, whether it sits behind the wall, at breakeven or at a trailing lock
Take profitClose-only limit, armed near the targetPrice reaches the target in front of the counter wall
Take profit at marketMarketPrice jumped past an unarmed target
Wall pulledMarketAnchor wall pulled with no backup wall and not enough profit to hold (or pulled_wall_exit = always)
Wall fadedMarketOnly with exit_on_wall_faded on, as for a pull
Liquidation safetyMarketLive: the stop cannot sit safely before Binance's liquidation price without being in front of the wall
Close allMarketYou press "Close all" on the dashboard

Whichever exit fills first closes the trade, and the other exit orders are cancelled. See Entries, stops and sizing for how the first stop is placed, and Coins, movers and limits for the limits that apply across trades.