We will continue our adventure through the algorithmic trading jungle by taking a look at two common technical indicators: Moving Average Convergence/Divergence (MACD) and Relative Strength Index (RSI).
Disclaimer
I am not licensed as a financial advisor by IIROC. The information provided on this website does not constitute investment advice, financial advice, trading advice, or any other sort of advice. Conduct your own due diligence before making any life altering or investment decisions.
1. Moving Average Convergence/Divergence
The Moving Average Convergence/Divergence (MACD) indicator is constructed in three phases:
- A signal, typically defined as the difference between the 12 day and 26 day exponentially weighted moving averages (EMA), is created:
- Signal = EMA12 – EMA26
- The 9 day EMA of that signal is then computed:
- MACD = EMA9(Signal)
- A histogram is constructed as the difference between the Signal and the MACD
The 12 day EMA responds the changes faster than the 26 day EMA. Comparing the two can (allegedly) reveal changes in the trend of the price.
Let’s see what that looked like for the S&P 500 over the last two years:

The trade signal in the bottom figure takes a value of 1 (buy) when the Histogram is greater than zero, and -1 (sell) when the Histogram is less than zero. Before seeing how a trade strategy using the MACD compares against Buy & Hold, we will take a look at the Relative Strength Index.
2. Relative Strength Index
The Relative Strength Index (RSI) is a momentum oscillator. To calculate the RSI one first separates the higher closes (up day) from lower closes (down day), then the moving average (typically 14 day) of each of these is computed. The ratio of the two averages forms the Relative Strength Factor (RS), this is then turned into an index ranging between 0 and 100:
RSI = 100 – (100 / (1 + RS))
When the value of the RSI is less than 30 the stock is considered oversold, and due for a reversal soon. Conversely, when the value of the RSI is greater than 70 the stock is considered overbought, and due for a reversal.
Let’s see what that looked like for the S&P 500 over the last two years:

The trade signal in the bottom figure takes a value of 1 (buy) when the RSI is below 30, a value of 0 (hold) when the RSI is between 30 and 70, and a value of -1 (sell) when the RSI is above 70.
3. Performance Against Buy & Hold
To assess the performance of these two trade signals I will compare each against a buy & hold strategy in five year periods, beginning each month starting in July 2004. I am using the same assumptions as I did in the post on Moving Averages and Kalman Filters; that was a while ago, so here they are again:
Assumptions
- $1000 starting capital
- No commissions
- Only whole numbers of shares may be traded
- No cash is added during the study period
- Dividends are not considered
- No short selling

Neither one of the signals outperforms buy and hold. The main effect of using these seems to be missing out on the high returns (>10% annual), which can seriously impact portfolio performance.
4. Conclusion
The MACD and RSI do not perform well over any of the periods tested. Using these on their own as a trade signal can actively reduce returns – not what we want in our trading system.
Leave a comment