I have set the start date as 2020-01-01 and the end date at 2020-01-02, but the algo makes orders before 2020-01-01.
Can someone explain why and how can I change the script to avoid orders before 2020-01-01 (I know I can use self.Time to avoid trading before 2020-01-01, but I don't understand why it trades in the first place)?
Bonus question, I want to reset open and high prices on the rolling window every 4 hours. It seems that it doesn't work as expected in my algo.
Yuri Lopukhov
Hello, earliest order I get with your code is on 2020-01-02 09:31:00:
Also, you are using warmup feature here:
self.SetWarmup(100 * 4 * 60)
so it can feed data before the start date (this is what warm up is for). You can check for self.IsWarmingUp to see if warm up has completed, but in any case it shouldn't allow you to place orders before warm up is finished. Read more in the docs:
As for bonus question, I see you have 4hr consolidator, try resetting rolling windows with Reset() method there. Or you can check for Samples property to see if there are enough samples to reset it.
Mislav Sagovac
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!