Hi, I am building a strategy y based on the EMA(8) and I am consolidating data to 5 min data.
The indicator updated every 5 min but I would like to have a real-time update, (like the broker chart for example).
Is that possible to code?
Thanks
Code: self.AddEquity("SPY", Resolution.Minute)
FiveMinuteConsolidator = TradeBarConsolidator(timedelta(minutes = 5))
FiveMinuteConsolidator.DataConsolidated += self.On5minData
self.ema8 = ExponentialMovingAverage(8)
self.RegisterIndicator("SPY", self.ema8, FiveMinuteConsolidator)
self.SubscriptionManager.AddConsolidator("SPY", FiveMinuteConsolidator)
self.SetWarmUp(timedelta(8))
Rahul Chowdhury
Hey Walid,
What do you mean by real-time update?
Do you mean you want to update the indicator with live data? In that case you'll need to run your algorithm on a live deployment.
If you mean you want to update the indicator at every time step until it closes at the 5 minute mark, it is not possible to do that, furthermore, it is not good practice to use indicators in that way.
Best
Rahul
Walid Jlaiel
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!