Showing posts with label Technical Tutorials. Show all posts
Showing posts with label Technical Tutorials. Show all posts

September 30, 2012

MACD

MACD

Its been long time since I posted any tutorial. MACD (Moving Average Convergence-Divergence) post has been in work for past 2-3 weeks and other post took precedence due to very dynamic moves in the markets but I will feel guilty to delay it any further.

We have already seen Moving Averages which are trend following Indicators. We have seen RSI which is an Oscillator. Both have their own advantages and downside. MACD, to start with, you can say combines best of both Worlds. MACD takes two trend following Indicators (Moving Averages) and turns them into an Oscillator. MACD gives us valuable information about not only the trend but also the momentum (strength) in the direction of the change. Before deliberating further, let us see how MACD is defined and constructed.

MACD consists of three components usually defined as MACD (12, 26, 9) which is most popular combination. 12 and 26 here depicts that MACD is using Exponential Moving Average of 12 duration and 26 duration (Days, Weeks or Months) for calculating MACD Line. Third letter, 9 indicates Exponential Moving Average of MACD Line for 9 duration which is used as Signal Line. MACD Line is calculated as 12 EMA Value - 26 EMA Value and Signal Line is calculated as 9 EMA of MACD Line. Histogram that you see with MACD is the difference between MACD Line and Signal Line. The centerline around which MACD Line oscillates is also called as zero line. You can use other durations for constructing MACD depending on your time horizon and sensitivity requirements. Please see the MACD in the chart below to familiarize yourself with above terms.


Reading MACD

Let us now see how exactly we get information from MACD. As per above formula if 12 EMA (which is faster, more responsive) is higher than 26 EMA, the MACD Line is in positive territory. Positive value increases when 12 EMA is increasing at a faster speed with respect to 26 EMA which also indicates that the positive momentum is increasing. Similarly when negative value increases, it means that 12 EMA is lesser than 26 EMA and the difference is increasing indicating a stronger negative momentum. This is the most basic reading of MACD.

MACD Signals

Traders use MACD is varieties of ways to identify trading signals. Some of the popular MACD Signals are listed below;
  • Signal Line Crossovers
  • Centerline Crossovers
  • Divergence

I will make another post to explain each of the above strategy in details and with examples.

In a nutshell

MACD has the unique advantage of identifying trend as well as strength (momentum). Unlike RSI, MACD does not help in identifying overbought or oversold conditions and it does not have any upper or lower levels which limit its movement. Since MACD is a difference between two EMAs, its value depends on value of the underlying and it may totally differ for a stock worth 10 Rs or for NIFTY at 5700 level. Hence don't compare MACD of two different scripts or underlying with each other. Also, we can use different durations of EMA to change the sensitivity of MACD e.g. MACD (5, 31, 5) would be more sensitive than MACD (12, 26, 9). I prefer to go with the standard used format of (12, 26, 9). Never felt the need to try any other combo.

Now, after completing this post, I am feeling a lot better and lot lighter. Will quickly complete the follow-up post on MACD Signals with more graphs and little commentary to close this chapter. As usual, will lover to know what you think of the post so go on and let me know. Happy Trading.

August 21, 2012

RSI Demystified

Here I am... as promised. After the last post and the reference to RSI, it is but natural that I talk about RSI today. It was a close call as I also wanted to discuss few individual stocks which are getting interesting but then those have to wait for another time.

Some basics before we start; In technical analysis we have indicators and oscillators. Indicators are calculated based on the price, volume, momentum, volatility, etc. They give us additional information about the price and help us in technical analysis. Indicators which vary only in a range are called oscillators and Relative Strength Index (RSI) is one of them. It tells us about the strength or weakness in the trend of the security being analysed. It is calculated as;

RSI = 100 - 100 / (1 + RS)

Where RS = Average of x days' up closes / Average of x days' down closes

Usually RSI is calculated for a period of 14 days and it is the most popular duration. So for 14 days; RS = (Sum of Gains over last 14 days/14) / (Sum of Losses over last 14 days/14)

