1
$\begingroup$

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.

enter image description here

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

enter image description here

The libraries return the Volume Bars like this...

enter image description here

[*1]
mlfinlab by Hudson and Thames
Adv_Fin_ML_Exercises by BlackArbsCEO

$\endgroup$
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.