If have been trying my best to correct this error but I don't get where the problem is. Anyone has an idea why? I think the error might be on Coarse and Fine methods.
Thanks
If have been trying my best to correct this error but I don't get where the problem is. Anyone has an idea why? I think the error might be on Coarse and Fine methods.
Thanks
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.
Hey Gonzalo,
The issue is with how you are setting self.month. if it is December, when you set self.month, you'll get a self.month value of 12 + 2 or 14. Which means self.Time.month < self.month will always be true and Universe.Unchanged will always be returned.We should account for this by taking the modulus of the self.Time.month + 2.
self.month = (self.Time.month + 2) % 12
It looks like you are attempting to rebalance every 2 months. You need other restrictions in place for this to work properly. For example, consider the case that self.month = 1; self.Time.month < self.month isn't a strong enough condition to prevent trading in November and December. We can supplement that if statement with
self.Time.month < self.month or (self.Time.month >= 11 and self.month <= 2)
This will make sure we aren't trading daily in Months 11 and 12.
Also note that once we return Universe.Unchanged in coarse selection, fine selection is not called. This means we only need to implement it once in coarse selection.
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!