Step 1 reads the data.
Step 2 creates the filtering weights. We used a window of seven periods. This means that the weighted average of the current value and six others will comprise the filtered value at the current position.
Step 3 computes the two-sided filter (the weighted average of the current value and three prior and three succeeding values) and a one-sided filter based on the current value and six prior ones.
Step 4 plots the original data and the symmetric and one-sided filters. We can see that the two-sided filter tracks the changes earlier.