Hi,
I am looking for a way to create a strategy that execute a simple SMA crossover strategy with about 20 different equities. What would be the easiest way to proceed? Is there an existing example?
Thanks
QUANTCONNECT COMMUNITY
Hi,
I am looking for a way to create a strategy that execute a simple SMA crossover strategy with about 20 different equities. What would be the easiest way to proceed? Is there an existing example?
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.
Varad Kabade
Hi Vincent Roye,
The best approach towards the strategy mentioned above is to create a SymbolData class that would store the required indicators and storing the SymbolData object in a dictionary where the respective symbol keys it. We have implemented a demo algorithm for your reference, which trades on six equities(assuming manual universe selection). The algorithm goes long when 50 days SMA crossed 100 days SMA. Note that we have used the shortcut method to initialize indicator in SymbolData class because we have a static Universe in the case of the dynamic universe; we recommend using indicator constructor(i.e., SimpleMovingAverage() instead of SMA()) because if the particular security gets removed the indicator would continue receiving data which would slow our backtest.
Best,
Varad Kabade
Vincent Roye
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!