I am building a custom indicator for futures. I am following the pattern outlined in EmaCrossFuturesFrontMonthAlgorithm.cs. Similar to that, I only want to feed the Front Contract to my indicator, so i believe this example lays out the pattern I want to follow.
I am using the automatic wireup of my indicator, just as is done in this example, using ResolveIndicator and then RegisterIndicator.
In ResolveIndicator I have the resolution set to Daily so I get a daily tradebar.
I get the updated TradeBars in the ComputeNextValue method of my indicator, so that is working. But for the daily update to my indicator, I am seeing a significant number of OnDate invocations ,which I assume is because in AddFuture method, I am using the default resolution of 1 minute.
Here are my questions:
1. Is my understanding correct?
2. do I need to set resolution to daily in AddFuture?
3. Will OnData always fire after the OnDataConsolidated happens?
4. Will OnData only fire for the Front Contract, or for every contract that is active?
Thanks in advance!
Derek Melchin
Hi Nathan,
(1/2) We only have tick, second, and minute data resolutions for futures.
(3) Yes.
(4) Only for the front contract since the expired contracts will be automatically removed. See the attached backtest for reference.
Best,
Derek Melchin
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.
Nathan Hanks
Thank you Derek Melchin - just so I am clear:
1. even if I use a Consolidator of daily (which works), OnData is going to fire on the minute because that is the max resolution I can set in AddFuture(xxxx, Resolution.Daily)?
2. Since I am using OnSecuritiesChanged, I don't really need to do anything with OnData as the OnDataConsolidated event will handle the updating of my indicators with the front contract only.
Derek Melchin
Hi Nathan,
(1) Correct.
(2) Correct, the order logic can be placed in the consolidator callback method.
Best,
Derek Melchin
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.
Nathan Hanks
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!