# Understanding Volume Bars Threshold

I have been reading Advances in Financial Machine Learning by Marcos López de Prado and came across different Bar types, and simulating Volume Bars from execution data myself.

My understanding of Volume Bars is that they are based on a given number of shares traded (volume). Each bar represents trades whose total volume is equal to the volume threshold. A new bar is created when the total volume of the current bar reaches the threshold.

But the output of existing libraries[*1] based on the said book contradicts my understanding. What am I missing here?

To be more specific...

... Suppose we have below raw trade data, and set the threshold to 5.

I expect the Volume Bars to be like the following ...

The libraries return the Volume Bars like this...

## 1 Answer

The logic used by the library is to combine all trades equal or above the threshold and to never split one trade over two bars. So 6 becomes its own bar and 2 and 7 combine to be one bar.

I think this makes more sense than your approach. In the second table you show two bars with the same time. When using time on the x-axis there is no good way to even plot that as the bars will overlap.