Since 2018, I have been learning Machine Learning and its application in algorithmic trading. It is not an easy path, but I have found some books that have been very useful to me. One of them is Marco López de Prado's book "Advances in Financial Machine Learning".

Each chapter is an opportunity to question the basis of many analyzes. For example, at the very begining, in chapter 2 is reference made to the possibility of using bars that are not typical but that may be useful. Especially, when a normal distribution of the data is assumed. Some of the types of bars addressed in the chapter are: tick bars, volume bars, dollar bars, and information-driven bars.

These types of bars are used even in technical trading, although they are not as well known. In book we find a rigorous presentation of these bars from the mathematical point of view. In other chapters we find even code examples that help us implement ideas.

Although going to each chapter and programming from scratch each idea is a good approach to achieve a better understanding of the concepts. The truth is that there are already many GitHub repositories that have tried to program these concepts (the book has become very popular). For me, the best implementation of the concepts of the book has been achieved by the "Hudson and Thames" team. These guys are doing an excellent job. And not only limited to the ideas of López de Prado. And thanks to the programming environment we enjoy in QuantConnect, it is possible to load the library created by the "Hudson and Thames" team, called mlfinlab. 

I would like to make a small note here regarding the QuantConnect environment. It's not easy for someone who is starting, like me, to get all the necessary pieces to enter the world of algorithmic trading. First, it is a great problem to obtain financial data that is useful for predictive analysis. For a private individual, the costs of obtaining the data are prohibitive. Then, we do not find the fact that developing a backtest platform is not easy, much less developing a live trading platform. And finally, there is the point of being able to load libraries that allow us to make personalized analyzes. Other platforms do not allow loading TensorFlow, for example, or other famous DeepLearning libraries, which limits research in the field of machine learning. The only site I have found where all these problems are solved is in QuantConnect.

Returning to the topic of this post, in the attached backtest you will find an example of an algorithm that shows how to use mlfinlab to create volume bars. You will also find a Jupyter notebook with base tests to compare the normality of various types of bars: time bars, tick bars, volume bars and dollar bars. Based on the work of Jacques Joubert of the "Hudson and Thames" team

Greetings.