TradingView
copesprings
Mar 30, 2022 3:12 PM

Volume Density Candle 

Tesla, Inc.NASDAQ

Description

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.

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.
Comments
Nofeet
Thanks for the script, I made some modifications and now I love this indicator.

One thing I'm still trying to figure out is how to increase or decrease the threshold for price range divergence and how it affects candle transparency/density.

EDIT: To clarify, only periods with significantly greater density would display candles with decreased transparency. Currently I'm getting too much noise on lower timeframe charts.

Any idea what code I could modify to add this option?
copesprings
@Nofeet,
Do you mean when the volume suddenly increased or decreased drastically
(due to market opening or sudden price drop, etc)?
If that's the case, you can adjust average length or max deviation rate,
but other than that I have no idea how to solve this at the moment.
This indicator doesn't work all the time, so I use this only as a support.
crypteisfuture
Thanks, very useful!
More