I have a dataset that consists of the closing price and date for 10 years. I want to calculate the rolling 3-day volatility of returns data using Exponential Weighted Moving Average. Please mention how to approach this problem and if possible give the solution in excel. The data look like this:
Date ClosingPrice Logreturns Squaredlogretuns Weights
1-01-2000 50 - - -
2-01-2000 51 0.008600172 7.3963E-05 0.28
3-01-2000 52 0.008433168 7.11183E-05 0.2016
4-01-2000 52.5 0.00415596 1.7272E-05 0.145152
5-01-2000 53 0.004116566 1.69461E-05 0.10450944
6-01-2000 59 0.046576142 0.002169337 0.075246797
Weights * Squaredlog returns Volatility
2.07096E-05 -
1.43375E-05 -
2.50707E-06 -
1.77103E-06 0.006270979
0.000163236 0.013485222
In the above table, I took lambda (weights) =0.72 and used a formula to decrease the weights exponentially. Finally, I multiplied the weights with squared log returns.
I added up all the rows of (weightssquaredlogreturn) column to calculate the overall variance of the EWMA for this data but how to do it for a rolling 3 day period. Above I added up the last 3 rows of (weightsquaredlogreturns) column for each day to get the variance and took a square root of it to get the Standard Deviation or Volatility of rolling 3-day period.