Hi! I'm pretty new to Quantconnect and am trying to test my skills by making a gap up scanner, with the Universe restricitions that the 10 day SMA of the volume is > 3,500,000 and the price is between 1 and 100. The first is that when I go and look at the order history in the backtesta and then check the volume on the date it was ordered, it definitely does not satisfy the 10 day SMA volume conditions in the Universe (for example AAAU on 10/14). I'm sure I am doing something wrong when defining this Universe, but I'm not sure what. The second issue is that my algorithm seems to only trade "SPY" for the first 14 days before trading other securites as well. Additionally, the part that detects a gap up seems to be not working as expected. Any help would be greatly apprecieted! I have attached a backtest with the code below.
Derek Melchin
Hi Cole,
Welcome to QC! The algorithm above is running into issues because it's trading at stale prices. To resolve this, we should set the universe resolution to minute since we are trading 10 minutes before the close. See the attached backtest for reference. Notice how the logs of the backtest below show all of the traded securities have their SMA above the threshold.
SPY is exclusively being traded for the first several days because the SelectionData class isn't warming up the SMA. We recommend manually warming-up the indicator in the constructor of this class.
Best,
Derek Melchin
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.
Cole Kuster
Thank you so much for your help!!
Cole Kuster
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!