Package Description
$ dotnet add package moving_averageThis project provides a simple implementation of a moving average calculation in C#. It allows you to add new values to a moving window and calculates the average of the values in the window. The oldest value is removed when the window size is exceeded.
// Create a new MovingAverage object with a window size of 3
MovingAverage ma = new MovingAverage(3);
// Add values
ma.Add(1.0);
ma.Add(2.0);
ma.Add(3.0);
// Get the average
double avg = ma.Average; // avg = 2.0
ma.Add(4.0);
avg = ma.Average; // avg = 3.0
// Clear the values
ma.Clear();