EmreKb

[EmreKb] Volume Analysis

I've noticed that many Pine coders calculate buy and sell volumes by considering the volume of a bullish candle as buy volume and the volume of a bearish candle as sell volume. However, I believe this approach isn't very logical, especially for candles with long wicks like pinbars.


Therefore, I've devised a method to calculate the buy and sell volumes of a candle by separately considering the sizes of its top and bottom wicks and its body. I distribute the volume of the candle equally among its top wick, body, and bottom wick sizes. If the candle is bearish, I consider the body volume as sell volume; if bullish, as buy volume. For the top and bottom wick volumes, since there's a two-way movement, I allocate half to buy volume and the other half to sell volume.

This indicator displays the sum of buy and sell volumes retrospectively up to the "lookback" value on the candle. You can set the lookback value to 1 to only visualize the buy and sell volume distribution of a single candle.

If this method has been used by another Pine coder, please inform me!
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

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.

Want to use this script on a chart?