Hi all, how can i go about coding this - i want to enter the long when RSI cuts oversold limit from below and enter short when RSI crosses overbought limit from above.
Hi all, how can i go about coding this - i want to enter the long when RSI cuts oversold limit from below and enter short when RSI crosses overbought limit from above.
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.
Hey Javier,
Here's a simple RSI overbought/oversold algorithm that you can clone and use as a template.
We go long when the RSI signals oversold and short when the RSI signals overbought.
Follow the comments in the backtest to see how it works.
Best
Rahul
Hi Rahul thanks for reponding. However, what i am looking for is to long when the RSI comes back from the oversold territory, i.e. when RSI crosses from below 30 to above we go long, and when RSI crosses from above 70 to below 70 we go short.
Hey Javier,
Sorry for misunderstanding. I've updated the algorithm to enter a position when the RSI crosses out of the oversold/overbought region. Because the RSI value from only the last bar is needed to know if there has been a crossover, we use a single pointer to keep track of the last RSI value.
Thanks thats a really elegant solution, helped greatly. Cheers.
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!