OPEN-SOURCE SCRIPT

Color Code Overlay

120
Color Code Overlay Indicator

The Color Code Overlay indicator is designed to provide a dynamic visualization of price action using color-coded candles. This overlay highlights trend reversals and bullish/bearish conditions by utilizing a custom candle calculation and the Average True Range (ATR) percentage threshold to detect significant price changes.

Key Features:
Custom Candle Calculation:
The Color Code Overlay is based on a modified candlestick calculation that takes the average of the open, high, low, and close prices to determine the candle’s close value. The open value is derived from the midpoint of the current candle's open and close or the previous Color Code Overlay close. The high and low values are based on the highest and lowest prices between the open, close, and the actual market high/low.

Color-Coding:
Green: The candle is colored green when the close is higher than the open, indicating a bullish trend.
Red: The candle is colored red when the close is lower than the open, indicating a bearish trend.

Color Change Detection:
The indicator detects significant color changes, signaling trend reversals. The transitions are determined based on the following conditions:

A bullish to bearish change (green to red) is identified when the current candle's close is lower than the open, and the price difference exceeds 1% of the candle's range (calculated using the current candle's high and low).
A bearish to bullish change (red to green) occurs when the current candle’s close is higher than the open, and the price difference also exceeds 1% of the candle's range.

Threshold Calculation:
The dynamic threshold for detecting significant price changes is based on the ATR percentage of the candle's range. By default, the indicator uses 1% of the range for detecting meaningful price movement. This ensures that only substantial changes trigger the color shifts, providing clear signals for potential trend reversals or market momentum.

Arrows for Color Changes:

A red triangle down is plotted above the bar when the color changes from green to red (bullish to bearish).
A green triangle up is plotted below the bar when the color changes from red to green (bearish to bullish).

Alerts:
The indicator includes alert conditions that notify you when:

The price is bullish (green candle).
The price is bearish (red candle).
There is a change from green to red (bullish to bearish).
There is a change from red to green (bearish to bullish).

How It Works:
The Color Code Overlay dynamically calculates the candle values based on market data and applies the ATR-based threshold to identify color changes. A shift from bullish to bearish or vice versa is only triggered when the price moves significantly beyond the calculated threshold, helping to avoid false signals from minor price fluctuations.

This indicator is particularly useful for traders looking to spot trend reversals and significant market shifts with a clear, color-coded visual representation of price action. The Color Code Overlay can be used alongside other technical indicators to enhance decision-making and improve trading strategies.

Clause de non-responsabilité

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