Hi Guys,
I have been stuck for a few days and want to check if anyone has faced something similar.
I created a strategy based on a book that trades every Tuesday and follows the following rules:
- only buy if SPY price > 5 week SPY moving average
- 20 slots available
- stocks are picked only if their rate of change in the last 10 weeks is greater than 25%. If more stocks than slots are available the ones with higher ROC are picked
- trailing stop loss is used of 40% if condition one is met. stop loss is changed to 10% if SPY < 5 week moving average
I am seeing really bad results with QC500 compared to sp500 historical constituents (hardcoded). See results below. Pretty much every variation in parameters for SP500 yields better results than using QC500.
Can it be that SPY/SPX has loose correlation with QC500 ? I was reading the match is 65% However, I cant believe that would be only reason. ?
Is there a way to troubleshoot this. I downloaded set of orders for each of them, but I am having trouble comparing them
Maybe I am overfitting this and this strategy is not profitable/
Dario Teodori
Below are the results of sp500 historical constituents
Dario Teodori
I believe I found the problem. Unfortunately, the issue is with the good performer rather than the bad performer.
When using historical constituents, I was incurring in selection bias. I was picking a lot of companies with high growth but before they were added to the sp500. So those stocks were the ones giving me the best returns.
I am still looking to see if this strategy can be optimized or dumped altogether :)
Varad Kabade
Hi DarioA
lthough it is set to mimic SP500, QC500 selection is not necessary to be the same as SP500 constituents. They are selected in a daily basis based on dollar volume. Please refer to this source file on its logic.To select SP500 constituents, we recommend using the ETF constituents dataset with SPY.
Best,
Varad Kabade
Cameron Perot
Is it expected that for some days there are significantly less than 500 constituents in the SPY? Here are the top 25 dates with <500 constituents. The data was obtained using the `ETFConstituentsFilter` given here.
Derek Melchin
Hi Cameron,
Thanks for reporting this issue. To track our progress of resolving it, follow this data issue.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Check out our Wefunder campaign to join the revolution.
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.
Dario Teodori
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!