Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Swing 5 (modified 4) – Relative Strength Index Strategy

Let me know what you think and please contribute to any code cleanup or modifications to help this strategy.

Strategy based off of: http://www.tradestation.com/education/labs/analysis-concepts/relative-strength-index-strategy

Defining Strategy Rules:
RSI = 5 periods (modified in this backtest to 4 periods)
Long Entry
Buy Condition 1 - if the closing price is greater than its 200 day exponential moving average and the Relative Strength Index < 30.
Buy Condition 2 - if the closing price is less than its 200 day exponential moving average and the Relative Strength Index < 25 and absolute(open - close) > .70 * (High - Low) and close < open

Long Exit
Exit a long position when the Relative Strength Index crosses above 40. (In this backtest I've modified it to 60)

Strategy Explanation
In this strategy, we're trying to take advantage of a move to the downside that has gone too far and too fast. Sellers have panicked pushing prices down and there is no one at least in the short term left to sell. We are also saying with our rules that the return distribution is more normal above the 200 day exponential moving average so our buy signal 1 is less restrictive. While the assumption from just our observations is that when the close is below the exponential moving average the distribution of returns is more in the tails and less in the average so we make the rules more restrictive. This is not to say that the distribution above the 200 day exponential moving average cannot be non - normal. As this idea has not been tested yet - it's more of an observation at this point. Another safety net for these non - normal return events is that the exit criterion is short term, so that you're not in the trade too long just in case the market continues reverting to the downside

1 response

A quick update. In the original one I didn't make it absolute for the (open - close) in the Buy Condition 2

Buy Condition 2 - if the closing price is less than its 200 day exponential moving average and the Relative Strength Index < 25 and absolute(open - close) > .70 * (High - Low) and close < open