Atualizado

RSI Divergences - Candle Iron Core

750
RSI Divergences - Candle Iron Core expands the traditional Relative Strength Index by providing an objective and configurable framework for identifying three different categories of RSI divergence:

  • Regular Divergence
  • Hidden Divergence
  • Exaggerated Divergence


Each divergence type can be enabled or disabled independently, allowing traders to display only the structures relevant to their analysis or all divergence types simultaneously.

The indicator preserves the traditional RSI calculation while expanding the divergence-detection logic beyond Regular Divergence.


RSI Calculation

The Relative Strength Index is a momentum oscillator that compares the magnitude of recent bullish and bearish price movements.

For each bar, the indicator compares the current Close with the previous Close.

Positive changes contribute to the bullish movement series.

Negative changes contribute to the bearish movement series using their absolute magnitude.

These movements are smoothed using Wilder's Moving Average (RMA) over the selected RSI Length.

The default RSI Length is 14 periods.

The Relative Strength is then calculated as:

RS = Average Bullish Movement / Average Bearish Movement

The RSI converts this relationship into a bounded scale between 0 and 100.

A higher RSI therefore indicates that bullish movements have had greater relative magnitude, while a lower RSI indicates greater relative bearish magnitude.

The traditional 70, 50 and 30 levels are visual reference levels and do not determine divergence detection.


Pivot Detection

Divergences are identified by comparing confirmed pivots in the RSI with the corresponding price highs or lows.

A Pivot Low represents a confirmed local minimum in the RSI.

A Pivot High represents a confirmed local maximum in the RSI.

By default, the indicator uses:

  • Pivot Lookback Left: 5
  • Pivot Lookback Right: 5


This means that a pivot is evaluated relative to five bars on each side.

Because bars to the right are required for confirmation, a pivot cannot be confirmed on the exact bar where it initially forms.

For example, with Pivot Lookback Right set to 5, the indicator requires five subsequent bars before confirming the pivot.

The divergence label is plotted back on the original pivot bar once confirmation becomes available.


The plotted pivot represents where the structure occurred. It does not represent the bar where the divergence first became available in real time.



Regular Bullish Divergence

A Regular Bullish Divergence is detected when:

Price forms a Lower Low while the RSI forms a Higher Low.

Price therefore reaches a new lower extreme, while the RSI does not confirm that move with a corresponding Lower Low.

This represents a loss of confirmation between price and bearish momentum.


Regular Bearish Divergence

A Regular Bearish Divergence is detected when:

Price forms a Higher High while the RSI forms a Lower High.

Price reaches a new higher extreme, while the RSI does not confirm that move with a corresponding Higher High.

This represents a loss of confirmation between price and bullish momentum.


Hidden Bullish Divergence

A Hidden Bullish Divergence is detected when:

Price forms a Higher Low while the RSI forms a Lower Low.

Price maintains a structurally higher low even though the RSI temporarily records a lower momentum low.

Hidden Bullish Divergence can be studied in the context of bullish trend continuation rather than exclusively as a reversal structure.


Hidden Bearish Divergence

A Hidden Bearish Divergence is detected when:

Price forms a Lower High while the RSI forms a Higher High.

Price maintains a structurally lower high even though the RSI temporarily produces a higher momentum high.

Hidden Bearish Divergence can be studied in the context of bearish trend continuation.


Exaggerated Bullish Divergence

An Exaggerated Bullish Divergence is detected when:

Price forms two approximately equal lows while the RSI forms a Higher Low.

Because two market lows are rarely mathematically identical, the indicator uses a configurable percentage tolerance to determine when two price lows can be considered approximately equal.

The default tolerance is:

Exaggerated Price Tolerance: 0.10%

For example, if two price lows differ by less than the configured tolerance, the indicator can classify them as approximately equal.

If the RSI simultaneously forms a Higher Low, the structure is classified as an Exaggerated Bullish Divergence.


Exaggerated Bearish Divergence

An Exaggerated Bearish Divergence is detected when:

Price forms two approximately equal highs while the RSI forms a Lower High.

If the difference between the two price highs remains within the configured percentage tolerance while the RSI forms a Lower High, the structure is classified as an Exaggerated Bearish Divergence.


Divergence Classification

The indicator separates Exaggerated Divergence from Regular and Hidden Divergence using the configured price tolerance.

When two price extremes fall within the Exaggerated Price Tolerance, they are treated as approximately equal.

This prevents the same comparison from being simultaneously classified as both an Exaggerated Divergence and another divergence category merely because one price extreme is mathematically a fraction higher or lower than the other.


Pivot Distance

The indicator also controls how far apart two RSI pivots may be before they can form a valid divergence.

Default values:

  • Minimum Pivot Distance: 5 bars
  • Maximum Pivot Distance: 60 bars


This limits divergence comparisons to pivots that fall within the configured distance range.

Both values are configurable.


Divergence Selection

Each divergence family can be independently enabled or disabled:

  • Show Regular Divergences
  • Show Hidden Divergences
  • Show Exaggerated Divergences


All three categories can also remain enabled simultaneously.

The labels identify the specific structure detected:

  • Regular Bull Div
  • Regular Bear Div
  • Hidden Bull Div
  • Hidden Bear Div
  • Exaggerated Bull Div
  • Exaggerated Bear Div



Exaggerated Price Tolerance

