I've been having some trouble with a momentum "in and out" style strategy I have been working on.
It picks 10 equities every day for its universe, and either rebalances into those, or rebalances into bonds.
Problem: on average 1-2 equities I'm buying every day generates a "Sell on Market Open" order which gets immeditely cancelled, as well as a log stating that the security has been "marked as non-tradable". I looked up some of these stocks, and it does not look as if they were delisted or anything else. From then on in my backtesting, these holdings cannot be liquidated, but still appear as part of the portfolio holdings, and eventually cause trades to fail due to leverage.
I'm pretty new to this platform (I'm used to zipline), so odds are I am doing something wrong here, I just can't see why this would happen.
Shile Wen
Hi Christopher,
When using Universe selection, we do not want to call AddEquity and RemoveSecurity as the Universe selection automatically adds and removes the securities for us. This addresses the non-tradeable securities issue. Furthermore, instead of repeatedly calling History for data, we should store the data inside a dict of RollingWindows keyed by Symbol, and this will greatly speed up the algorithm as well as use less resources.
Best,
Shile Wen
Karamazov
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!