The formula above makes sure that RSI varies between 0 and 100. However, RSI does not practically go to 0 or 100 very often. We have seen RSI in many charts so I do not need to post one to explain more.

Most important use of RSI is to confirm the trend. If you think that the security is in an uptrend, be sure to confirm that RSI is above 50. Similarly RSI below 50 acts to help us confirm the downtrend for the security. However, main question is how do we use RSI for trading? There are various ways of doing so... some of them are;
  • Overbought / Oversold conditions
  • Divergences
  • Positive / Negative Reversals
  • Failure Swings
  • Trending IDs
What we generally use is the first two. Rest of them do not occur often and are not so easy to spot. Overbought condition was already (more or less) explained in last post. Only thing to add here is it is universally accepted that RSI above 70 is overbought condition and below 30 is oversold condition.

Next, Divergence is used to identify the impending reversal in the trend of the security being analyzed. It usually happens when security makes a higher high (or higher low) but RSI fails to follow through. This is called as Bearish (negative) divergence - First rectangle in the chart below. Vice versa situation where security seems bearish but RSI is going up gives Bullish (positive) divergence and it usually signals things are about to turn positive.



My apologies for not coming up with a better graph which will give a clearer picture but I believe this one will also give the basic idea. Will not be talking about the balance 3 ways to trade RSI but will surely visit them if situation calls for.

I am happy that I was able to follow up yesterday's come back post with this small tutorial kind of post and hope that you will enjoy reading it as much as I enjoyed writing it. RSI is probably one of the most popular oscillator and it will continue to be part of our future discourse so this surely is just the beginning of it. Will think about the third post tomorrow and decide whether to write another tutorial or post some stocks specific charts. If you have any ideas, I am all ears.

 Stay tuned for my (probably) first hat-trick tomorrow. Happy Trading.

July 13, 2012

Moving Averages - Final

