Hi All,
I am sure it will be immediately clear from looking at my code that I am new to Python. I love all the resources QuantConnect provides, however I am trying to learn by writing my own basic models and while I can do that when only one stock is involved, I have since tried to build a program that uses a long/short strategy, if one stock's RSI is above 70 and the other is below 30, it will go long on the one under 30 and short on the one over 70. However, whenever I try and do this with this code I've written it gives me the error: “Runtime Error: TypeError : 'Pair' object does not support indexing” I know there are examples of pairs trading and I have tried to follow them, but they all seem to simply trade one stock at a time, I would like to filter for the situation where one stock is above 70 and the other is below 30. I am sure I am missing a few important things, so if someone could point me in the right direction that would be great, as I am hoping to build out this strategy to work with more stocks in the future.
Thank you
Vladimir
F Breezy,
Here is simplified RSI pair trading algorithm very similar to yours from my library.
If you are satisfied with my answer, please accept it.
F Breezy
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!