Explainers / RSI Candles by glaz
RSI Candles by glaz, explained from the source
RSI Candles is an open-source TradingView indicator by glaz with about 28,000 boosts. In the code its title is "RSI Chart Bars". It has no pane of its own. It paints the price bars on the main chart green or red from the value of a hidden RSI. This page walks through the published code, says what each part really does, and ends with where it fails. It does not say whether the indicator makes money, and it gives no trades.
The surprise: green means the zone most books call overbought
The whole script is 14 lines. A bar is painted green when a 14-bar RSI of the close is above 70, red when it is below 30, and left alone otherwise. Many readers see green as "good to buy" and red as "sell". The code says something narrower: green means RSI is high right now, which is the reading textbooks label overbought. The colour reports where RSI is. It does not say what happens next.
Step 1: the RSI
The standard calculation: average gains and average losses of the close over 14 bars, using the usual smoothing. The length is a setting. The price is not: it is always the close.
Step 2: the two levels
"UpLevel" defaults to 70 and "DownLevel" to 30. Both accept any whole number from 1 upward. The code does not check that the upper level is above the lower one, or that either is under 100. If you set them so both tests pass at once, green wins because it is tested first.
Step 3: the colour
Green above the upper level, red below the lower level, no colour between. A note in the code suggests removing candle borders so the colours show better.
Step 4: what is not in the code
No RSI line to look at, so you cannot see how close the value is to a level. No alert conditions. No test for RSI crossing back out of a zone.
What we checked in Python
We ported the logic to Python and ran it on invented random-walk prices with a typical move of 1% a bar, each bar built from 10 smaller steps: 40 runs of 5,000 bars, the first 300 of each run left out.
How many bars are coloured. Green on 4.6% of bars and red on 4.4%, about 9% in all. These prices have nothing to find, so a coloured bar is what a 14-bar RSI does on noise about one bar in eleven.
They come in stretches. A median of 123.5 separate coloured stretches per 4,700 bars, each about 3 to 4 bars long on average. A second green bar in a row is the same move, not a new event.
The live bar flickers. RSI uses the current price until the bar closes. For every 10 bars that finished coloured, about 4 more were coloured at some point inside the bar and finished plain (7,191 against 16,955).
These figures describe the code on invented data, not any market.
Where it fails
- The colours invite the wrong reading. Green is RSI above 70. It is a description of the recent move, not an instruction.
- You cannot see the RSI. The script draws no line, so a bar at 70.1 and a bar at 95 look the same.
- Random prices get coloured too. About one bar in eleven in our port.
- The levels are unchecked. They accept values that make no sense, including an upper level below the lower one.
- The live bar can be coloured and then lose it. About 4 did for every 10 that kept it.
- Only the close is used. There is no price setting.
- No alerts.
- In a strong trend RSI stays high or low for a long time. A long run of one colour says the trend continued so far and nothing more.
Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. RSI Candles is by glaz on TradingView; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script behaves on any market.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.