OPEN-SOURCE SCRIPT
Candle Count RSI

📈 Candle Count RSI — A Dual-Perspective Momentum Engine
The Candle Count RSI is a custom-built momentum oscillator that expands on the classic Relative Strength Index (RSI) by introducing a directional-only variant that tracks the frequency of bullish or bearish closes, rather than price magnitude. It gives traders a second lens through which to evaluate momentum, trend conviction, and subtle divergences—often invisible to traditional price-based RSI.
💡 What Makes It Unique?
While the standard RSI is sensitive to the size of price changes, the Candle Count RSI is magnitude-blind. It counts candle closes above/below open over a lookback period, generating a purer signal of directional consistency. To enhance signal fidelity, it includes a streak amplifier, dynamically weighting extended runs of green or red candles to reflect intensity of market bias—without introducing artificial price sensitivity.
This dual-RSI approach allows for:
- Divergence detection between directional bias and price magnitude.
- Smoother trend confirmation in choppy markets.
- Cleaner visual cues using dynamic glow and background logic.
📐How Standard RSI Actually Works (Not What You Think)
RSI doesn’t just check if price went up or down over a span—it checks each individual candle and tracks whether it closed higher or lower than the one before. Here's how it works under the hood:
1.) For each bar, it calculates the change from the previous close.
2.) It separates those changes into gains (upward moves) and losses (downward moves).
3.) Then it computes a smoothed average of those gains and losses (usually using an RMA).
4.) It calculates the Relative Strength (RS) as:
RS = AvgGain / AvgLoss
5.) Finally, it plugs that into the RSI formula:
RSI = 100 - (100 / (1 + RS))
⚖️ What Does the 50 Line Mean?
- The RSI scale runs from 0 to 100, but 50 is the true neutral zone:
- RSI > 50 means average gains outweigh average losses over the period.
- RSI < 50 means losses dominate.
- RSI ≈ 50? The market is balanced—momentum is indecisive, no clear trend bias.
- This makes 50 a powerful midline for trend filters, directional bias tools, and divergence detection—especially when paired with alternative RSI logic like Candle Count RSI.
🔧 Inputs and Customization
- Everything is fully modular and customizable:
🧠 Core Settings
- RSI Length: Used for both the standard RSI and Candle Count RSI.
📉 Standard RSI
- Classic RSI calculation based on price changes.
- Optional WMA smoothing to reduce noise.
- Glow effect toggle with custom intensity.
🕯 Candle Count RSI
- Computes RSI using only the count of up/down candles.
- Optional smoothing for stability.
- Amplifies streaks (e.g., multiple consecutive bullish candles increase strength).
- Glow effect toggle with adjustable strength.
🎇 Glow Visuals
- Background glow (subpane and/or main chart).
- Fades based on RSI distance from the 50 midpoint.
- Independent color settings for bull and bear bias.
🧬 Divergence Zones
- Detects when Candle RSI and Standard RSI diverge.
- Highlights:
- Bullish Divergence: Candle RSI > 50, Standard RSI < threshold.
- Bearish Divergence: Candle RSI < 50, Standard RSI > threshold.
- Background fill optionally shown in subpane and/or main chart.
📊 Directional Histogram
- MACD-style histogram showing the difference between the two RSI lines.
- Color-coded based on directional agreement:
- Both rising → green.
- Both falling → red.
- Conflict → yellow.
🧠 Under the Hood — How It Works
🔹 Standard RSI
- Classic ta.rsi() applied to close prices, optionally WMA-smoothed.
🔹 Candle Count RSI (CCR)
- Counts how many candles closed up/down over the period.
- Computes a magnitude-free RSI from these counts.
- Applies a streak-based multiplier to exaggerate trend strength during consecutive green/red runs.
- Optionally smoothed with WMA to create a clean signal line.
- This makes CCR ideal for detecting true directional bias without being faked out by volatile price spikes.
🔹 Divergence Logic
- When Candle RSI and Standard RSI disagree strongly across defined thresholds, background fills highlight early signs of momentum decay or hidden accumulation/distribution.
🔹 Glow Logic
- Glow zones are controlled by a master toggle and drawn with dynamic transparency:
- Further from 50 = stronger conviction = darker glow.
- Shows up in subpane and/or main chart depending on user preference.
📷 Suggested Use Case / Visual Setup
- Use in conjunction with your primary price action system.
- Watch for divergences between the Candle Count RSI and Standard RSI for early trend reversals.
- Use glow bias zones on the main chart to get subconscious directional cues during fast scalping.
- Histogram helps you confirm when both RSI variants agree—useful during strong trending conditions.
🛠️ Tip for Traders
- This tool isn’t trying to “predict” price. It’s designed to visualize hidden market psychology—when buyers are showing up with consistent pressure, or when momentum has a disconnect between conviction and magnitude. Use this to filter entries, spot weak rallies, or sense when a trend is about to break down.
⚠️ WARNING
- Not for use with Heikin Ashi, Renko, etc.).
🧠 Summary
Candle Count RSI is not just another mashup—it's a precision-built, dual-perspective oscillator that captures directional conviction using real candle behavior. Whether you're scalping intraday or swing trading momentum, this script helps clarify trend integrity and exposes hidden weaknesses with elegance and clarity.
—
🛠️ Built by: Sherlock_MacGyver
Feel free to share feedback or reach out if you'd like to collaborate on custom features.
The Candle Count RSI is a custom-built momentum oscillator that expands on the classic Relative Strength Index (RSI) by introducing a directional-only variant that tracks the frequency of bullish or bearish closes, rather than price magnitude. It gives traders a second lens through which to evaluate momentum, trend conviction, and subtle divergences—often invisible to traditional price-based RSI.
💡 What Makes It Unique?
While the standard RSI is sensitive to the size of price changes, the Candle Count RSI is magnitude-blind. It counts candle closes above/below open over a lookback period, generating a purer signal of directional consistency. To enhance signal fidelity, it includes a streak amplifier, dynamically weighting extended runs of green or red candles to reflect intensity of market bias—without introducing artificial price sensitivity.
This dual-RSI approach allows for:
- Divergence detection between directional bias and price magnitude.
- Smoother trend confirmation in choppy markets.
- Cleaner visual cues using dynamic glow and background logic.
📐How Standard RSI Actually Works (Not What You Think)
RSI doesn’t just check if price went up or down over a span—it checks each individual candle and tracks whether it closed higher or lower than the one before. Here's how it works under the hood:
1.) For each bar, it calculates the change from the previous close.
2.) It separates those changes into gains (upward moves) and losses (downward moves).
3.) Then it computes a smoothed average of those gains and losses (usually using an RMA).
4.) It calculates the Relative Strength (RS) as:
RS = AvgGain / AvgLoss
5.) Finally, it plugs that into the RSI formula:
RSI = 100 - (100 / (1 + RS))
⚖️ What Does the 50 Line Mean?
- The RSI scale runs from 0 to 100, but 50 is the true neutral zone:
- RSI > 50 means average gains outweigh average losses over the period.
- RSI < 50 means losses dominate.
- RSI ≈ 50? The market is balanced—momentum is indecisive, no clear trend bias.
- This makes 50 a powerful midline for trend filters, directional bias tools, and divergence detection—especially when paired with alternative RSI logic like Candle Count RSI.
🔧 Inputs and Customization
- Everything is fully modular and customizable:
🧠 Core Settings
- RSI Length: Used for both the standard RSI and Candle Count RSI.
📉 Standard RSI
- Classic RSI calculation based on price changes.
- Optional WMA smoothing to reduce noise.
- Glow effect toggle with custom intensity.
🕯 Candle Count RSI
- Computes RSI using only the count of up/down candles.
- Optional smoothing for stability.
- Amplifies streaks (e.g., multiple consecutive bullish candles increase strength).
- Glow effect toggle with adjustable strength.
🎇 Glow Visuals
- Background glow (subpane and/or main chart).
- Fades based on RSI distance from the 50 midpoint.
- Independent color settings for bull and bear bias.
🧬 Divergence Zones
- Detects when Candle RSI and Standard RSI diverge.
- Highlights:
- Bullish Divergence: Candle RSI > 50, Standard RSI < threshold.
- Bearish Divergence: Candle RSI < 50, Standard RSI > threshold.
- Background fill optionally shown in subpane and/or main chart.
📊 Directional Histogram
- MACD-style histogram showing the difference between the two RSI lines.
- Color-coded based on directional agreement:
- Both rising → green.
- Both falling → red.
- Conflict → yellow.
🧠 Under the Hood — How It Works
🔹 Standard RSI
- Classic ta.rsi() applied to close prices, optionally WMA-smoothed.
🔹 Candle Count RSI (CCR)
- Counts how many candles closed up/down over the period.
- Computes a magnitude-free RSI from these counts.
- Applies a streak-based multiplier to exaggerate trend strength during consecutive green/red runs.
- Optionally smoothed with WMA to create a clean signal line.
- This makes CCR ideal for detecting true directional bias without being faked out by volatile price spikes.
🔹 Divergence Logic
- When Candle RSI and Standard RSI disagree strongly across defined thresholds, background fills highlight early signs of momentum decay or hidden accumulation/distribution.
🔹 Glow Logic
- Glow zones are controlled by a master toggle and drawn with dynamic transparency:
- Further from 50 = stronger conviction = darker glow.
- Shows up in subpane and/or main chart depending on user preference.
📷 Suggested Use Case / Visual Setup
- Use in conjunction with your primary price action system.
- Watch for divergences between the Candle Count RSI and Standard RSI for early trend reversals.
- Use glow bias zones on the main chart to get subconscious directional cues during fast scalping.
- Histogram helps you confirm when both RSI variants agree—useful during strong trending conditions.
🛠️ Tip for Traders
- This tool isn’t trying to “predict” price. It’s designed to visualize hidden market psychology—when buyers are showing up with consistent pressure, or when momentum has a disconnect between conviction and magnitude. Use this to filter entries, spot weak rallies, or sense when a trend is about to break down.
⚠️ WARNING
- Not for use with Heikin Ashi, Renko, etc.).
🧠 Summary
Candle Count RSI is not just another mashup—it's a precision-built, dual-perspective oscillator that captures directional conviction using real candle behavior. Whether you're scalping intraday or swing trading momentum, this script helps clarify trend integrity and exposes hidden weaknesses with elegance and clarity.
—
🛠️ Built by: Sherlock_MacGyver
Feel free to share feedback or reach out if you'd like to collaborate on custom features.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
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.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
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.