Capitalmind
Capitalmind
Actionable insights on equities, fixed-income, macros and personal finance Start 14-Days Free Trial
Actionable investing insights Get Free Trial
Foundations

Learn TA: Moving Averages

Share:

In the first chapter on Technical Analysis we talked about the basics of charting and support/resistance. We know now that support is a congestion area where buying is expected and resistance is one where selling is expected.

[level-capmind-pro]

While we understand how to look at charts, we need to anchor those charts to support and resistance points. One simple way to check out support is to see the last major low. Another is to use a moving average line. Let’s look at MA’s in some detail.

What are Moving Averages?

A moving average help us smoothen daily price changes to give us a picture of a trend and context. Mathematically a simple moving average is the average of the last “n” days; so a 200 day moving average is the average of closing prices of the last 200 days.

Why is it “moving“? Every day the average changes, because it looks at the past 200 days; in effect, as a new price comes in, the oldest price (201 days ago) is moved off the calculation.

Why “200“? The number of periods in a moving average depends on the timeframe you want to look at. 200 days is considered a reasonable indicator of a long term trend; 50 days medium term and 20 days, short term.

We use “days” for periods. If you’re looking at an hourly chart, the 200 period moving average will encapsulate 200 hours. There are about 7 hours in a trading day, so 200 hours goes to about 30 days, which is about 1.5 months. In an hourly chart you might want to consider one month instead – 22 days – which would translate to a 150 SMA. Similarly a weekly chart would probably use a 26 SMA. So when you change time frames of a chart you change your reference moving average.

How do you plot them?

Most stock charting web sites give you this ability. To get a desktop too, I would suggest you use ChartNexus (Free). Or, you can get data in:

  • Yahoo Finance. Choose an Indian stock (ends with .NS or .BO) and choose Technical Indicators and then, Simple Moving Average.
  • NSE India’s charting site (Choose “Add Indicator”)
  • Google Finance (Choose “Technicals” and add an SMA)
  • ChartInk.com (Choose a chart and add a moving average in the panel on the top left)
  • iCharts.in (Add an EMA in the drop downs at the bottom)

Other than ChartNexus you can get intraday data as well, some at a price.

SMA as a Trend Indicator

Moving Averages are a lagging trend indicator; that is, they tell you about a trend after the trend has begun; as prices move up, the higher prices bump the average only after the older, lower prices fall off.

The lag tends to be large, because the trend is already established by the time the moving average reacts.

Going Exponential

One way to reduce this lag on the trend is to give more recent prices a higher weightage in the calculation — enter the “Exponential Moving Average” (EMA).

The calculation of a 50 day EMA is:

  • Get the data for the last 500 days (say).
  • For the first 50 days, calculate the Simple Moving Average (SMA). Your first data pointEMA(1) is the 50 day SMA.
  • Your second data point will have to use the 51st day price. You will weight it, by using a weight = 2/(Periods+1) = 2 / (50+1) = 0.039. (nearly 4%)
  • So 0.039 is the weight of the 51st day Price. The remaining weight = 1-0.039 =  (0.961) is given to the previous days EMA.
  • The formula is: EMA(2) = 0.039 x Price(51st day) + 0.961 x EMA(1).
  • EMA(3) = 0.039 x Price(52nd Day) + 0.961 x EMA(1)

That’s the mathematical piece. The calculation will overall weight nearer dates higher.

Weighted MAs

Another set of traders believe that prices with heavy volumes are more important because they give a better idea of crowd sentiment; they would look at a Volume Weighted Moving Average (WMA).

This involves taking each day’s price and multiplying with the volume (number of shares traded). Then you add up all the 200 days numbers and divide by the sum of all shares traded in the entire 200 days to get the 200-WMA.

Trading with the MA

Moving averages or MAs give you the current trend of a stock. One way to trade is to consider it the start of an uptrend if the stock moves from below to above a key moving average and a downtrend if it moves from above to below. Let’s take a 20 EMA:

Learn TA: Moving Averages

If you’d just followed this you can see you would have made serious money in the last six months. The first trade, a short from 960 to 748 alone would have earned more than 20%! The losses are small, and quick, and the stock is seriously trendy.

But this strategy can lead to serious whipsaws, if a stock hangs out very close to the 20 EMA. A “rangebound” stock tends to do that.

Learn TA: Moving Averages

ITC is very rangebound and doesn’t trend much – so the losses you make in the whipsaws are too much compared to what you might see in a single trending move.

