Hi, is it possible to make constant-volume bars? i.e. rather than having for instance a 5 minute bar, it would be a bar that shows the OHLC values for a certain volume amount, 2000 contracts transacted or something similar.
QUANTCONNECT COMMUNITY
Hi, is it possible to make constant-volume bars? i.e. rather than having for instance a 5 minute bar, it would be a bar that shows the OHLC values for a certain volume amount, 2000 contracts transacted or something similar.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Gurumeher Sawhney
There is no built-in way to create constant volume bars. All of QuantConnect's pricing data is associated with a period. In order to create constant-volume bars, higher resolution bars would need to be read in OnData() and for every 2000 contracts, a TradeBar could be manually constructed.
Jordan lecourtois
Hi,
Late in the thread but here's my implementation of volume bar using a consolidator:
.ekz.
Nice! A big thanks for this. Recently learned about the value of tick bars and volume bars. Â Excited to give this a go sometime.Â
Also, i'm now following your repo on github. I'm looking forward to see what additional tools you come up with!
.ekz.
jordan lecourtois , you inspired me to look into Dollar bars, and in doing so I discovered an older post that discusses using the MLFinLab Library from Hudson and Thames to construct our volume bars and dollar bars…  in theory.
Check it out:Â
Â
Â
Louis Szeto
Hi Jordan and ekz
This can also be implemented as Renko bar of volume. Please check our demo algorithm in C# or python. It is possible to call a custom consolidator on Renko bar:
Best
Louis Szeto
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Nottakumasato
Hi Louis Szeto , thank you for your answer. I tried to use the code snippet as
but I am getting this error:
Do you know why this might be happening? Is it a LEAN version issue?
Nottakumasato
@Jordan-lecourtois your code is great but doesn't work on Bars or Tick classes that inherit from Python data
Nottakumasato
Louis Szeto looks like `RenkoConsolidator` became `ClassicRenkoConsolidator`:Â
Â
Louis Szeto
Hi Nottakumasato
Yes. We've made this design change to make it clearer.
Best
Louis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Kj5159
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!