OPEN-SOURCE SCRIPT

Overheat Oscillator with Divergence

383
Indicator Description

The Overheat Oscillator with Divergence is an advanced technical indicator designed for the TradingView platform, assisting traders in identifying potential market reversal points by analyzing price momentum and volume, as well as detecting divergences. The indicator combines trend strength assessment with signal smoothing to provide clear indications of market overheat or oversold conditions. An optional divergence detection feature allows for the identification of discrepancies between price movement and the oscillator's value, which may signal upcoming trend changes.
The indicator is displayed in a separate panel below the price chart and offers visual cues through a color gradient, horizontal reference lines, and a dynamic market sentiment table. Users can customize numerous parameters, such as calculation periods, sentiment thresholds, line colors, and visualization styles, making the indicator a versatile tool for various trading strategies.

How the Indicator Works
The indicator is based on the following key components:
Oscillator Calculations

The indicator analyzes price candles, assigning a score based on their nature. A bullish candle (when the closing price is higher than the opening price) receives a score of +1.0, while a bearish candle (when the closing price is lower than the opening price) receives a score of -1.0. This scoring reflects the strength of price movement over a given period.
The score is modified by a volume multiplier (default: 2.0) if the candle's volume exceeds the volume's simple moving average (SMA, default: calculated over 20 candles). This ensures that candles with higher volume have a greater impact on the oscillator's value, better capturing significant market movements driven by increased trading activity. For example, a bullish candle with high volume may receive a score of +2.0 instead of +1.0, amplifying the bullish signal.
The scores are summed over a specified number of candles (default: 20), normalized to a 0–100 range, and then smoothed using a simple moving average (SMA, default: 5 periods) to reduce noise and improve signal clarity.

Color Gradient

The oscillator's values are visualized using a color gradient that changes based on the oscillator's level:
Green: Market cooldown (values below the Gradient Min threshold).
Yellow: Neutral sentiment (values between Gradient Min and Gradient Yellow).
Orange: Elevated activity (values between Gradient Yellow and Gradient Orange).
Red: Market overheat (values above Gradient Orange).


The color gradient is applied as the background in the oscillator panel, facilitating quick assessment of market sentiment.

Reference Levels

The indicator displays customizable horizontal lines for key thresholds (e.g., Overheat Threshold, Oversold Threshold, Gradient Min, Yellow, Orange, Max). These lines are visible only at the height of the last few oscillator candles, preventing chart clutter and helping users focus on current values.
Users can also define three custom horizontal lines with selectable styles (solid, dotted, dashed) and colors. These lines serve as auxiliary tools, e.g., for marking personal support/resistance levels, but do not affect the oscillator's signals or background colors.

Market Sentiment

The indicator displays sentiment labels in a table located in the top-right corner of the panel, dynamically updating based on the oscillator's value:
Cooled: Values below Gradient Yellow (default: 35).
Neutral: Values between Gradient Yellow and Gradient Orange (default: 60).
Excited: Values between Gradient Orange and Overheat Threshold (default: 70).
Overheated: Values above Overheat Threshold (default: 70).


The Overheat Threshold and Oversold Threshold are critical for displaying the "Overheated" and "Cooled" labels in the sentiment table, enabling users to quickly identify extreme market conditions. The labels update when key thresholds are crossed, and their colors match the oscillator's gradient.

Divergence Detection

The indicator offers optional detection of regular bullish and bearish divergences:
Bullish Divergence: Occurs when the price forms a lower low, but the oscillator forms a higher low, suggesting a weakening downtrend.
Bearish Divergence: Occurs when the price forms a higher high, but the oscillator forms a lower high, suggesting a weakening uptrend.


Divergences are marked on the chart with labels ("Bull" for bullish, "Bear" for bearish) and lines indicating pivot points. They are calculated with a delay equal to the Lookback Right setting (default: 5 candles), meaning signals appear after pivot confirmation in the specified lookback period. The indicator also generates alerts for users when a divergence is detected.


Indicator Settings
Main Settings (SETTINGS)

Period Length: Specifies the number of candles used for oscillator calculations (default: 20).
Volume SMA Period: The period for the volume's simple moving average (default: 20).
Volume Multiplier: Multiplier applied to candle scores when volume exceeds the average (default: 2.0).
SMA Length: The period for smoothing the oscillator with a simple moving average (default: 5).

Thresholds (THRESHOLDS)

Overheat Threshold: Level indicating market overheat (default: 70). This value determines when the sentiment table displays the "Overheated" label, signaling a potential peak in an uptrend.
Oversold Threshold: Level indicating market cooldown (default: 30). This value determines when the sentiment table displays the "Cooled" label, signaling a potential bottom in a downtrend.
Gradient Min (Green): Lower threshold for the green gradient (default: 20).
Gradient Yellow Threshold: Threshold for the yellow gradient (default: 35).
Gradient Orange Threshold: Threshold for the orange gradient (default: 60).
Gradient Max (Red): Upper threshold for the red gradient (default: 70).

Visualization (VISUALIZATION)

Signal Line Color: Color of the oscillator line (default: dark red, RGB(5, 0, 0)).
Show Reference Lines: Enables/disables the display of threshold lines (default: enabled).

Divergence Settings (DIVERGENCE SETTINGS)

Calculate Divergence: Enables/disables divergence detection (default: disabled).
Lookback Right: Number of candles back for pivot analysis (default: 5).
Lookback Left: Number of candles to the left for pivot analysis (default: 5).

Line Style (STYLE)

Custom Line 1, 2, 3 Value: Levels for custom horizontal lines (default: 70, 50, 30).
Custom Line 1, 2, 3 Color: Colors for custom lines (default: black, RGB(0, 0, 0)).
Custom Line 1, 2, 3 Style: Line styles (solid, dotted, dashed; default: dashed, dotted, dashed).


How to Use the Indicator
Adding to the Chart

Add the indicator to your TradingView chart by searching for "Overheat Oscillator with Divergence."
Configure the settings according to your trading strategy.

Signal Interpretation

Overheated: Values above the Overheat Threshold (default: 70) in the sentiment table may indicate a potential uptrend peak.
Cooled: Values below the Oversold Threshold (default: 30) in the sentiment table may suggest a potential downtrend bottom.
Divergences:
Bullish: Look for "Bull" labels on the chart, indicating potential upward reversals (calculated with a Lookback Right delay).
Bearish: Look for "Bear" labels, indicating potential downward reversals (calculated with a Lookback Right delay).

Customization

Experiment with settings such as period length, volume multiplier, or gradient thresholds to tailor the indicator to your trading style (e.g., scalping, medium-term trading).


Usage Examples

Scalping: Set a shorter period (e.g., Period Length = 10, SMA Length = 3) and monitor rapid sentiment changes and divergences on lower timeframes (e.g., 5-minute charts).
Medium-Term Trading: Use default settings or increase Period Length (e.g., 30) and SMA Length (e.g., 7) for more stable signals on hourly or daily charts.
Reversal Detection: Enable divergence detection and observe "Bull" or "Bear" labels in conjunction with overheat/cooled levels in the sentiment table.


Notes

The indicator performs best when used in conjunction with other technical analysis tools, such as support/resistance lines, moving averages, or Fibonacci levels.
Divergences may serve as early signals but do not always guarantee immediate trend reversals—confirmation with other indicators is recommended.
Test different settings on historical data to find the optimal configuration for your chosen market and timeframe.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.