OPEN-SOURCE SCRIPT
Updated Volume Density Candle

A candle chart that indicates congestion or resistance by the color of each candle.
The transparency of each candle is based on volume density.
Volume density is calculated as follows.
Volume density = Volume / Price range
Price range uses true range "max(high - low, abs(high - close[1]), abs(low - close[1]))".
Since volume density varies drastically by stock or time, the transparency is calculated based on the deviation rate from the average volume density.
If the candle is shorter and the color is brighter (less transparency), there is more transactions in the narrow price range than usual, and it could mean the candle's price range is congestion or resistance.
If the price breaks through that price range or rebounds from it, the price could move further in that direction.
The transparency of each candle is based on volume density.
Volume density is calculated as follows.
Volume density = Volume / Price range
Price range uses true range "max(high - low, abs(high - close[1]), abs(low - close[1]))".
Since volume density varies drastically by stock or time, the transparency is calculated based on the deviation rate from the average volume density.
If the candle is shorter and the color is brighter (less transparency), there is more transactions in the narrow price range than usual, and it could mean the candle's price range is congestion or resistance.
If the price breaks through that price range or rebounds from it, the price could move further in that direction.
Release Notes
Added "Max Transparency" setting to avoid invisible candle.Fixed a bug when the price range is 0.
Release Notes
Removed candles with no price change from average calculation.Release Notes
Added options to exclude the first or last candle of the intraday session from the average because those two candles distort the average in some markets.Release Notes
Added an option to change the max deviation rate.Release Notes
Minor fix.Release Notes
Fixed max deviation rate option.Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.