Moving average (how to calculate)

  • Thread starter Thread starter Michel
  • Start date Start date
M

Michel

Hello,

I need to calculate moving averages of weekly data during the last
year.
After some search, I believe that the best approach will be to get a
dataset from the SQL Server database, browse the records and, using an
algorithm, calculate the moving average.

There is an article on the "Code Project" website entitled "A Simple
Moving Average Algorithm" but honnestly I have been unable to
implement the solution.

Any tip, pseudo code or existing algorithm will be most welcome,

Thanks for your help,

Michel
 
Hello,

I need to calculate moving averages of weekly data during the last
year.
After some search, I believe that the best approach will be to get a
dataset from the SQL Server database, browse the records and, using an
algorithm, calculate the moving average.

There is an article on the "Code Project" website entitled "A Simple
Moving Average Algorithm" but honnestly I have been unable to
implement the solution.

Any tip, pseudo code or existing algorithm will be most welcome,

Thanks for your help,

Michel

There is a great article on Wikipedia that includes some pseudo code:
http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

This article also explains pros and cons of different methods.

If you need some example code let me know. I have some in C
(not .Net).

HTH

Jeremy.
 
Back
Top