Hey guys!
I have created a simple algorithm that is just supposed to grab the previous week's high at the beginning of every week. I have also made it so that it logs the previous week's high every time spy price crosses above it.
I have noticed some very serious problems and I have no idea what is happening:
Sometimes it will log the previous week's high on a Tuesday instead of the Monday
The order logs seem to be a week behind.
When comparing the numbers on TradingView, I sometimes get different answers, some just a few cents off, and some up to a few dollars.
Can someone please tell me what I am doing wrong?
Nico Xenox
Hey Jesse Fleming
I made a simple code and added a few things that solved the problem you have.
Because you have timedelta(weekly) as soon as you encounter the first holyday it will always add 7 days. Which means that you have to change it like this:
This will always print the desired output on Monday as long as there is no holiday on that day.
Logs:
I checked the numbers on WSJ and they seem to be correct. There are two numbers that have a 0.X error but that might be because of QC that receives different data.
Hope it helps;)
Jesse Fleming
Nico Xenox Nico! Thank you so much for your helpful and timely response! I have just posted another forum on something much less complicated in my opinion. Will you please save me once again and impart some of your insight into the problem I am having now? You should be able to easily find it under the equities search filter.
Jesse Fleming
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!