I added a bunch of indicators to a dataframe on Wednesdays for purchasing stocks and stored a couples of the columns of wednesday data in a couple dictionarys. I created a second dataframe to be looked at on Monday, Tuesday, Thursday and Friday with the same indicators and tried to load the saved data from the dictionary into the dataframe for comparison. However the 'past data' from the dictionary in the second dataframe is the same as the 'current data' in the dataframe. So it is not working like a rolling window.. I would basically like a rolling window in a dataframe since that is all i can seem to do at this point. I think I am close but I have been working on this forever and need help. Can someone help? Can this be done.
Steven Sucheck
here is a backtest
Steven Sucheck
Actullay, it does seem to be working, but not perfectly. I look at the enterdata dataframe on Wednesday and compared that to the data in the Exitdata dataframe that should have been created on Thursday and noticed that the mapped values from Enterdata to Exitdata were the same (for example variables KminusD vs KminusDprev in Exitdata). I expected fresh KminusD in exitdata, but the values were the same and assumed it was not working. When I looked at Exitdata fired on Friday now the mapped Enterdata values in Exitdata are still the same as expected and there is acturally fresh data in Exitdata for KminusD. So now it is acting as rolling window, and the values keep updating on Monday and Tuesday. So my questition is why is there no fresh data in Exitdata for the event that fired on Thrusday? Also, I understanding that the indicators are using daily resolution (except for my price variable which is hourly) and therefore for should be calculated from the preceding days close. I am looking at the period for 8-10-2020 to current.
Steven Sucheck
When I changed the fire time from 9:30am to 10:30 am on the M T H F event the second dataframe updates the way I expect. It must not like 9:30 am.
Shile Wen
Hi Steven,
The reason that scheduling the event at 10:30 instead of 9:30 works is because this gives the algorithm a chance to create an hour bar of data from 9:30 to 10:30. If we’d like to get data earlier, we can set our resolution to Resolution.Minute, and schedule our functions at 9:31 when there has been a bar of minute data formed from 9:30 to 9:31, which I’ve shown how to do in the attached backtest.
Best Regards,
Shile Wen
Steven Sucheck
Thank you very much for looking into this.
Steven Sucheck
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!