OPEN-SOURCE SCRIPT

TRIX Chart Divergence

1 405
TRIX Chart Divergence is based on one of my favorite oscillators.

The main feature of this indicator is that TRIX divergences are drawn not only in the oscillator pane, but also directly on the price chart.

This makes divergence much easier to read, especially for intraday trading and scalping. Instead of looking back and forth between price and the oscillator, you can immediately see where price made a new high or low and where TRIX failed to confirm that move.

For me, this is the most useful way to work with TRIX.

A bullish divergence appears when price makes a lower low, but TRIX does not confirm that move and forms a higher low. A bearish divergence appears when price makes a higher high, but TRIX does not confirm it and forms a lower high.

This type of divergence can warn about a possible correction or trend reversal. I especially like watching TRIX divergences on higher timeframes, because they can mark important exhaustion points. The indicator includes alerts for bullish and bearish divergences, so you can monitor multiple instruments and timeframes without watching every chart all the time.

I also use TRIX on the 1-minute gold chart for intraday trading. On lower timeframes, I use it together with my own setups, price action, levels and other confirmation tools.

TRIX is simple and clean. When the TRIX line crosses the signal line in the lower area, it can show a possible bullish momentum shift. When the cross appears in the upper area, it can show a possible bearish momentum shift. In this indicator, bullish and bearish TRIX crosses are marked with small green and red dots.

TRIX does not have fixed overbought and oversold levels like RSI or Stochastic. That is why I added adaptive range levels. These levels show where TRIX is trading compared to its recent range. When TRIX moves outside this adaptive range, it can highlight stronger momentum extremes.

The adaptive range levels are optional. You can use the indicator in the classic way without them, or keep them on as an additional visual guide.

Main features:
- TRIX and signal line
- Histogram
- Small green and red dots on TRIX crossovers
- Bullish and bearish TRIX divergences
- Divergence lines in the oscillator pane
- Optional divergence lines directly on the price chart
- Optional adaptive TRIX range levels
- Alerts for TRIX crosses and divergences

Settings:

TRIX Length / Signal Length
Controls the basic TRIX calculation and signal line. Lower values make the oscillator more sensitive. Higher values make it smoother.

Adaptive Range Levels
Optional dynamic levels that show where TRIX is trading compared to its recent range. They can help identify stronger momentum extremes. You can turn them off if you prefer the classic TRIX view.

Range Lookback Bars
Defines how many previous bars are used to calculate the adaptive range. A larger value makes the range smoother and more stable. A smaller value makes it react faster.

Range Smoothing
Smooths the adaptive range levels.

TRIX Pivot Sensitivity
Controls how sensitive divergence detection is. Lower values find more divergences. Higher values show fewer but cleaner divergences.

Price Search Radius
Allows the script to search around the TRIX pivot and find the closest price high or low for drawing the divergence line.

Max Bars Between Points
Defines the maximum distance between two TRIX pivot points used for divergence detection.

Draw divergence line on TRIX
Shows the divergence line in the oscillator pane.

Draw divergence line on price chart
Shows the same divergence directly on the price chart.

Important:

This indicator is not a standalone trading system.

TRIX crosses and divergences are designed to help identify momentum shifts, exhaustion points and possible correction zones.

For best results, use it together with price action, support and resistance, trend structure, higher timeframe context and your own confirmation setup.

A divergence can warn about a possible correction or reversal, but it does not mean that price must reverse immediately.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.