Moving average (how to calculate)

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
 
J

JDS

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top