Linear Weighted Moving Average
A linear weighted moving average assigns more weight to the more recent prices. Generally, this is better for longer term moving averages because it allocates more weight to current prices at the expense of older prices. While weighting is not as significant for a 5 day moving average, there is a substantial difference in a longer period, such as a 50 day moving average.
In a Simple Moving Average, the price data have an equal weight in the computation of the average. Also, in a Simple Moving Average, the oldest price data are removed from the Moving Average as a new price is added to the computation.
The linear weighted moving average is more sensitive than the SMA. It reacts to current prices quicker, similar to how the Exponential Moving Average works.
Lets see how a Linear Weighted Moving Average is calculated:
LWMA = SUM (CLOSE (i) * i, N) / SUM (i, N)
Where:
SUM – sum;
CLOSE(i) – current closing price;
SUM (i, N) – total sum of weight coefficients;
N – smoothing period.
For the following example we will set the PERIOD equal to 4. We will assume the price of each day is a multiple of 10 of the day number for the price, thus, price 1 = 10, price 2 = 20, and so on.
To calculate a linear weighted moving average, multiply the oldest data point price by 1 and each following price by an increasing consecutive number up to the current price. Multiply by the number of days selected for the average, then add the factors and divide the sum by the total of all the weights used:
LWMA = (Price 1 * 1) + (Price 2 * 2) + (Price 3 * 3) + (Price 4 * 4) / 1 + 2 + 3 + 4
LWMA = (10 * 1) + (20 * 2) + (30 * 3) + (40 * 4) / 1 + 2 + 3 + 4
LWMA = (10 + 40 + 90 + 160) / 1 + 2 + 3 + 4
LWMA = 300 / 10 = 30
If we calculate the same four days as a simple moving average, we can see the difference:
SMA = (10 + 20 + 30 + 40) / 4
SMA = 100 / 4 = 25
Lets compare a SMA with a LWMA on a graph:

As we see, the LWMA is more reactive to trend changes than the SMA, which produces a graph similar to an EMA.









