indicator: moving average

In technical analysis, traders use various indicators to help make buy and sell decisions. One such indicator is the Moving Average (MA), which smooths out daily price movements by creating a constantly updated average price.

It reflects the belief of every trader in the market about the average price of a security over a specific period and tries to figure out the trend direction. From more technical perspective it helps to identify support and resistance levels.

Simple Moving Average (SMA) #

SMA is calculated by taking the arithmetic mean of a given set of values over a specified period. The formula for calculating the SMA is:

$$ SMA = \frac{P_1 + P_2 + … + P_n}{n} $$

Weighted Moving Average (WMA) #

WMA assigns more weight to recent prices. The formula for calculating the WMA is:

$$ WMA = \frac{P_1 \times w_1 + P_2 \times w_2 + … + P_n \times w_n}{w_1 + w_2 + … + w_n} $$

Exponential Moving Average (EMA) #

EMA gives more weight to recent prices in an attempt to make them more responsive to new information. The formula for calculating the EMA is:

$$ EMA_{today} = (V_{today} \times \frac{s}{1+d}) + (EMA_{yesterday} \times (1 - \frac{s}{1+d})) $$

  • s = Smoothing factor, typically set to 2
  • d = Selected time period

and the $\frac{s}{1+d}$ is also known as the smoothing factor.