Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
2 period RSI strategy

All,

I implemented this 2 period RSI strategy on SPY with some slight modification of my own. The results are quite encouraging: > 140% of return with very small Drawndown. The return can be much larger if I use more leverage but I have made sure that in the whole process my cash stay positive. Quantopian is a quite powerful tool. I didn't write a lot of codes to implement this strategy.
http://stockcharts.com/school/doku.php?id=chart_school:trading_strategies:rsi2

One thing I don't quite understand is the Sharpe ratio. I think the earning curve looks quite linear and the Drawndown is quite small. However, the calculated Sharpe ratio is only ~0.4. Can someone provide the exact equation that Quantopian use to calculate Sharpe ratio? Thanks.

Best,
Huapu

3 responses

Thanks for sharing the algo!

I think the weakness of this algo is that it depends on the 2008 market slaughter to make it's money. Outside of that period, it's not a great performer. If you run it '02-'08 or '09-'13, it's not something to be excited about. Attached is a run of the code over the last 4 years.

This summer we wrote a lot about Sharpe. You can read about the way we calculate it here and here. A detailed Excel sheet we use as our "master copy" can be downloaded here.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

I am brand new to Quantopian. I mostly use C# and Wealth-Lab. VERY new to Python. Could someone show me how to make this algorithm work for a portfolio of stocks? It would go a long way toward figuring the language out. Is there a forum just for new users to ask naive questions?

Hello,
what is it necessary to make this algo work?
I receive following message:
8 Warning Undefined name 'ta'
8 Error Runtime exception: NameError: name 'ta' is not defined
I am new to python and programming.