Finally, final post is here. Moving Averages took longer then expected but I am happy that I did not rush it through and covered all that matters. I hope that you guys are also liking it (sadly your comments or lack of them don't show that) and would be ready for such details. So let us say adios to MAs with this post.

Support and Resistance

MAs also act as Supports in an uptrend and Resistance in a downtrend. As usual short duration MA (20d) acts as Support or Resistance for Short Term trend. Long Term MA like 200D, which is most popular and widely used, acts as Support or Resistance for Long Term trend.


The chart above shows the price taking support at 200 EMA on multiple occasions. After trying three times it finally breaks the support with huge volumes and very decisively on a freak fall day. Such is the strength of 200 MA Support or Resistance. It takes some doing to break it usually.

Let us also see a case where MA line is acting as Resistance. See below;


One thing which many people tend to forget is Market do not work on logic, they work on sentiment and so one should not take Support and Resistance levels from MA lines as rigid. They should think of MA value as a region when Support (uptrend) or Resistance (downtrend) will be present. Little bit of up and down should not be considered as violation of Support or Resistance.

Conclusion

We should remember that Moving Averages are;
1. Lagging Indicators: So you will get signals after prices have already changed
2. Are ineffective in a range bound market 
3. Will not help you buy at bottom and sell at top as they tend to be followers
4. Should not be used alone (in isolation) and they must be supported by other tools / indicators

As I have repeated many times that, with me, there always is a risk of being wrong. So while following this tutorial you are requested to verify its correctness independently... that pinch of salt and all that.

Hope you have enjoyed reading about MAs as much as I have enjoyed writing about them.

Today was a difficult call as I was thinking about doing a post on Infosys / TCS saga and analyse their results. But then I had promised in the last post about finishing MAs quickly and not keep you waiting. Since the childhood I have believed that 'Promise Breaker - Shoe Maker' and honestly I don't have any aptitude in shoe making and I will really be bad at that. So I spared myself and decided for MA. Do let me know what you think though.

July 11, 2012

Moving Averages - 5

Well, the final installment is here guys. Its been almost 3 weeks since we started discussing MAs and it is hard to let go now. But as some philosopher said... life has to go on. Don't be afraid guys, I am not going anywhere. It is just that going through my earlier posts I realized that the humor factor has been absent from my writing these last few months. Effect of the load at office may be. I had become very formal in my writing and it is time that we get that 'Ting' back. So lets start from where we had left in the last post i.e. ways to trade with MAs

Double / Triple Cross-overs

Similar to Price Cross-overs we discussed in the last post, Double Cross-over refers to the cross-over between two MA lines. One of longer duration and one of shorter (obviously, same duration lines cannot cross, no?). As with everything related to MAs, duration of MA lines defines the type of trend (Short term, Medium term or Long term). To cite an example, I would say the 5D and 20D Cross-over would give a short term trend signal. 20D and 50D may be useful for Medium term and 50D with 200D MA line can be used for Long term trend change signal.

A Bullish Cross-over is said to happen when lower duration MA crosses longer duration MA line from below and goes above it. It is also called as Golden Cross. Reverse is when lower duration MA line crossed longer duration MA line from above and it is called as Death Cross.

Again this system produces a lagging signal. Here we are using two MA lines (MA individually is a lagging indicator as we discussed earlier) hence this indicator is further laggard and gives a good signal when a strong and enduring trend change takes place. Otherwise we can get lot of false triggers.


In the above NIFTY chart you will see Medium Term trend changes indicated by 20D and 50D Death Cross and Golden Cross alternatively. You will also notice that these signals appear later as compared to changes in price. One will wonder, what is the use of MAs if they are so late. Actually MAs are used in multiple ways and change in slope of MA lines gives a pretty advance indication and then you also use other indicators/ oscillators in conjunction with MAs to arrive at a trading decision. We will discuss this in details at the right time.

See another chart;




What you see above is again NIFTY chart with longer duration MA line and as you see you are getting multiple false triggers here. How do we get past these? There are two ways. First, depending on the duration of the MA lines you can give some cooling period to Cross-over e.g. for 5D, 20D lines you may decide that you will wait for 3 days after the Cross-over to confirm it. Second, as I said earlier you can use other corroborating evidence. In this case specially, you can use MACD which turns positive during Golden Cross and negative in case of Death Cross. More on this at the right time.

When you use three MA lines with lower duration MA line crossing the other two it is called as Triple Cross-over.

I thought this will be last post in MA series but looks like I will have to come back with another one for last trading strategy as this post has gone longer than I anticipated. Next trading strategy may also stretch like this so I will not take risk to start it here. Apologies guys but you will not have to wait for long, promise. Happy trading.

July 08, 2012

Moving Averages - 4

I am back with the next post in MA series. We have already seen what MAs are, types of MAs, what are the popular durations and their significance. What remains to be seen as how do we find trading signals using MAs. So lets get on with that.

There are various ways to use MAs (Simple as well as Exponential) for trading purpose. We will list them down and elaborate one by one.

1. Trend Identification
2. Price Cross-overs
3. Double/ Triple Cross-overs
4. Support and Resistance

One common thing here is that shorter the duration of MA the more volatility you will see in each of the above signals. Also short term MAs are useful for short term trends. Longer the duration, more reliable signals and they will indicates long term trends. Here MA indicates both Simple as well as Exponential MA and as I said in the last post it depends on your own comfort level. You can use anyone.

Trend Identification

The direction of the MA indicates general movement in prices. A rising MA indicates increasing price and a falling MA denotes generally decreasing price. This works well in case of medium to long duration MAs and in case of lower duration (5d, 10d) you may see too many direction changes. See the chart below;


You will see so many direction changes in 20 EMA while hardly any movement in 200 EMA. So for a short term duration, change in the direction of MA can give some signal but you need to choose duration well. A change in the direction of long duration MA signals a change in long term trend.

Here one thing to remember is MAs are lagging indicators so they will give signals when Price has already made the move and not beforehand. On a very short term basis this increases the chances of false triggers.

Price Cross-overs

MAs are used for trading signals by using Price Cross-overs where prices move above or below the MA line. So when price moves above a MA line or crosses it from below, it generates a bullish signal. Reverse is true for bearish signal when prices crosses MA line from top and goes below it.


One thing to remember here is you use this signal when long term trend is also in the direction of your trade. To cite an example, if price crosses 50 EMA from below and goes above it you would want to trade bullish but make sure that price is also above larger MA (100 or 200) in such case. Rational is that the long term trend is intact (bullish) and price came below 50 EMA as part of normal pull back and will continue to go up.

See the INFOSYS chart above where price continues to be above 200 EMA but crosses over 50 EMA few times without violating the long term trend. Gives good short to medium term gains.

Will write the final (5th) post in MA series soon. Before I sign off, have two things to share.

First, my project is officially over and I was partying in Lonavala this weekend with the office group. That place can beat any holiday destination in monsoon. Simply awesome. Enjoyed fully and hence could not write more. Second thing, one of the reader of the blog, 'Legend' send me all the posts of the blog compiled in a word file and it was very satisfying to go through everything I have written over last one year or so. Deepest thanks to Legend.

Will be back soon. Comments, as usual, will act as catalyst.

June 27, 2012

Moving Averages - 3

I am back. Did not think that I will be able to write again before weekend but God has been kind. So without wasting your time, will continue our Moving Averages tutorial.

In the first two parts we have seen what are MAs and popular types among them. I will resist the urge to get in to other types of MAs as honestly that will just be a general knowledge without any practical use for trading. So as discussed, we will see which duration we should use, which type and why?

Duration:

Most simply put, duration depends on what kind of view you need about the direction of the market. In other terms, if you are looking at short term trend or you are a trader you will use MAs of lowest duration like 5 day, 10 day or 20 day. If you have a horizon of medium terms (few months) you will be more interested in 50 day kind of MA and if you are a long term investor, your choice would be like 100 day or 200 day MA.

200 day EMA is probably the most popular among all. It is a very long duration MA and usually a strong and reliable indicator of trend, change in trend. It also usually is a strong support or resistance. Medium term investor prefer 50 day MA and short term trader 5 or 10 day duration.

Short duration MAs are very agile and they adapt to price very fast. You will see a change in them even with a single day large move. Long term duration MAs are lethargic. They tend to be very smooth and usually do not get affected by short term volatility. See the self explanatory chart.


Type:

Another normal dilemma is which type of MA to use. Simple MA (SMA or DMA) or Exponential (EMA)?

To be fair, none is better than the other. EMAs give more weight-age to recent prices hence quicker to react. SMAs are simple and represent true average of period under consideration. Usually SMAs are more reliable while indicating Supports and Resistance Levels and EMAs give an early indication of change in Trend.


As you can see in above chart, 50 EMA straightens out before 50 SMA as shown in first oval. At second instance also, 50 EMA starts to drop before 50 SMA.

Here I would like to make one thing clear that one should try various duration, types of MAs depending on one's objective, time horizon, investing style and comfort level. As I have mentioned in some earlier post that I am more comfortable with EMAs, similarly you should find out your own preference.

This now leaves one last post (I am not sure if I will be able to cover everything in one post) about how to trade using MAs. I will write more than one post if it becomes too long to cover all of it in one go. Just wishing that I get the time to do so quickly.

Keep the comments flowing.

June 24, 2012

Moving Averages - 2

Lets continue our Moving forward journey. I will now site examples from the market and related fields only to make it clear.

Simple Moving Average

It is as simple as it sounds. In case of NIFTY, you take the closing values of last as many days as you are interested in, add them up and divide the total by no of days. Simple? No. Simple Moving Average.
So if you take NIFTY closing of last 5 days;
5 day Simple Moving Average value would be - 5119.94. You can do it yourself. SMA is sometimes also called as DMA where D stands for days. So 5 DMA means 5 days Simple Moving Average.

Weighted Moving Average

A small discussion about Weighted MA will help us understand Exponential MAs better so here it is. In a data which runs for many months and years sometimes it is not very difficult to consider that as the reading gets older and older its importance for the present data goes on decreasing. In other terms; NIFTY closing value of 3 months back can have much less bearing on current level tomorrow when you compare with the last closing of NIFTY.

If it fits in to judgement that the more latest value the higher relevance it would have on the future value then you need to factor this in the MA calculation. This is where the Weighted Moving Average makes the entry. In WMA, the recent entries are multiplied by a factor which goes on reducing for the earlier readings and goes to 1 at the last reading. IN more simple example, for 5 day WMA you would multiply latest reading by 5, next reading by 4 then by 3 and so on. Finally you will add up everything and divide the total by 5+4+3+2+1 (total of multiplication factors). It gives you WMA. Using this method, WMA in above example it would be - 5134.92.

Exponential Moving Average

As if the WMA was not sufficient, some genius came up with the idea that the Weight of each reading should not decrease linearly. He/She thought that the latest readings should carry higher weight and it should drop faster as you go towards earlier readings. Enter the Exponential MA. So in case of EMAs the weight factor drops faster as readings grow older. Graph will give you some idea; 
It may be difficult to calculate EMA so easily but every charting tool gives you this functionality so you don't really have to get on calculator or excel to find out EMA.

Now the real question is, which one you should use and for which duration. Also how does it helps us in trading. There you go, I have my next two posts lined up here. We will see which one to use, which duration, and why in next post and then we will see how to use MAs for trading in the post after that. Let me know if you are liking it.

Moving Averages

I am back with another tutorial. Actually I thought of writing some trading post but then with the kind of comments I am getting, I guess you guys are looking forward to more tutorials. I still could have gone for some trading post but then anything can happen in Europe even on Sunday and it can make my post look stupid. So I decided to wait as anyways I am not sure if I can find some worthwhile trade in the present condition.

As I had said, I will start with Moving Averages as they are by far the most commonly used Technical Indicators.

We all understand what does Average mean? It is simply the mean value of a given set of data. Mathematically you add up all values/quantities and then divide the total with no (count) of values/quantities. It is clear to most of us till this point. So what then does a Moving Average (MA) mean? Well, when you have a long set of data and you make a subset of this data and calculate its Average on continuous basis, it is called as Moving or Rolling Average.

Let us say that I start noting the time taken to reach office everyday. I calculate the monthly average when I have 30 readings (I have really been going to office almost everyday these past 30 days). It will be Average time taken to reach office. Now when I have 31st reading, I can calculate Average time to office for last 31 days or I can still calculate the 30 day average but this time I will drop the very first reading and include 31st reading in the data. Similarly on 32nd day, I will drop first and second reading and include 31st and 32nd reading. So I will always be calculating Average time taken to reach office for last 30 days. Everyday I will add the new reading and take 30 readings backwards from that day and exclude all earlier readings. Bingo... it is 30 day Moving Average. The MA value keeps changing (moving) with the time and it gives my Average for last 30 days all the time.

This makes sense because for many markets we have data from 1960s or 1970s. If we take Average of this data for such long duration, it does not help much. Hence we take Moving Average of different duration like 5 days, 10 days, 20/21 days, 50/100/200 days depending on how much short term or long term we want to look at. We will see the significance of these duration as we go along. For the time being, I hope I have made it simple enough to understand.

Then lets get confused now. Market Pundits did not stop at creating MAs and live happily thereafter. They added further spice in it by creating variations of these MAs. There are many but the ones you can actually hear some place are;
  • Simple Moving Averages (SMA)
  • Exponential Moving Averages (EMA)
  • Cumulative Moving Averages
  • Weighted Moving Averages
  • Wilder Moving Averages
We will be talking about only the first two of the lot. These are the ones that you will actually come across and use for trading.

Right now I am way past my Average sleeping time. I have not crossed it if I take Moving Average of last 30 days though. Will write next one quicker than you think.