I understand I can change between tick, second, minute, hour and day resolutions, but it's not clear to me how I can work on 5 minute chart. Not just indicators, but also I want to process OnData for every 5 minute data.
QUANTCONNECT COMMUNITY
I understand I can change between tick, second, minute, hour and day resolutions, but it's not clear to me how I can work on 5 minute chart. Not just indicators, but also I want to process OnData for every 5 minute data.
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.
Michael Handschuh
//create a 5 minute SPY consolidator _consolidator = new TradeBarConsolidator(TimeSpan.FromMinutes(5)); _consolidator.DataConsolidated += SpyFiveMinute; SubscriptionManager.AddConsolidator("SPY", _consolidator); // this is what SpyFiveMinute's signature should look like public void SpyFiveMinute(object sender, TradeBar fiveMinuteSpyBar)
Geoffrey Israel Chinedu
I understand I can change between tick, second, minute, hour and day resolutions, but it's not clear to me how I can work on 5 minute chart. Not just indicators, but also I want to process data in the alpha update function for every 5 minute data.
Arthur Asenheimer
Hi Geoffrey,Â
have you already checked the 'Consolidating Data' section in the Documentation? There are many examples explaining very well how to use Consolidators. The BootCamp does also cover this topic, so I recommend to complete the BootCamp. It's definitely worth the time.Â
However, I've attached a backtest which demonstrates how to create a consolidator for 5-minute bars. It is just one line of code:Â
self.Consolidate(self.spy, timedelta(minutes=5), self.FiveMinuteBarHandler)
You can then put your code into the methodÂ
def FiveMinuteBarHandler(self, consolidated):
#self.Debug(f"{self.Time}|FiveMinuteBarHandler fired! ")
pass
Btw, please avoid to create multiple posts for the same issue. Thank you.Â
Jacob Barbee
Does this work for forex too? If so could you show how that would look?
Â
Varad Kabade
Hi Jacob Barbee,
The above way would even work for forex data refer to the attached backtest.Â
Note that forex data is returned as QuoteBars, not TradeBars. This means you must create QuoteBarConsolidators instead of TradeBarConsolidators for your forex data if you are manually creating consolidators. Refer to the following code snippet.
Â
Best,
Varad Kabade
Blackpanther
 @varad-kabadeÂ
how will it be used for crypto ?
Vladimir
Blackpanther
-→ how will it be used for crypto ?
Try this.
Blackpanther
Vladimir  thanks
Â
Hitoshi Harada
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!