OPEN-SOURCE SCRIPT
Chaikin Fisher Transform Divergence & Early Reversal

# 📌 CFisherDiv — Chaikin Fisher Transform Divergence & Early Reversal
## Purpose of the Indicator
This indicator combines the **Chaikin Oscillator**, a volume-based momentum oscillator, with **Fisher Transform** mathematics, which converts price/momentum extremes into sharp turning points. The goal is to take the "soft" and lagging signals produced by the classic Chaikin Oscillator and make them earlier and clearer through the Fisher transform's sharp peak/trough structure, which approximates a Gaussian distribution.
On its own, the indicator addresses:
- Removing the ambiguity in interpreting the raw Chaikin Oscillator (by offering a normalized oscillation line with defined boundaries via the Fisher transform)
- Catching trend exhaustion early through **pivot-based divergence** detection, in addition to classic crossover signals
- Giving advance notice of reversals from overbought/oversold zones with **"early reversal"** signals, before a full crossover forms
## Attribution for Methods Used
This indicator is an original synthesis of two independent, well-known technical analysis methods:
- **Chaikin Oscillator**: Developed by Marc Chaikin, this classic volume-momentum oscillator takes the difference between short- and long-period EMAs of the Accumulation/Distribution line. In this indicator it's calculated via the built-in `ta.accdist` function.
- **Fisher Transform**: Developed by John F. Ehlers, this mathematical method compresses any oscillating series into the -1 to +1 range and then applies a logarithmic transform to produce a sharp, approximately Gaussian-distributed signal. Originally applied to price, this technique is applied here to the classic Chaikin Oscillator's output instead.
The pivot-based divergence detection and "early reversal" logic are additional layers designed originally for this script; no third-party code was used as a base.
## How Is It Calculated?
1. **Chaikin Oscillator**: `ema(accdist, fast length) - ema(accdist, slow length)`
2. **Fisher Normalization**: The oscillator value is normalized into the -0.5 to +0.5 range based on the highest/lowest values within the chosen period, then smoothed with a weighted average and clamped to ±0.999.
3. **Fisher Transform**: The normalized value is logarithmically transformed via `0.5 × ln((1+x)/(1-x))`, then weighted with the previous bar's value. The result is the Fisher line (`fish`) and its one-bar-lagged trigger (`trigger`).
## Parameters
**Chaikin Oscillator**
- *Fast Length* (default 3): The short EMA period of the Accumulation/Distribution line
- *Slow Length* (default 10): The long EMA period of the Accumulation/Distribution line
**Fisher Transform**
- *Fisher Normalization Length* (default 10): The lookback window over which the oscillator's highest/lowest values are calculated. Shortening it speeds up the signal but increases noise.
- *Overbought Level* (default 1.5) / *Oversold Level* (default -1.5): Horizontal thresholds defining the Fisher line's extreme zones.
**Divergence**
- *Show Divergences*: Toggles divergence lines and labels on/off.
- *Pivot Left Bars / Pivot Right Bars* (default 4/4): The number of bars required on each side of a peak or trough for it to be confirmed as a pivot. Increasing this produces more reliable but more delayed pivots.
- *Max Bars Between Pivots* (default 60): The maximum bar distance over which divergence is searched for between two pivots; prevents meaningless pairing of pivots that are too far apart.
**Early Reversal**
- *Show Early Reversal Signals*: Toggles early signals that form on exit from an extreme zone.
- *Signal Cooldown (Bars)* (default 5): The mandatory minimum bar distance between consecutive early signals (prevents excessive signal repetition).
## How to Interpret the Signals
- **Green/Red triangle (Long/Short Crossover)**: The Fisher line crossing its own trigger up/down — a classic momentum reversal signal.
- **RegBull / RegBear (Regular Divergence)**: Price makes a new low/high while the Fisher line fails to confirm it — indicates the current trend is losing steam, a potential trend reversal.
- **HidBull / HidBear (Hidden Divergence)**: Price makes a shallower low/high while the Fisher line makes a deeper low/high — a confirmation signal that the current trend is likely to continue.
- **Cyan/Orange diamond (Early Bullish/Bearish Reversal)**: A leading signal triggered when the Fisher line begins to turn while still in the oversold/overbought zone, before a full crossover forms. Earlier than the other signals but carries a higher risk of false signals; confirmation with price action or another indicator is recommended.
## Usage Note
Since the indicator relies on volume data, it will not work on symbols that don't provide volume information (some forex pairs, indices, etc.) and will report this with an error message on the chart. The signals are designed to be used for trend following and confirmation alongside other technical/fundamental analysis tools, not as standalone buy/sell decisions. Past performance is not a guarantee of future results.
## Purpose of the Indicator
This indicator combines the **Chaikin Oscillator**, a volume-based momentum oscillator, with **Fisher Transform** mathematics, which converts price/momentum extremes into sharp turning points. The goal is to take the "soft" and lagging signals produced by the classic Chaikin Oscillator and make them earlier and clearer through the Fisher transform's sharp peak/trough structure, which approximates a Gaussian distribution.
On its own, the indicator addresses:
- Removing the ambiguity in interpreting the raw Chaikin Oscillator (by offering a normalized oscillation line with defined boundaries via the Fisher transform)
- Catching trend exhaustion early through **pivot-based divergence** detection, in addition to classic crossover signals
- Giving advance notice of reversals from overbought/oversold zones with **"early reversal"** signals, before a full crossover forms
## Attribution for Methods Used
This indicator is an original synthesis of two independent, well-known technical analysis methods:
- **Chaikin Oscillator**: Developed by Marc Chaikin, this classic volume-momentum oscillator takes the difference between short- and long-period EMAs of the Accumulation/Distribution line. In this indicator it's calculated via the built-in `ta.accdist` function.
- **Fisher Transform**: Developed by John F. Ehlers, this mathematical method compresses any oscillating series into the -1 to +1 range and then applies a logarithmic transform to produce a sharp, approximately Gaussian-distributed signal. Originally applied to price, this technique is applied here to the classic Chaikin Oscillator's output instead.
The pivot-based divergence detection and "early reversal" logic are additional layers designed originally for this script; no third-party code was used as a base.
## How Is It Calculated?
1. **Chaikin Oscillator**: `ema(accdist, fast length) - ema(accdist, slow length)`
2. **Fisher Normalization**: The oscillator value is normalized into the -0.5 to +0.5 range based on the highest/lowest values within the chosen period, then smoothed with a weighted average and clamped to ±0.999.
3. **Fisher Transform**: The normalized value is logarithmically transformed via `0.5 × ln((1+x)/(1-x))`, then weighted with the previous bar's value. The result is the Fisher line (`fish`) and its one-bar-lagged trigger (`trigger`).
## Parameters
**Chaikin Oscillator**
- *Fast Length* (default 3): The short EMA period of the Accumulation/Distribution line
- *Slow Length* (default 10): The long EMA period of the Accumulation/Distribution line
**Fisher Transform**
- *Fisher Normalization Length* (default 10): The lookback window over which the oscillator's highest/lowest values are calculated. Shortening it speeds up the signal but increases noise.
- *Overbought Level* (default 1.5) / *Oversold Level* (default -1.5): Horizontal thresholds defining the Fisher line's extreme zones.
**Divergence**
- *Show Divergences*: Toggles divergence lines and labels on/off.
- *Pivot Left Bars / Pivot Right Bars* (default 4/4): The number of bars required on each side of a peak or trough for it to be confirmed as a pivot. Increasing this produces more reliable but more delayed pivots.
- *Max Bars Between Pivots* (default 60): The maximum bar distance over which divergence is searched for between two pivots; prevents meaningless pairing of pivots that are too far apart.
**Early Reversal**
- *Show Early Reversal Signals*: Toggles early signals that form on exit from an extreme zone.
- *Signal Cooldown (Bars)* (default 5): The mandatory minimum bar distance between consecutive early signals (prevents excessive signal repetition).
## How to Interpret the Signals
- **Green/Red triangle (Long/Short Crossover)**: The Fisher line crossing its own trigger up/down — a classic momentum reversal signal.
- **RegBull / RegBear (Regular Divergence)**: Price makes a new low/high while the Fisher line fails to confirm it — indicates the current trend is losing steam, a potential trend reversal.
- **HidBull / HidBear (Hidden Divergence)**: Price makes a shallower low/high while the Fisher line makes a deeper low/high — a confirmation signal that the current trend is likely to continue.
- **Cyan/Orange diamond (Early Bullish/Bearish Reversal)**: A leading signal triggered when the Fisher line begins to turn while still in the oversold/overbought zone, before a full crossover forms. Earlier than the other signals but carries a higher risk of false signals; confirmation with price action or another indicator is recommended.
## Usage Note
Since the indicator relies on volume data, it will not work on symbols that don't provide volume information (some forex pairs, indices, etc.) and will report this with an error message on the chart. The signals are designed to be used for trend following and confirmation alongside other technical/fundamental analysis tools, not as standalone buy/sell decisions. Past performance is not a guarantee of future results.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
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.