Chapter 11
IN THIS CHAPTER
Analyzing trends using moving averages
Generating signals with stochastic oscillators
Measuring momentum with the MACD
Comparing securities using relative strength
In today’s tech‐driven world, computer technology and powerful software developments have ushered in a new era for technical analysts. With greater reliance on Internet‐ready computers, tablets, and smartphones, we’re constantly connected to the online world. This gives us endless access to a steady stream of financial data, news, analysis tools, and much more, something that was little more than a wild dream only a decade or two ago. Thanks to technology improvements, we have more methods and resources available to us as market participants. In technical analysis specifically, powerful chart indicators have become faster, easier to calculate automatically, and much more accessible to the individual investor.
However, the ease of calculating, modifying, testing, and using computer‐generated trading tools is as much a curse as it is a blessing. New traders often shun visual pattern analysis, instead preferring computer‐generated indicators (series of data points) and oscillators (which show fluctuations of data points). Doing so is a mistake. Although the perceived precision of these calculations seems to add to their allure, you nevertheless need to be aware that computer‐generated analysis tools still have their flaws. These changes give you a combination of visual pattern analysis and calculated indicators and oscillators, such as those we discuss in this chapter.
As a new trader, it’s easy to be swept up in the seemingly infinite array of indicators and analysis tools at your disposal. By following too many, you risk what we refer to as analysis paralysis. This results when your never‐ending analysis and insatiable desire to check one more indicator, chart, or data set freezes you, preventing you from actually making a decision and taking action. You’re paralyzed by your unending analysis. At the end of the day, your research means nothing if you fail to pull the trigger and place a trade. However, by narrowing your focus to a specific set of tools and indicators that you’re intimately familiar with, you prevent yourself from suffering the unwanted effects of analysis paralysis.
This chapter describes how to create and use a manageable subset of the tools that are available in today’s charting platforms. We recommend that you learn how to use a small set of tools that can help you trade profitably rather than worry about how every available tool works. Find out how to trade profitably using this subset of tools before deciding that you need to add to your toolbox.
In this chapter we describe the computer‐generated tools that we use every day. We explain two types of moving averages, along with the highly popular moving average convergence divergence indicator (MACD) and the stochastic oscillator. In addition, we discuss the powerful concept of relative strength.
A moving average is a trading indicator that shows the direction and magnitude of a trend over a fixed period of time. Some traders call it a price overlay because it’s superimposed over the price data in a bar chart. Moving averages visually smooth out the data on a price chart to help make trend identification less subjective. All moving averages follow a stock’s price trend but can’t predict changes. They report only what has happened.
As its name implies, a moving average shows the average of a stock’s up‐and‐down price movements during a specific period of time. A stock’s daily closing price usually is the value being averaged, but any value on a price chart can be displayed as a moving average. Some traders, for example, prefer using the midpoint between daily high and low prices for the moving average calculation, while others prefer to use the opening price, the high, or the low. You can also apply moving averages to other financial data, such as volume.
You’ll find that moving averages are used as indicators by themselves or in conjunction with other indicators. They’re also the building blocks for other indicators and oscillators such as the moving average convergence divergence (MACD), invented by Gerald Appel in the 1960s. Before discussing how the MACD is used (see the section “Tracking Momentum with the MACD,” later in this chapter), we must explain moving averages and how they’re calculated. Two important types of moving averages are described in this section.
A simple moving average (SMA) is simple to calculate and simple to use. To calculate it, you add a number of prices together and then divide by the number of prices you added. (We explain how to use an SMA in the later section “Comparing SMAs and EMAs.”)
An example makes the SMA clearer. In this example, a nine‐day moving average of Bank of America’s (BAC) closing price is calculated throughout August 2016 and then is plotted on a price chart. To start the SMA calculation, use the closing prices shown in Table 11‐1. Add the first nine closing prices together, from August 1 through August 11, and divide by 9. The resulting value is placed alongside the ninth trading day, August 11. Continue for each subsequent day in the month.
TABLE 11‐1 Simple Moving Average of BAC Closing Price
Date |
Close |
SMA |
8/1/2016 |
14.21 |
|
8/2/2016 |
14.01 |
|
8/3/2016 |
14.36 |
|
8/4/2016 |
14.36 |
|
8/5/2016 |
14.92 |
|
8/8/2016 |
15.00 |
|
8/9/2016 |
15.06 |
|
8/10/2016 |
14.69 |
|
8/11/2016 |
14.76 |
14.59 |
8/12/2016 |
14.79 |
14.66 |
8/15/2016 |
14.90 |
14.76 |
8/16/2016 |
15.04 |
14.83 |
8/17/2016 |
15.02 |
14.90 |
8/18/2016 |
15.03 |
14.92 |
8/19/2016 |
15.09 |
14.93 |
8/22/2016 |
15.05 |
14.93 |
8/23/2016 |
15.22 |
14.98 |
8/24/2016 |
15.27 |
15.04 |
8/25/2016 |
15.40 |
15.11 |
8/26/2016 |
15.66 |
15.19 |
8/29/2016 |
15.71 |
15.27 |
8/30/2016 |
16.06 |
15.38 |
8/31/2016 |
16.08 |
15.50 |
Figure 11‐1 shows a bar chart of Bank of America (BAC) from August 2016 through September 2016. The thick black line superimposed on the chart’s price data represents the simple moving average for BAC.
To calculate the second SMA point, add the prices from August 2 through August 12 together, divide by 9, and place the result as the SMA data point next to August 12. Another way to think of calculating SMAs is that you drop the oldest price in the calculation and add the closing price from the next price bar. Continue this series by dropping the oldest price, adding the newest price, and dividing by 9 for the remainder of the month.
If you’re mathematically inclined, here’s what the series looks like as an equation:
Another commonly used moving average is the exponential moving average (EMA), which can be superimposed on a bar chart in the same manner as an SMA. The EMA is also used as the basis for other indicators, such as the MACD (moving average convergence divergence) indicator, which we discuss later in this chapter.
Although the calculation for an EMA looks a bit daunting, in practice it’s simple. In fact, it’s easier to calculate than an SMA, and besides, your charting software will do it for you. Here are the calculations:
You can handle the start of the calculation in one of two ways. You can begin either by creating a simple average of the first fixed number (N) of periods and use that value to seed the EMA calculation, or you can use the first data point (typically the closing price) as the seed and then calculate the EMA from that point forward. You’ll see other traders handling it both ways, but the latter method makes more sense to us. It’s the method used in calculating the EMA amounts in Table 11‐2, which shows a nine‐day EMA calculation for Bank of America throughout August 2016. The EMA value for August 1 is seeded with that day’s closing price of $14.21. The actual EMA calculation begins with the August 2 closing price. For comparison, we include the results of the earlier SMA calculation to illustrate the difference between an EMA and an SMA.
TABLE 11‐2 Exponential Moving Average of BAC
Date |
Close |
EMA |
SMA |
8/1/2016 |
14.21 |
14.21 |
|
8/2/2016 |
14.01 |
14.17 |
|
8/3/2016 |
14.36 |
14.20 |
|
8/4/2016 |
14.36 |
14.23 |
|
8/5/2016 |
14.92 |
14.36 |
|
8/8/2016 |
15.00 |
14.48 |
|
8/9/2016 |
15.06 |
14.59 |
|
8/10/2016 |
14.69 |
14.61 |
|
8/11/2016 |
14.76 |
14.64 |
14.59 |
8/12/2016 |
14.79 |
14.67 |
14.66 |
8/15/2016 |
14.90 |
14.71 |
14.76 |
8/16/2016 |
15.04 |
14.77 |
14.83 |
8/17/2016 |
15.02 |
14.82 |
14.90 |
8/18/2016 |
15.03 |
14.86 |
14.92 |
8/19/2016 |
15.09 |
14.90 |
14.93 |
8/22/2016 |
15.05 |
14.93 |
14.93 |
8/23/2016 |
15.22 |
14.98 |
14.98 |
8/24/2016 |
15.27 |
15.03 |
15.04 |
8/25/2016 |
15.40 |
15.10 |
15.11 |
8/26/2016 |
15.66 |
15.21 |
15.19 |
8/29/2016 |
15.71 |
15.31 |
15.27 |
8/30/2016 |
16.06 |
15.46 |
15.38 |
8/31/2016 |
16.08 |
15.58 |
15.50 |
In this example, the EMA doesn’t show the same nine‐day lag at the beginning of the chart as the SMA. Notice that the results of the moving‐average calculations also differ. Figure 11‐2 shows the difference between the SMA and the EMA on the Bank of America chart. The EMA data is shown as a solid dark line. For comparison, the SMA data is also plotted using a thinner, lighter line.
Both simple moving averages and exponential moving averages are used regularly by long‐term investors, position traders, and short‐term traders alike. Each moving average has its strengths and weaknesses. Which you choose can be a matter of personal preference, but one may be better suited than the other depending on the time frame you’re trading. As position traders, we use a combination of both SMAs and EMAs.
The SMA has the benefit of being consistently calculated from one charting platform to the next. If you ask for a 20‐period SMA, you can be certain that the result will be identical to every other 20‐period SMA for the same stock during the same time period (assuming there are no errors in the price data).
Discovering that you’re basing your trading decisions on an inaccurate moving average is more than a bit disconcerting. This problem has less of an effect with short‐period calculations such as the nine‐day EMA example in Table 11‐2, but it’s especially problematic for longer‐term EMA calculations. For this reason, the EMA is commonly reserved only for shorter‐term periods. For example, many traders use three moving averages on their daily charts: a short‐term 20‐day EMA, an intermediate‐term 50‐day SMA, and a longer‐term 200‐day SMA.
In general, short‐term traders are more likely to employ EMAs, but position traders are more inclined to use SMAs. The EMA is usually closer to the current closing price, which tends to make it change direction faster than the SMA. As a result, an EMA is likely to be quicker in signaling short‐term trend changes. One of the most common EMA durations is the 20‐period. This is a popular moving average on daily charts.
An unfortunate result of the method of calculating an SMA is that every time you add a price, another price falls off the back end of the equation. In other words, each new SMA data point is affected by two prices, the most recent closing price and the oldest closing price in the calculation. Ideally, you want the most recent data to have a greater influence on your indicators than the older data. But with an SMA, the oldest price affects the newest SMA point with the same weight as the newest price.
EMA calculations eliminate that concern. Each data point affects the EMA only once. You never have to drop the oldest price as a new price is added. For that reason, the EMA has a much longer memory than the SMA. Every price ever used in calculating the EMA has some small effect. As an added benefit, EMA calculations place additional weight on the most recent price.
Traders use moving averages to better visualize the trend of a stock and to trigger buy and sell signals. In general, when a moving average slopes upward, you can infer that the trend is up, and when the moving average slopes downward, the trend is down. When prices cross over the chart’s moving averages, signals are generated and trends are likely to change.
One simple mechanical strategy that some traders employ works like this:
Figure 11‐3 shows an example of this simple mechanical strategy on a chart of the SPDR S&P 500 ETF (SPY), an exchange‐traded fund (ETF) that mirrors the S&P 500 Index. The chart is shown with a 50‐period SMA.
After bottoming in early June, SPY began climbing to the upside. Using the trading rules of this simple mechanical strategy, the first buy signal occurred shortly after in late July, when the stock closed above its SMA as the moving average turned higher. Notice that SPY traded above its 50‐period SMA until late October, when it closed below its moving average. According to our simple mechanical strategy, this generated a sell signal for the position.
As it turns out, this sell signal indicated the beginning of a relatively brief retracement (see Chapter 10). Notice that the SMA rolled over and began to slope downward during the pullback. However, on the final trading day of the year, December 31, SPY closed well above its 50‐period SMA just as the moving average was beginning to reverse its downtrend. This signals a buy according to the simple mechanical system and ultimately marked the start of a strong uptrend for multiple months. Notice that the price of SPY seemed to bounce off of its 50‐period SMA multiple times during the course of that uptrend.
We normally want some sort of confirmation signal before entering or exiting any position in a stock or ETF. For example, we may temper the buy signal in the simple mechanical strategy described earlier with a requirement that the stock price remain above its SMA for several days after the initial signal before entering a position. The same is true for the sell, or close, signal. You want the stock to close below the SMA for several days, or you’d like to see another coincident sell signal — perhaps one of the visual patterns we discuss in Chapter 10 — before exiting your position. We use a long‐period SMA to provide one of several signals to exit from existing positions. For example, if the price closes below a relatively long‐term moving average and remains below it for a couple of days, we use that signal to exit our position.
In addition to their trend‐following abilities, moving averages also tend to provide support and resistance in stock prices that are trending up or down. When a price is trending higher, you often see the stock bounce off its moving average during its inevitable pullbacks, only to reverse course and head higher. The same is true in reverse for stock prices that are trending lower. You often see a downtrending stock rally up toward its moving average and seemingly bounce off that price before heading lower. The moving average acts as an area of resistance.
Back in Figure 11‐3, the uptrending SPY approached its 50‐period moving average in mid‐December (2012), early 2013, late February 2013, and mid‐April 2013. In each small retracement within the broader uptrend, SPY pulled back very close to its moving average before recovering back to the upside. Short‐term traders use these opportunities to enter positions in the direction of the dominant trend. When moving averages show a stock trending higher by sloping upward, for example, short‐term traders buy into a position when the stock price closes near or just below the moving average so they can ride the trend to sell at a higher price later on. Position traders also can use these signals as second‐chance entry points, whenever they miss the first breakout. This strategy is called buying on a pullback.
Perhaps the most difficult decision you have to make when creating a moving average is determining the length or period that best fits the situation. Regardless of whether you select an EMA or an SMA, shorter periods yield more signals, but a greater percentage of those signals are false. Longer moving average periods yield fewer signals, but a greater percentage of those signals are true. One hitch: Longer‐term moving averages react slower to new price changes, and thus the signals they generate take more time to appear and occur later than they do in shorter‐term moving averages.
To reiterate, we rarely use ultra short‐term moving averages to generate buy signals. Instead, we use a combination of short‐, intermediate‐, and long‐period moving averages to monitor the health of a trend on daily charts. Typically, we select a 20‐day EMA (for the short term), a 50‐day SMA (for the intermediate term), and a 200‐day SMA (for the long term). These can change, however, depending on the duration of the existing trend and prevailing economic conditions. If a trend has existed for a relatively long period of time, the 50‐day SMA can provide good signals as an exit indicator. However, if the economy appears to be nearing a peak, as described in Chapter 5, then we tend to tighten our exit procedures and look more toward the 20‐day EMA for indications of a trend change. See Chapter 13 for more on trading strategies and exit procedures.
The stochastic oscillator indicates momentum and is intended to help show buying and selling pressure. This indicator compares current closing prices with the recent range of high to low prices and displays the results on a chart. Stochastic oscillator values cycle, or oscillate, between 0 and 100 percent.
The typical stochastic oscillator is measured across a 14‐day period, but a different time frame can be specified. Here’s the calculation:
This calculation describes a fast stochastic. The names %K and %D, respectively, identify the stochastic oscillator and the signal line. We typically use a variation of this indicator that’s called a slow stochastic. The slow stochastic oscillator calculation is
In effect, the slow stochastic uses the %D value from the fast stochastic calculation as its starting point. While the fast and slow stochastics look similar when plotted on a chart, the slow stochastic is smoother and less jumpy. It generates fewer and more reliable trading signals, but the signals appear more slowly than with the fast stochastic. Note: Some charting platforms permit you to specify different values for the moving average period, and some even permit you to change from an SMA to an EMA.
As we mention earlier, the stochastic oscillator cycles between 0 and 100 percent. Readings of more than 80 percent imply an overbought condition. Readings of less than 20 percent are interpreted as an oversold condition. As with most indicators, an overbought condition can be resolved if a stock trades lower or enters a period of consolidation. Similarly, an oversold condition can be resolved if a stock trades higher or enters a period of consolidation.
Overbought and oversold conditions can persist for extended periods of time, so when the indicator line crosses above the 80 percent threshold or below the 20 percent level, it’s not an immediate signal to sell or buy. Although this move should tell you to keep a close eye on things in case a sudden reversal is initiated, the real stochastic oscillator signals are generated in the following circumstances:
Figure 11‐4 shows a slow stochastic oscillator on a price chart for Alaska Air (ALK). Note the transitions from below to above 20 percent that occurred in June, September, and November 2016. All three represented good entry opportunities for this uptrend, particularly in June after the stock had remained below the 20 percent level for multiple weeks. Also, note that few of the indicator’s sell signals, where the stochastic oscillator crosses below 80 percent, represented good selling or shorting opportunities while Alaska was trending higher. (Note: Figure 11‐4 shows a slow stochastic oscillator with the parameters 14, 3 positioned below the chart.)
Some traders use a stochastic oscillator crossover strategy, where buy signals are triggered when %K crosses above %D, and sell signals are triggered when %K crosses below %D. For our style of trading, that generates too many signals, a very high percentage of which are false, as you can see in Figure 11‐4.
The stochastic oscillator also works well in trading‐range situations. Many short‐term traders use it to trigger buy and sell signals when a stock is in a trading range.
The moving average convergence divergence (MACD) indicator is one of the most popular trend‐following momentum indicators. The MACD is designed to generate trend‐following trading signals based on moving‐average crossovers while overcoming problems associated with many other trend‐following indicators. The MACD also acts as a momentum oscillator, showing when a trend is gaining strength or losing momentum as it cycles above and below a center zero line. The MACD is an excellent indicator and an integral part of our trading tool set.
As with other technical indicators, today’s charting software calculates the MACD for you. Still, knowing how this indicator is created helps you gain a better understanding of how it works. Based on just three moving averages of different periods, the MACD isn’t complex to calculate. Here are the steps:
An additional indicator, the MACD histogram, is often shown as part of the MACD. It uses a histogram to show the difference between the MACD line and the signal line:
Figure 11‐5 shows a daily chart of Bank of America (BAC) along with the MACD indicator (including the MACD histogram), shown below the primary price chart.
BAC traded sideways for the first few months of 2016, consolidating within a trading range. In early July, the stock began to rally to the upside. It continued its bullish climb throughout the last half of the year, turning on the jets in November and rocketing up in the last few months of 2016. Notice the corresponding periods on the MACD. The MACD line (the solid line) crosses over the zero center line in mid‐July, just after the stock begins what would eventually become a strong uptrend. This was a buy signal for this stock. You may also notice that the MACD line crossed the signal line earlier in the month at the start of July. This MACD crossover signal is another early indication suggesting a possible new uptrend. See Chapter 13 for more about how we use this signal.
The MACD provides a remarkable amount of information in a concise format. As you can see in Figure 11‐5, the MACD oscillates above and below a center zero line and serves as a good indicator for showing the direction of the dominant trend. It signals
Some short‐term traders use the signal line to trigger
In our own trading, we find that the short‐term signal line crossover technique generates too many false signals to be a reliable tool. Instead, we prefer using the position of the MACD line relative to the zero line as an indication that the stock has begun trending.
Figure 11‐6 shows a chart of daily prices for QQQ, an exchange‐traded fund that tracks the NASDAQ Index.
Notice how QQQ establishes a series of higher highs and higher lows beginning in late June, but the MACD line establishes a series of lower highs between early August and the start of November. This creates what’s known as a divergence pattern. This particular example of a divergence pattern is a bearish or negative divergence. In a bearish divergence, the stock establishes a series of higher highs and higher lows in an uptrend, but the MACD establishes a series of lower highs and shows a downtrend. A bullish divergence is the reverse: The stock establishes a series of lower highs and lower lows, while the MACD establishes a series of higher highs and shows an uptrend.
The bearish divergence on QQQ in Figure 11‐6 is best interpreted as a sign that the momentum of the strong July rally was slowing. The slope of the fund’s uptrend during that month was remarkably strong, which simply can’t continue forever. As the stock entered a new month, the uptrend continued, but not at such a steep slope. This allowed the moving averages used in the calculation of the MACD to converge, resulting in a negative divergence.
Each time the MACD line crosses above or below the signal line, it suggests a potential change in the direction of the dominant trend. Although it’s not an outright buy signal or sell signal, it does suggest that a change may be in the wind. In the case of a bearish divergence, the best way to utilize that information is to monitor individual stocks and ETFs for weakness and either close long positions when they deteriorate or initiate new short positions as they present themselves. In Chapter 13, we provide additional ideas to help integrate the information generated by the MACD indicator into a useful trading strategy.
Relative strength measures the performance of one security — a stock, ETF, index fund, and so on — against another, or against the performance of a benchmark index such as the S&P 500. The idea is to determine how the stock is performing compared with, for example, the broader total market. By focusing your attention on the strongest stocks or funds that are outperforming the rest of the pack, you increase your probability of successful, profitable results.
There are multiple ways to calculate relative strength, but one of the simplest and most effective is to simply divide the stock price by the index value and plot the result, like this:
Another technique compares the price of the stock during a given period of time against the index during the same period. Our preference is comparing percentage changes during the same period. The calculation looks like this:
You can plot both of these approaches on a stock chart. Some online resources provide powerful relative strength tools that allow you to visualize the performance of one stock or fund against another security. The PerfCharts tool at StockCharts.com, for example, allows you to simultaneously chart the performance of multiple stocks or ETFs within a group to see how they perform against a benchmark (typically the S&P 500). See www.stockcharts.com/charts/performance
for an example.
Relative strength is one of the final pieces of the technical‐analysis puzzle. The strongest trading candidates fit the following criteria:
These characteristics favor a long position, of course. For short position candidates, the criteria are reversed.