|
This script will download past 60 days historical data from Yahoo Finance, then calculate the Exponential Moving Average (EMA) base on your input, options given are 12-days, 26-days and 50-days EMA.
It will then check if the stock price moves above or below the EMA. Cells mark as ‘Red’ indicate Bearish, which means stock price moves below the EMA. Cells mark as ‘Green’ indicate Bullish, which means stock price moves above the EMA.
Exponential Moving Average (EMA) is similar to Simple Moving Average (SMA), except that there are more weight is given to the latest data.
Simple Moving Average is the average of the stock closing price for certain number of day in the past (depends on the number of days you analyze), for example if you want to calculate the last 13 days simple moving average, the you just need to add the last 13 days closing price and divide the number by 13.
Exponential Moving Average is slightly complicated, it weights the most recent data more heavily. The formula to weight the current trading day’s value is 2/(n+1), where ‘n’ is the number of day of the moving average. The result will then be added to the previous day EMA.
Login or Register to download this Excel Spreadsheet

The formula to calculate EMA
EMA = (S * (C-P)) + P
S = Smoothing Constant C = Current Closing Price P = Previous Closing Price
Formula for Smoothing Constant is:
S = 2/(1+N)
N = Number of days for EMA
Trading signals
The most simple trading are given when EMA crossover stock price. When EMA crossed stock price from top, it gives a bearish signal, on the other hand, when EMA crossed stock price from bottom, it gives a bullish signal.
Some other traders may look for crossover of long term and short EMA for trading signal, eg: when a short term EMA (12 or 26-days) crossover a long term EMA (50 or 200 days) from the top, it gives a sell signal and vice-versa.
We strongly recommend you to combine EMA with other indicators as a confirmation to buy or sale.
|