Skip to content
StatePath
Tool Atlascalc.band_reentry

Tool

Band Re-Entry

calc.band_reentry

CalculationMean reversion

Inputs

upperBuffer (time series)

The upper edge of the band, as a number line — e.g. a Bollinger upper or a Keltner upper channel.

lowerBuffer (time series)

The lower edge of the band, as a number line — e.g. a Bollinger lower or a Keltner lower channel.

Outputs

Bundle (untagged)

A bundle reporting the re-entry: whether price came back inside the chosen band this bar, plus the supporting context for downstream stages.

Band Re-Entry fires when price leaves a band (a Bollinger or Keltner channel, an envelope, anything with an upper and lower edge) and then comes back inside. It’s a classic mean-reversion trigger: the snap-back after a stretch, not the stretch itself.

Band Re-Entry overview diagram

How it works

You wire in the band’s upper and lower edges as two number lines. The tool watches price relative to those edges and remembers when it pushed outside; the `side` picker says which edge to watch (the lower band for longs, the upper band for shorts), and `within_n` sets how many bars the re-entry must happen in before the setup goes stale. The moment price crosses back through the chosen edge inside that window, the bundle reports the re-entry.

Modes

Lower bandlower

Fires when price dips below the lower band and then climbs back up through it — a snap-back from oversold.

Lower band diagram

When to use: Long-only mean reversion: buy the recovery after price overshoots the lower edge.

Upper bandupper

Fires when price pokes above the upper band and then falls back down through it — a fade from overbought.

Upper band diagram

When to use: Short-only mean reversion: sell the rejection after price overshoots the upper edge.

Configuration

sideenum

Which band edge to watch for the re-entry — ‘lower’ catches price climbing back up through the lower band (a long setup), ‘upper’ catches price falling back down through the upper band (a short setup).

Choices:lowerupper
within_nscalar

How many bars the re-entry may take after price first exited the band; if price doesn’t come back inside within this many bars the pending setup is dropped. Smaller demands a quick snap-back; larger tolerates a slow drift back.

within_n diagram

Connects to

Reads from
Feeds into

Examples

  • Mean-reversion long: wire a Bollinger upper/lower in, set side to ‘lower’ and within_n to 5, and fire a buy when price snaps back up inside the band after dipping below it.
  • Fade the extremes: set side to ‘upper’ to short the rejection when price pokes above the upper band and falls back inside within the window.

Common mistakes

  • Crossing the inputs — wiring the lower band into the upper port and vice versa, which inverts every signal.
  • Setting within_n too small so a genuine re-entry that takes a few bars to develop never registers.

See also