The Exaggerated Price Tolerance determines the maximum percentage difference allowed between two price extremes for them to be treated as approximately equal.

A smaller tolerance requires the two price levels to be more similar.

A larger tolerance permits a wider difference between the two levels.

This parameter makes the definition of an approximately equal High or Low objective and configurable instead of relying exclusively on visual interpretation.


RSI Reference Levels

The traditional RSI levels are displayed as visual references:

  • 70 — Upper Band
  • 50 — Middle Band
  • 30 — Lower Band


These levels do not determine whether a divergence exists.

The divergence algorithm searches for confirmed RSI pivots independently of the 70, 50 and 30 levels.

Therefore, a valid divergence can occur above 70, below 30 or anywhere between those levels.


Important Interpretation Notes

A divergence represents a disagreement between price structure and RSI momentum.

It does not guarantee that price will reverse or continue in any particular direction.

Regular, Hidden and Exaggerated Divergences describe different relationships between price and momentum and should be evaluated within the broader market context and within objectively defined trading rules.


Confirmation and Historical Display

This indicator uses confirmed RSI pivots.

Because pivot confirmation requires bars to the right of the pivot, divergence signals become known only after the required confirmation bars have formed.

For example:

If Pivot Lookback Right = 5, the algorithm must receive five additional bars before it can confirm the earlier RSI pivot.

Once confirmed, the indicator displays the divergence on the historical bar where the pivot actually occurred.


The divergence label shows where the pivot occurred, not when the signal became available in real time.


Increasing Pivot Lookback Right requires more bars for confirmation and generally produces more selective pivot structures.

Reducing Pivot Lookback Right confirms pivots sooner and makes pivot detection more sensitive.


Original Functionality

The standard Relative Strength Index calculation is a classic technical-analysis calculation.

RSI Divergences - Candle Iron Core extends this foundation with a configurable divergence-classification framework.

The additional functionality includes:

  • Regular Bullish and Bearish Divergence detection
  • Hidden Bullish and Bearish Divergence detection
  • Exaggerated Bullish and Bearish Divergence detection
  • Independent visibility controls for each divergence family
  • Configurable RSI pivot confirmation
  • Configurable minimum and maximum pivot distance
  • Objective percentage-based tolerance for approximately equal price extremes
  • Mutually separated Exaggerated Divergence classification
  • Descriptive labels identifying the detected divergence type


The purpose of the indicator is to provide a consistent and objective framework for studying multiple forms of RSI divergence from a single tool.


Divergence represents a relationship between price structure and momentum. It should not be interpreted as a guaranteed prediction of future price movement.
Notas de Lançamento
[h1]CIC - RSI Divergences: Update Notes[/h1]

What's new

This update adds an optional Early Signals mode. Previously, a divergence label only appeared after the RSI pivot was fully confirmed (5 bars to the right by default). On a 4H chart, that means waiting about 20 hours, usually after price has already moved. With Early Signals enabled, the signal can appear on the very next bar after the RSI peak or trough.

How it works

The indicator now uses two kinds of pivots:
  • Reference pivots (strict): always confirmed with Pivot Lookback Right. The signal is compared against these, so the comparison stays meaningful.
  • Signal pivot: confirmed with Pivot Lookback Right (default mode) or with Early Signal Confirmation Bars (Early Signals mode).


New and changed settings
  • Early Signals (default: Off): Off = classic behavior, the signal is confirmed with Pivot Lookback Right. On = the signal is confirmed with Early Signal Confirmation Bars.
  • Early Signal Confirmation Bars (default: 3): only used when Early Signals is On. Lower value = earlier signals, more signals, more noise. Higher value = later signals, fewer signals, more reliable. If it is set higher than Pivot Lookback Right, it is capped at that value.
  • Pivot Lookback Right (default: 5): now defines the strict reference pivots, and also confirms the signal when Early Signals is Off. Lower value = more reference pivots, more sensitive. Higher value = only major pivots are used.
  • Alerts only on bar close (default: On): alerts fire only when the signal bar closes, to avoid alerts caused by repainting. Turn it Off if you want alerts as soon as the signal appears.


Unchanged settings
  • Pivot Lookback Left (default: 5)
  • Minimum Pivot Distance (default: 5)
  • Maximum Pivot Distance (default: 60)
  • Exaggerated Price Tolerance (default: 0.10%)


Recommended setups
  • Fewer, cleaner signals: Early Signals Off, Pivot Lookback Right 5 (default).
  • Balanced (default when Early Signals is On): Early Signals On, Early Signal Confirmation Bars 3.
  • Fastest signals: Early Signals On, Early Signal Confirmation Bars 1. Expect more signals and more noise.


Other changes
  • Divergence lines are now drawn from the reference pivot to the signal pivot, so the line always connects the two pivots being compared.
  • The built-in indicator timeframe selector was removed, because TradingView does not allow it in scripts that draw lines. To see another timeframe, change the chart timeframe or use a multi-chart layout with the indicator on each chart.


Important note on repainting

In Early Signals mode, the confirmation bar is still open when the signal appears. If the RSI changes before that bar closes, the label can disappear. This is the trade-off for seeing the signal earlier. Use Alerts only on bar close, or wait for the bar to close, if you need a stable signal.

Disclaimer

This indicator is a technical analysis tool and not financial advice. Divergences do not guarantee a reversal. Always combine them with your own analysis and risk management.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.