Skip to content
StatePath
Tool Atlascalc.divergence

Tool

Divergence

calc.divergence

CalculationDivergence

Inputs

aBuffer (time series)

The price line whose pivots are compared against the indicator (usually the close).

bBuffer (time series)

The indicator line checked for disagreement with price (a momentum oscillator works well).

Outputs

Bundle (untagged)

A bundle describing any detected divergence — its kind (regular or hidden), direction (bullish or bearish), and the pivot points that formed it.

Divergence compares the swings of price against the swings of an indicator and flags when they disagree — for example price making a higher high while the indicator makes a lower high. Such disagreements often warn that a move is losing strength.

Divergence overview diagram

How it works

The node finds recent pivot highs and lows on both input `a` (price) and input `b` (an indicator) using `pivot_lookback` to decide how prominent a swing must be, then checks whether the two latest pivots point opposite ways. A larger `pivot_lookback` reacts to bigger, rarer swings; a smaller one picks up minor ones.

Configuration

pivot_lookbackscalar

How many bars on each side a swing must dominate to count as a pivot. Larger values keep only the major turning points and give rarer, higher-conviction divergences; smaller values catch minor swings and fire more often.

pivot_lookback diagram

Connects to

Reads from
Feeds into

Examples

  • Reversal warning: wire price into a and RSI into b, then take a regular bullish divergence at a swing low as an early sign a downtrend may be ending.
  • Trend confirmation: use a hidden divergence in the direction of the trend as a continuation cue rather than a reversal.

Common mistakes

  • Trading divergence on its own — it shows weakening momentum, not a confirmed turn; in a strong trend price can keep going while diverging for a long time.
  • Setting pivot_lookback too small, which flags every wiggle as a divergence and floods the strategy with weak signals.

See also