Hey guys!
I have a very simple question. I have a static list of several stocks that I would like to trade. I have my algorithm ready, but it is only using one symbol. How can I write it so that it will do this strategy for multiple equities?
In other words, how can I implement this exact strategy, but for many securities at the same time.
Thank you for your time!
Nico Xenox, you are a genius, do you also know the answer to this?
Nico Xenox
Hey Jesse Fleming
Dont have much time to explain but I will try to make it short.
If you have a static list the simplest form to include each ticker to the strategy would be to iterate trough each ticker.
Example for simple things:
If you have a lot of different tickers and for each ticker you have to do a lot of calculations, adding indicators, etc. The simplest form would be to have a dictionary of SymbolData:
little example:
If you already have everything that you need and your problem is just that it trades one security, you could simply loop trough each of the tickers in a list and check if the entry strategy is ready for each ticker.
Hope it helps:)
Jesse Fleming
All of those examples help tremendously. I knew I was going to hear back from you, brother. Your effort has helped me realize the biggest issue I am now having.
I love the idea of looping through entries and exits, but the problem then becomes all the consolidated data I have for this strategy. How can I loop through something like that?
When you said:
‘If you already have everything that you need and your problem is just that it trades one security, you could simply loop trough each of the tickers in a list and check if the entry strategy is ready for each ticker.’
That is exactly what I need to do. I hope this helps and hopefully this template algorithm will enhance what I mean.
Thank you once again, looking forward to hearing from you.
Jesse Fleming
Here is the template!
Nico Xenox
Hey Jesse Fleming
So you asked for quite a bit there xD
It took my quite a time to make it work and I had to add for each of the variables a dictionary. The code is not very beatiful but I guess it does the work…
Btw I changed the normal bar window in Twoweekbar into the other rolling window because you had two.
Please consider liking this if you're happy with my answer and also closing this thread 😊
Jesse Fleming
Nico Xenox you have outdone yourself. You are an incredibly hard worker. Thank you for all of this support!
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!