Hello everyone,
I would like to use the current H1 bar volume and compare it to the volume of past H1 bars. To do that I have created a RollingWindow object that I update with the volume of the consolidated H1 quote bar. However, that volume does not match the volume I compute by summing up the volumes of each M1 bar in the OnData event handler. The differences between the two are not constant neither in size nor in sign. Could someone explain me why this happens? Thank you very much in advance.
Louis Szeto
Hi GabrielÂ
You're assuming OnData will run first before your consolidation handler method, but the fact is consolidator updates before OnData received the bar (docs, check point 15-16). So you're using data of 1-minute behind to contrast.
The attached backtest was event-flow adjusted. You can see the differences were 0 or very close to zero (numerical precision issue on data type).
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.
Gabriel Fenger
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!