The entire script has been re-written to add more features.
Below is a description of how this updated indicator works.
For simplicity we'll be on the daily timeframe and assume there is only 100 candles being displayed with one source selected as the RSI MA1 (moving average). The MA1 (moving average length) is set to 14 days.
Each block represents the percent rank of the candle's RSI value compared to all previous candles.
An example of how it is calculated:
Let's say the current candle's RSI is extremely low at 8, it will then compare its value to the prior candle. If the current candle's RSI is lower than the previous, it will count how many previous candles there were until it finds a value less than 8. If 99 candles were counted, then this means there were 99 counted candles until a value below 8 was found.
This 99 value is assigned to the current colored block. To get the color for this block, It is positioned within a percent rank with all other blocks that recorded their current candle's RSI lower than previous candles' RSI. Since there were only 100 candles and this one was lower than 99 prior candles, it will belong to the color group, "percent rank colors low to lower" 91 to 100 percent rank (currently set to bright pink/purple. If however the current candle's RSI only was lower than one previous candle, it'd have belonged in to 0 to 10 percent rank (dark red color).
The same principle is applied when dealing with the candle's RSI that is higher than previous RSIs. The only difference is, if the current candle's RSI is higher than 99 prior candles, it will be compared with all other blocks that had stored values of where a their candle's RSI was higher than previous candle RSIs. The color will then be assigned to the color group "percent rank colors high to higher" and will be placed in the 91 to 100 percent rank (bright teal color).
The formula for the timeframe length of candles is as follows:
99 counted candles are converted in to seconds then divided by the seconds in a month.
86,400 seconds in one day * 99 daily counted daily candle = 8,553,600 total seconds.
8,553,600 total seconds divided by 2,628,003 seconds in a month = 3.3M (M for month) since a prior candle was found that had a lower RSI.
This indicator's options are:
Sources - the amount of sources to display, minimum is 1 and maximum is 10 (note: having 10 sources creates a longer script load time. Trading view will not load scripts that are longer than their maximum load time limit.)
Load from the beginning / load from x bars - choose whether to load the blocks from the beginning of the chart or from the past amount of bars.
x bars: - the amount of prior bars of when the indicator should load.
Color based on (all bars)/(x bars:) - All bars will look at all prior candles for when calculating higher or lower prior candles and the percent rank color it will receive. X bars will only look at past amount of candles you enter.
x bars: - amount of prior bars to consider when calculating percent rank colors and time since prior low or high. This value only works if you have set color based on (all bars)/(x bars:) to "x bars:".
block vertical height trim - controls the vertical height of the blocks. At 0 there is barely a vertical gap between blocks at 0.5 the blocks disappear. minimum value is at 0, max is at 0.5.
Sources
sources with "MA1" in their name use the moving average length MA1. Whether sources use the MA1 or not, you can apply an additional moving average with the MA+.
ATR MA1 - All true range
body distance - the upper body minus lower body of the candle (does not include the wicks).
CCI MA1 - commodity channel index.
close percent - current close percent difference from previous close.
close - close price.
COG MA1 - center of gravity.
dollar value - volume * ((high + low + close) / 3)
close distance over volume - percent difference from current close to previous close divided by volume.
gaps - current open minus previous close.
high - high price.
low - low price.
MFI MA1 - money flow index.
OBV - on-balance volume.
open - open price.
range MA1 - moving average of high minus moving average of low.
RSI MA1 - relative strength index.
RVI MA1 - relative vigor index.
volume MA1 - moving average volume.
volume - volume.
Percent rank colors low to lower and percent rank colors high to higher - choose the colors for each block that falls in the percentage ranges. For source values that are lower than previous lows, they will use the low to lower colors, while source values higher than previous ranges will use the high to higher.
show more labels on left - there is a limit to how many labels can be shown. Moving this slider to the left will display the block's counted time label. Moving it enough to the left starts to remove labels to the right in order to display prior labels.
show more labels on right - if you have increased "Source label slider" to move labels to the left, if you're on a higher trading view plan, you will have access to more labels to be displayed. You might be able to increase this value to expand the range of labels shown. If you increase it too much labels on the left will begin to be removed.
source name label size
source value label size
title label horizontal distance - controls the horizontal distance of title labels.
source label text color
source label text outline color
title label text color
title label text outline color