Since the Moving Average is essentially a smoothener, we might want to use a crossover of a short term moving average and a long term moving average to identify entries. In fact, the 50-DMA/200-DMA cross is considered a “Golden” Cross, an indicator that price trends have finally changed.

Learn TA: Moving Averages

Why do trends matter? Because when prices go up in a trend they tend to keep going up. An active investor would be wise to trade in the direction of the trend — that is, buy when the markets are in an uptrend and ignore (or go short) when they aren’t.

Moving Averages are usable with any stock or commodity with reasonable volume. When you look at prices, it doesn’t matter if you’re working with a Reliance or with Silver futures; the concept is the same.

Adjusting for Splits and Bonuses

What happens when a company splits shares or issues a bonus? If you trust Google Finance the Moving Average will look like this:

Learn TA: Moving Averages

(This is Kaveri Seeds, that split shares five ways in Jan – so you got a five shares for every share you owned)

However this is just wrong. Take a simpler example of a share priced at Rs. 600 that split two ways. I now have two shares at Rs. 300 each. This should not show a dip in my moving average!

But how does the data look?

Yesterday: Rs. 600

Today: Rs. 300

A calculation engine will obviously get
confused as the math formula will give the wrong results.

To adjust for such a split, you will have to reduce the earlier prices by 2. So the graphs will look cleaner and the moving averages will be correct. More complex are splits or bonuses like 1:2 – where you get one share if you held two shares earlier. There, earlier prices must be adjusted by 0.67.

Using technicals means the data is sacrosanct. And that’s why it needs to be as clean as possible! (Which is why when sites don’t adjust data, you can’t trust their EMA calculations)

In many cases you may need to adjust for dividends as well. Coal India announced a massive 10% dividend in January 2014. The stock fell 10%, but in reality it wasn’t a fall because stock holders got the dividend as cash. We should then adjust earlier prices for that as well? A moving average strategy on such a stock without adjustment will give you wrong results.

Tips and Tricks

The CAPM MA20 indicator is based on the number of Nifty stocks above their own 20 Day Moving Averages. This is an aggregate indicator we plot that uses individual stock moving averages and tells us if we’re rising in terms of breadth, that is, stocks are largely above or largely below their MAs. It has been remarkably successful in providing an advance view into a change in trend.

Trading MA crossovers can be profitable if you have the temperament. But you must learn to recognise trending stocks or markets, and take the losses in the whipsaws. And you shouldn’t override the system – you have to take every signal.

We can backtest MA based strategies since this is simply a formula for investment. We’ll cover this in the “backtesting” chapter later. But backtesting allows us to understand if our theory of a “trending stock” applies to the stocks we choose, or are we just imagining it?

Going very long term — 1000 day MA, for instance — are counterproductive. By the time it’s indicated a trend, the trend is probably over. On the other hand, doing a 2 day moving average is useless — two days isn’t much in terms of “smoothing”.

Moving averages alone are lagging indicators of trend, but not of momentum. You can choose them as a good filter to indicate strong moves. But to trade, for instance, options, they may not be enough. Option trading requires both trend and momentum, and we’ll study momentum indicators in a later chapter.

A moving average creates a natural stop loss for a trade. However we would usually place stops a little below the moving average to avoid the whipsaw of a single touch and then retrace. (This can also be back-tested)

We’ll try to use the EMA where we can, but for the most part an SMA should suffice. It makes it easier for those of you who want to use Excel instead of these online tools.

Capital Mind Premium is building an online tool that will have adjusted data (for splits, bonuses etc.) which will allow you to plot stock, currency, and macroeconomic data with moving averages appropriately calculated. We’ve been delayed but we’ll get there soon! Free for all premium users, of course. Non premium users will see limited data.

Learn TA: Moving Averages

Disclaimer

Nothing in this newsletter is financial advice and should not be construed as such. Please do not take trading decisions based solely on the matter above; if you do, it is entirely at your own risk without any liability to Capital Mind. This is educational or informational matter only, and is provided as an opinion.

Disclosure: The authors at Capital Mind have positions in the market and some of them may support or contradict the material given above, or may involve a direction derived from independent analysis.

Footer

[/level-capmind-pro]

Share:

Like our content? Join Capitalmind Premium.

  • Equity, fixed income, macro and personal finance research
  • Model equity and fixed-income portfolios
  • Exclusive apps, tutorials, and member community
Subscribe Now Or start with a free-trial