Charts See the terminal

Premium script

Divergence

Regular and hidden divergences between price and an oscillator at swing pivots, marked on the chart with a line between the two pivots.

Patterns & Confluence Sign up for Altrady $12 one-time

Live Divergence preview · BTC/USDT on Binance · 1h, history up to a day ago

What is Divergence?

Divergence compares price with an oscillator at swing pivots and marks the places where they disagree. Regular divergence is a warning that a trend is weakening. Hidden divergence is the opposite reading, a sign that a trend is carrying on through a pullback.

The oscillator is RSI by default, with MACD, CCI and Stochastic as alternatives, and it is plotted in a sub-pane. Each divergence gets a marker and, by default, a line on the price chart joining the two pivots. Regular divergence is on by default and hidden divergence is a separate toggle.

This is a closed-source premium script. It runs on Altrady's servers, so only its output reaches your chart and its code is not published.

Components

Divergence combines 2 tools in one script. Each one has its own switch in the settings.

  • Regular divergence. Price makes a new extreme that the oscillator does not confirm, so the trend is weakening. On by default.
  • Hidden divergence. The oscillator makes a new extreme that price does not, so the trend is continuing. Off by default.

How to use Divergence

  • Regular bullish. Price makes a lower low but the oscillator makes a higher low. Selling pressure is fading even though price went lower.
  • Regular bearish. Price makes a higher high but the oscillator makes a lower high. Buying pressure is fading even though price went higher.
  • Hidden bullish. Price makes a higher low while the oscillator makes a lower low. The uptrend is intact even though momentum dipped.
  • Hidden bearish. Price makes a lower high while the oscillator makes a higher high. The downtrend is intact even though momentum spiked.

Settings

Components

SettingDefaultRangeWhat it changes
Show RegularOn Regular divergence: price makes a new extreme the oscillator does not confirm, so the trend is weakening.
Show HiddenOff Hidden divergence: the oscillator makes a new extreme price does not, so the trend is continuing.

Settings

SettingDefaultRangeWhat it changes
OscillatorRSI RSI, MACD, CCI, StochasticWhich oscillator to compare against price.
Oscillator Length14 2 to 100The period for the chosen oscillator.
Pivot Length5 2 to 20Bars each side to confirm an oscillator pivot.
Max Bars100 10 to 500Maximum bars between the two pivots for a valid divergence.

Display

SettingDefaultRangeWhat it changes
Show LinesOn Lines connecting the two diverging pivots on the price chart.
Show OscillatorOn Plot the oscillator in a sub-pane.
Max Divergences10 1 to 50
Show State PaneOff

Colours

SettingDefaultRangeWhat it changes
Bullish #089981 Regular: price lower low, oscillator higher low. Hidden: price higher low, oscillator lower low.
Bearish #f23645 Regular: price higher high, oscillator lower high. Hidden: price lower high, oscillator higher high.
Oscillator Colour #787b86

Alerts: div_bullish, div_bearish, hdiv_bullish, hdiv_bearish.

How it works

The script finds pivots in the oscillator itself, a high or low with Pivot Length bars on each side. Each time a new pivot is confirmed, it is compared with the previous pivot of the same kind, and the price at the same two bars is compared too. If the two moved in opposite directions, that is a divergence.

The two pivots must be within Max Bars of each other, 100 by default, or the comparison is considered too old to mean anything. Regular and hidden divergence read the same oscillator and the same pivots; only the direction of the disagreement differs.

A divergence is drawn once, on the bar its second pivot is confirmed, and its alert fires then. Max Divergences keeps the most recent ten of each kind.

Limitations

  • Confirmation lag. A pivot needs Pivot Length bars after it to be confirmed, so a divergence appears that many bars after the second turn.
  • Divergence can persist. In a strong trend, divergence after divergence can form while price keeps going. It is a warning, not a turn.
  • The oscillator choice matters. RSI, MACD, CCI and Stochastic do not always agree, so a divergence on one may not exist on another.
  • Only consecutive pivots. Each new pivot is compared with the previous one of its kind, not with older pivots. Divergences spanning several swings are not drawn.
  • It is not a strategy. A divergence has no entry, stop or target of its own.

Get Divergence

Premium scripts are a one-time purchase in the Altrady marketplace and need a paid Altrady plan to run.

  • Divergence $12 This script on its own.
  • Patterns & Confluence bundle $29 5 premium scripts, Divergence included.
  • Altrady Complete Suite $109 All 36 premium scripts.
Sign up for Altrady

Frequently asked questions

Regular divergence is price making a new extreme that the oscillator does not confirm, a sign of a weakening trend. Hidden divergence is the oscillator making a new extreme that price does not, read as the trend continuing.

RSI, which is the default, MACD, CCI or Stochastic, with Oscillator Length 14 by default. Both regular and hidden divergence use the oscillator you choose.

No. A divergence is drawn once its second pivot is confirmed and is not redrawn. The trade-off is a delay of Pivot Length bars after the turn.

Four. div_bullish and div_bearish for regular divergence, and hdiv_bullish and hdiv_bearish for hidden divergence. A component that is switched off fires no alerts.

Yes. Divergence is a closed-source premium script. It runs on Altrady's servers, so only its output reaches your chart and the code is never shared. You buy it once in the Altrady marketplace, on its own, in the Patterns & Confluence bundle or in the Altrady Complete Suite, and it needs a paid Altrady plan to run. It is also included with your first annual Premium subscription.

Use the Get it in Altrady button on this page to open its listing in the Altrady marketplace. Once it is in your account, open the indicator picker on any chart in Altrady Charts and add Divergence like any other indicator. Turn on hidden divergence in its settings panel.

Sign up for Altrady