I’m building a strategy to trade BTC. In my strategy I am using a trade bar consolidator and an EMA corresponding to that consolidator.
I found that when I have the EMA present in the Initialize function, the volume in the consolidator trade bar is double of that when I have the EMA lines commented out. I have not found any explanation as to why this happens in the documentation. The image shows the volume plotted (in the 15 minute consolidator) for the same day under the two conditions where the EMA is active in the code and where it is commented out. The peaks are shown to be around 800 and 400 respectively.
Can anyone explain to me the source of this difference?
Thanks for any insights!
15 minute consolidator trade bar volume when the EMA is included (top) and when it is commented out (bottom).
Yuri Lopukhov
I think because you have used consolidator in RegisterIndicator, it is calling consolidator callback twice, this probably sums plot values for same time point. Try replacing
with
Peter Hartvigsen
Thanks Yuri!
This explanation makes sense and it fixes my inconsistent volume across different consolidators.
Peter Hartvigsen
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!