Skip to content
StatePath
Tool Atlascalc.pullback

Tool

Pullback / Continuation

calc.pullback

CalculationTrend

Inputs

maBuffer (time series)

The moving average price retraces toward — wire in an EMA/SMA the trend respects. Used as the touch target in ‘to_ma’ mode.

legBundle (untagged)

The current swing leg from a zigzag — its two pivots define the trend direction and the leg length the retrace is measured against.

Outputs

Bundle (untagged)

A bundle describing the pullback: whether a qualifying retrace-and-continuation is present this bar, its depth, and the supporting context for downstream stages.

Pullback detects a healthy pullback inside an existing trend — a temporary retrace toward a moving average or partway down a swing leg — then flags the continuation. It’s the ‘buy the dip in an uptrend’ tool, helping you join a trend on the pause rather than chase the breakout.

Pullback / Continuation overview diagram

How it works

You wire in a moving average and the current swing leg (from a zigzag). The `mode` picker decides how the pullback is measured: ‘to_ma’ watches for price retracing back to touch the moving average, while ‘pct_of_leg’ measures the retrace as a fraction of the leg’s length. The `source` picker chooses which price of each bar is tested (open/high/low/close or a blend like hl2). `proximity_atr` and `atr_period` set how close a touch counts in volatility terms, and `min_depth`/`max_depth` bound how shallow or deep the retrace may be to qualify.

Modes

Mode options

To moving averageto_ma

Counts the pullback when price retraces back to (or within ATR of) the moving average, then turns to continue the trend.

To moving average diagramMA

When to use: Trend-following entries that buy the dip to a dynamic support like a 20- or 50-EMA.

Percent of legpct_of_leg

Measures the pullback as a fraction of the prior swing leg, qualifying it when the retrace falls between min_depth and max_depth.

Percent of leg diagramretrace

When to use: Fibonacci-style entries that want a retrace into a specific zone of the leg (e.g. 38–61%).

Source options

Openopen

Tests the pullback against each bar’s open price.

Open diagramopen

When to use: When the open best represents the level you measure the retrace from.

Highhigh

Tests the pullback against each bar’s high price.

High diagramhigh

When to use: When the bar’s high is the relevant extreme for the retrace.

Lowlow

Tests the pullback against each bar’s low price.

Low diagramlow

When to use: When the bar’s low is the relevant extreme for the retrace (common for a dip in an uptrend).

Closeclose

Tests the pullback against each bar’s close price.

Close diagramclose

When to use: The usual choice — a closed-bar retrace is the most robust read.

HL2 (median)hl2

Tests the pullback against the bar’s median price, the average of high and low.

HL2 (median) diagramhl2

When to use: A smoother midpoint when you don’t want a single extreme driving the measurement.

HLC3 (typical)hlc3

Tests the pullback against the typical price, the average of high, low, and close.

HLC3 (typical) diagramhlc3

When to use: When you want close weighted in alongside the bar’s range.

OHLC4 (average)ohlc4

Tests the pullback against the average of open, high, low, and close.

OHLC4 (average) diagramohlc4

When to use: The smoothest single-bar price when you want every component blended.

Configuration

modeenum

How the pullback is measured — ‘to_ma’ watches for price retracing back to the moving average, ‘pct_of_leg’ measures the retrace as a fraction of the prior swing leg.

Choices:to_mapct_of_leg
sourceenum

Which price of each bar is tested for the pullback: open, high, low, close, or a blend (hl2 = median, hlc3 = typical, ohlc4 = average).

Choices:openhighlowclosehl2hlc3ohlc4
proximity_atrscalar

How close to the moving average a touch must come to count, measured in ATRs — larger is more lenient (a near-miss still qualifies), smaller demands an almost-exact touch. Used in ‘to_ma’ mode.

atr_periodscalar

How many bars the ATR used for the proximity test is averaged over; larger smooths the volatility estimate, smaller makes it react faster to recent ranges.

atr_period diagram
min_depthscalar

The shallowest retrace that still qualifies, as a fraction of the leg (pct_of_leg mode) — it filters out tiny dips that aren’t real pullbacks.

max_depthscalar

The deepest retrace that still qualifies, as a fraction of the leg — beyond this the move is treated as a trend reversal, not a pullback.

Connects to

Reads from
Feeds into

Examples

  • Trend continuation long: in ‘to_ma’ mode with source close, fire a buy when price pulls back within an ATR of a rising 50-EMA and turns up to continue.
  • Fibonacci pullback: in ‘pct_of_leg’ mode with min_depth 0.382 and max_depth 0.618, take entries only when the retrace lands in the golden zone of the prior leg.

Common mistakes

  • Setting max_depth too high so deep retraces that are actually reversals still pass as pullbacks.
  • Using ‘to_ma’ mode with a proximity_atr so tight that price almost never registers a touch, leaving the tool silent.

See also