2 mins read
Moving Average
Moving Average
A moving average is a type of smoothing average that calculates the average of a set of numbers by taking a weighted average of the previous n periods. The weight of each period decreases exponentially as it gets further from the current period.
Formula:
MA = (w1 * x1 + w2 * x2 + ... + wN * xN) / (w1 + w2 + ... + wN)
where:
- MA is the moving average
- w1, w2, …, wN are the weights of each period
- x1, x2, …, xN are the values of the previous periods
Types of Moving Averages:
- Simple Moving Average (SMA): Uses equal weights for all periods.
- Weighted Moving Average (WMA): Uses different weights for each period, based on their importance.
- Exponential Moving Average (EMA): Uses exponentially decreasing weights for each period.
Uses:
- Smoothing out fluctuations in a time series
- Identifying trend direction
- Predicting future values
- Detecting support and resistance levels
Advantages:
- Reduces noise and smooths out fluctuations
- Can reveal trends and patterns
- Can be used for forecasting
- Simple to calculate
Disadvantages:
- Can lag behind sudden changes
- Can be influenced by outliers
- Can be complex to interpret
- May not be appropriate for complex time series
Examples:
- Calculating the moving average of a stock price over the past 5 days.
- Calculating the moving average of a daily sales count for a product.
- Forecasting the future price of a stock using a moving average.
Additional Notes:
- The number of periods used in a moving average is called the window size.
- The weighting scheme used in a moving average can be customized based on the specific application.
- Moving averages can be used in conjunction with other technical analysis indicators.