Sunday, November 25, 2007

Moving Averages:Meaning &Calculation

Moving Averages

Moving averages are one of the most popular and easy to use tools available to the technical analyst.A moving average series can be calculated for any time/data series.

In finance, it is most often applied to stock prices, returns or trading volumes. Moving averages are used to smooth out short-term fluctuations, thus highlighting longer-term trends or cycles.

Moving averages work best when a security is trending and are ineffective when a security moves in a trading range.

The two most popular types of moving averages are the Simple Moving Average (SMA) and the Exponential Moving Average (EMA).

Simple Moving Average (SMA)
A simple moving average is formed by computing the average (mean) price of a security over a specified number of periods.

The formula for a 10-day simple moving average of closing price is:
SMA = pM + pM-1 +pM-2 + ...+ pM-9/ 10

All moving averages are lagging indicators and will always be "behind" the price.

When prices are trending, moving averages work well. However, when prices are not trending, moving averages can give misleading signals.

If the price were rising, the SMA should be below the closing price to be considered bullish.

Exponential Moving Average (EMA)
In order to reduce the lag in simple moving averages, technicians often use exponential moving averages (also called exponentially weighted moving averages).

EMA's reduce the lag by applying more weight to recent prices relative to older prices. The weighting applied to the mostrecent price depends on the specified period of the moving average.

The shorter the EMA's period, the more weight that will be applied to the most recent price.

The formula for an exponential moving average is:
EMA = price today * k + Ema(previous)* (1-k)
X(EMA) = (K x (C - P)) + P

The simple moving average obviously has a lag, but the exponential moving average may be prone to quicker breaks.

Some investors prefer simple moving averages over long time periods to identify long-term trend changes.

Some traders prefer to use exponential moving averages for shorter time periods to capture changes quicker.

Simple moving averages work well for longer-term situations that do not require a lot of sensitivity.
Exponential moving averages are usually best for short-term situations that require a responsive moving average.

To calculate EMA,we have to first calculate the simple average...thats why i have to calculate SMA before EMA.

If you want a 10-day EMA,u have to calculate Simple Mov.Aver. for first 9 days i.e add up all closing prices and divide by 9.

From the 10th day the formula for EMA starts in..

EMA = price today * k + EMA yesterday's * (1-k)
K = 2/N+1
where N is number of periods/days in your ema

X(EMA) = (K x (C - P)) + P
X = Current EMA
C = Current Price
P = Previous period's EMA*
K = Smoothing constant
(*A SMA is used for first period's calculation)
K = 2/(1+N)
N = Number of periods/Days in your EMA

The result will the same,but i prefer the first one.

K = 2/(1+N)
5 EMA =2/5+1=0.33
10 EMA =2/10+1=0.18
25 EMA =2/25+1=0.076
50 EMA =2/50+1=0.039
100 EMA =2/100+1=0.0198
200 EMA =2/200+1=0.00995

so for EMA formula would be like this:
5 EMA =E6*0.33+G5*(1-0.33)
10 EMA =AB25*0.18+AC24*(1-0.18)
25 EMA =E26*0.076+I25*(1-0.076)
50 EMA =E51*0.039+K50*(1-0.039)
100 EMA =E101*0.0198+M100*(1-0.0198)
200 EMA =E201*0.00995+O200*(1-0.00995)

for eg for 50 day EMA is
EMA = price today * k + EMA yesterday's * (1-k) =E51*0.039+L50*(1-0.039) = 894.6377071
X(EMA) = (K x (C - P)) + P =0.039*(E51-L50)+L50 =894.6377071

To Calculate Moving Average in MS Excel:.
Column | Description | Formula to enter
A = Company Name/date
B = Open
C = High
D = Low
E = LTP/close
F = Volumes

G = 5SMA =SUM(E2:E6)/5 ,enter in row cell 6 ,copy formula till last price
H = 5EMA =SUM(E2:E5)/4 , enter in row cell 5, =E6*0.33+H5*(1-0.33) ,enter in row cell 6, copy this formula till last price.

I = 25SMA =SUM(E2:E26)/25 ,enter in row cell 26, copy formula till last price
J = 25EMA =SUM(E2:E25)/24, enter in row cell 25, =E26*0.076+J25*(1-0.076) , enter in row cell 26, copy this formula till last price.

K = 50SMA =SUM(E2:E51)/50, enter in row cell 51, copy formula till last price
L = 50EMA =SUM(E2:E50)/49, enter in row cell 50 =E51*0.039+L50*(1-0.039) enter in row cell 51, copy this formula till last price

M = 100SMA =SUM(E2:E101)/100, enter in row cell 101, copy formula till last price
N = 100EMA =SUM(E2:E100)/99, enter in row cell100, =E101*0.0198+N100*(1-0.0198) enter in row cell 101, copy this formula till last price

O = 200SMA =SUM(E2:E201)/200,enter in row cell 201,copy formula till last price
P = 200EMA =SUM(E2:E200)/199,enter in row cell200,=E201*0.00995+P200*(1-0.00995), enter in row cell 201,copy this formula till last price

1 comment:

vardaraj said...