Divergence Detector [TradingFinder] RSI + MACD + AO Oscillator


🟣Understanding Divergence

As mentioned, divergence occurs in technical analysis when a stock's price behaves contrary to indicators on the price chart. Divergence can signify either a reversal of the stock's trend or a continuation of the previous trend correction.

Divergences can act as reversal patterns or continuation patterns. Moreover, divergences can be utilized to identify potential support and resistance levels.

For instance, when an indicator is trending upwards and positive, but the price is declining and trending downwards, divergence occurs. Divergence in a stock indicates trader indecision in buying and selling and warns traders to reconsider their decisions regarding buying or holding the stock.

Divergence aids analysts in identifying critical price points. In indicator divergences, it serves as a potent signal in the realm of technical analysis.

🟣Types of Divergence

1.Regular Divergence
o Positive Regular Divergence (RD+)
o Negative Regular Divergence (RD-)
2.Hidden Divergence
o Positive Hidden Divergence (HD+)
o Negative Hidden Divergence (HD-)
3.Time Divergence

Key Note: This indicator is specifically designed to identify "Regular Divergence" only. Therefore, the following explanation pertains to this type of divergence.

🔵Regular Divergence/Convergence

Regular Divergence(Convergence) occurs due to conflicting behavior between the indicator and the price chart, typically at the end of a trend. Recognizing Regular Divergence suggests an anticipation of a trend reversal or a pattern resembling a reversal.

🟣Positive Regular Divergence (RD+)

In contrast to negative divergence, positive Regular Divergence occurs at the end of a downtrend and between two price lows. It manifests when the price forms a new low on the price chart, but the indicator fails to recognize it.

Positive Regular Divergence indicates strong buying pressure and weak selling pressure. Following the identification of positive divergence on the chart, one can anticipate a price increase for the examined stock.

🟣Negative Regular Divergence (RD-)

This type of Regular Divergence emerges between two price highs during an uptrend. A new high is formed on the price chart, but the indicator fails to acknowledge it. This scenario indicates negative Regular Divergence.

The likelihood of a subsequent market downturn is high. Negative divergence signifies strong selling pressure and weak buying pressure, suggesting an unfavorable future for the stock.

🔵How to use

By utilizing the "Fractal Period" input, you can specify your desired periods for identifying divergences.

Additionally, through the "Divergence Detect Method" feature, you can choose which oscillators (MACD, RSI, or AO) to base divergence identification on.

Divergence in MACD Oscillator:

Divergence in the MACD indicator occurs when the price chart and the MACD line form a noticeable opposing pattern, meaning the price moves contrary to the MACD line. In this scenario, one expects a reversal in price direction.

Divergence in RSI Oscillator:

If divergence occurs during a downtrend on the price chart (two consecutive lows, with the second low being lower) and on the corresponding RSI point (two consecutive lows, with the second low being higher), it signifies positive Regular Divergence and implies a buying signal.

Conversely, if divergence occurs during an uptrend on the price chart (two consecutive highs, with the second high being higher) and on the corresponding RSI point (two consecutive highs, with the second high being lower), it indicates negative Regular Divergence, signaling a selling opportunity.

Divergence in AO Oscillator:

The AO indicator calculates histograms similar to the AO base. It calculates the difference between the simple moving averages of 5 and 34 periods based on the median of each bar. Then, it plots the bars based on the difference.

It then compares the histograms to detect peaks and troughs in the AO histograms and compares the identified peaks and troughs to the price. Whenever divergence is detected, it plots lines and arrows.


The table contains information on the functional features of this oscillator that you can utilize. Four categories of information are presented in the table: "Exist," "Consecutive," "Divergence Quality," and "Change Phase Indicator."

If divergence exists, you'll see "+" in this row.

Divergences may occur consecutively. If same-type divergences form within short intervals, you can observe the count in this row.

Divergence Quality: Based on the number of consecutive divergences, their quality can be evaluated. If one divergence exists, its quality is considered "Normal." If two divergences exist, the quality is "Good," and if three or more divergences exist, the quality is considered "Strong."

Change Phase Indicator: If a phase change occurs between two oscillation peaks formed based on divergence, this change is identified and displayed in this row.

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