I use the 1 min bar and am trying to use consolidator bars to get daily bars. What happens to this data if i want to compare the daily bars. for eg I want to check if today's low <Yesterdays low. Is there any examples that i can refer to ?
QUANTCONNECT COMMUNITY
I use the 1 min bar and am trying to use consolidator bars to get daily bars. What happens to this data if i want to compare the daily bars. for eg I want to check if today's low <Yesterdays low. Is there any examples that i can refer to ?
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.
Jing Wu
Hi Rakesh, please refer to this example. The algorithm saves yesterday close price in OnEndOfDay event handler and compares the current bar close with the yesterday close in ConsolidatedBarHandler method. Alternatively, you can also use RollingWindow to keep the recent two trade bars"_window = new RollingWindow<TradeBar>(2);" and update the rolling window in ConsolidatedBarHandler. Please see this example .
var currBar = _window[0];// Current bar had index zero.
var pastBar = _window[1];// Past bar has index one.
Rakesh Kapoor
thank you. is there a way to consolidate weekly bars?
Jing Wu
To consolidate weekly bars, you need to expand the bars to be consolidated to a week.
var weeklyConsolidator = new TradeBarConsolidator(TimeSpan.FromDays(7));Rakesh Kapoor
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!