The addition of support for "working data" in indicators within QuantConnect would enable strategies to respond to the most recent data, enhancing intraday trading efficiency. This feature would allow indicators to calculate and provide values based on the latest incomplete bar data, without altering the indicator's internal state.
The current inability to calculate "what-if" scenarios with indicators based on incomplete bars can limit our ability to make timely decisions. For instance, calculating the Simple Moving Average (SMA) using the latest minute-by-minute data instead of waiting for the hourly bar to close.
This could be done by introducing a WorkingData property for indicators, similar to consolidators, to access current working values. It could be inherent to indicators registered with a consolidator, where the working data is from the higher resolution timeframe of the consolidator.
Related posts:
- How to get current lower resolution incomplete bar (quantconnect.com)
- Resolution.Daily SimpleMovingAverage Indicator using today's intraday value: is this possible using ComputeNextValue or something similar? (quantconnect.com)
Mia Alissi
In QuantConnect, you can indeed access the current working data of a consolidator, which is the incomplete bar data, using the
WorkingData
property. This allows you to get theTradeBar
aTradeBarConsolidator
is currently consolidating. This can be useful for comparing current minute price data to the open of the current hour data, even if that hour isn't complete yet.Here is an example of how you can use the
WorkingData
property:(Source: Standardizing-consolidated-daily-data-to-match-default-daily-data)
However, it's important to note that using
ComputeNextValue
for indicators like Simple Moving Average (SMA) can change the internal state of the indicator and register the supplied intraday point as part of the private window of the SMA object. This means that the SMA calculated at the end of that day could be incorrect.For some indicators, supplying an intraday data point does not change the internal state of the indicator, and
ComputeNextValue
works as a "what-if" calculator. But for SMA, you would need to manually calculate the "what-if" scenario.For example, you can calculate the SMA manually like this:
(Source: Resolution-daily-simplemovingaverage-indicator-using-today-039-s-intraday-value-is-this-possible-using-computenextvalue-or-something-similar)
In conclusion, while there is no built-in method for "what-if" intraday calculations in QuantConnect, you can use the
WorkingData
property of consolidators to access the current working data and manually calculate the "what-if" scenarios for your indicators.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.
Craig Nathan
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!