mini LeafAlgo Logo

Candle Color Ratio

LeafAlgo Candle Color Ratio

The Candle Color Ratio indicator is designed to analyze the ratio of green (bullish) to red (bearish) candles over a specified lookback period. This ratio can offer insights into the prevailing market sentiment and potential trend reversals. The indicator calculates the number of green and red candles and provides two key metrics: the Green to Red Ratio and the Red to Green Ratio. Additionally, it allows users to set a threshold for these ratios to identify extreme sentiment conditions.


– Green Score and Red Score: The script first checks the color of the candles over a user-defined lookback period (up to 10 bars back). For each bar, it assesses whether the closing price is higher (green) or lower (red) than the opening price. The green and red scores are calculated by counting the number of green and red candles, respectively, within the lookback period.

– Green to Red Ratio: This metric is the ratio of the Green Score to the Red Score. It quantifies the relative prevalence of bullish candles compared to bearish candles within the specified lookback period. A higher Green to Red ratio indicates a stronger bullish sentiment.

– Red to Green Ratio: This metric is the inverse of the Green to Red Ratio. It calculates the relative prevalence of bearish candles compared to bullish candles within the lookback period. A higher Red to Green ratio indicates a stronger bearish sentiment.


– Green Score and Red Score: These histograms display the raw counts of green and red candles within the lookback period. Traders can use these histograms to observe the recent distribution of bullish and bearish candles.

– Green to Red Ratio: This line graph represents the ratio of bullish candles to bearish candles. When this ratio is above 1, it indicates a predominantly bullish sentiment, suggesting potential upward momentum. Conversely, when it’s below 1, it signifies a bearish sentiment, suggesting potential downward pressure.

– Red to Green Ratio: This line graph represents the inverse ratio, indicating the strength of bearish sentiment relative to bullish sentiment. Similar to Green to Red, values above 1 indicate a bearish bias, while values below 1 indicate a bullish bias.

– Ratio Threshold: The white horizontal line on the chart represents the user-defined threshold. Traders can set this threshold to identify extreme sentiment conditions. When either the Green to Red ratio or Red to Green ratio crosses the threshold, it may signal overbought (above threshold) or oversold (below threshold) market conditions.

Potential Applications:

– Trend Confirmation: Traders can use this indicator to confirm the prevailing trend. A strong GRratioScore may validate a bullish trend, while a strong RGratioScore may confirm a bearish trend.

Contrarian Signals: Extreme readings (crossing the threshold) can be interpreted as potential reversal points. For example, a very high GRratioScore followed by a crossover below the threshold might indicate an overbought market and a potential bearish reversal.

Divergence Analysis: Traders can analyze divergences between price movements and the indicator. If price makes higher highs while the indicator shows lower highs, it may signal a weakening bullish trend.


– Lookback Period: The indicator’s effectiveness may vary depending on the selected lookback period. Longer periods smooth out fluctuations but may lag in capturing recent changes in sentiment.

– Threshold Sensitivity: The interpretation of extreme readings can be subjective. Traders should carefully select and adjust the threshold based on their trading strategy and market conditions.

– Lack of Context: This indicator solely focuses on candle color ratios and does not consider other factors like volume, market news, or fundamental analysis. It should be used in conjunction with other indicators and analysis techniques.

This indicator provides a simple yet valuable tool for assessing market sentiment and potential trend reversals based on candle color ratios. Traders can use this information to make informed trading decisions, but it’s essential to consider its limitations and use it as part of a comprehensive trading strategy.

Unlock LeafAlgo Premium Indicators and Algorithms

Start your 7-day free trial today and get full access to all 7 LeafAlgo premium indicators.

Scroll to Top