Hi,
New to Quant Connect and am trying to add daily bars for a small test universe of 4 stocks to a rolling in and out of sample window.
Where I would have say 100 days in-sample and 5 days out-of-sample. This window would then roll forward by 5 days at a time for say 20 rolls.
I can see that there is a ‘RollingWindow’ function for in-sample but how would I then test out of sample for 5 days and then roll forward?
Could some let me know if this is possible in QuantConnect please? And if so how would you do it?
Thanks
Aaron Janeiro Stone
While there is no way to manipulate time in a backtest, you can always consolidate data to fit into a rolling window.
Cole S
Hi Simon,
RollingWindow is just a datatype that will allow you to add whatever you want to it. To do what you are wanting I would create two rolling windows.
Then in OnData you call:
If you want to roll 5 at a time you would need to add some additional code as the above just rolls each bar.
Simon Coleman
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!