+ Reply to Thread
Results 1 to 3 of 3

Weighted Moving Average

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    Edmonton
    Posts
    20

    Weighted Moving Average

    I am trying to produce a weighted moving average on closing stock prices. Their is only one column of data which contains the closing price. I want to have a 7 period weighted moving average of the price. Currently I have to write the following formula:

    ((7*P1)+(6*P2)+(5*P3)+(4*P4)+(3*P5)+(2*P6)+P7)/28

    - where P7 is the price 7 periods ago, P6 is the price 6 periods ago...and so on.

    The problem is if I want to look at a 3 period or 21 period weighted moving average I have to re-write the entire formula. Instead I am trying to find a formula that would look at a cell for the number of periods weighted moving average that I want and produce my results.

    Is this possible?

    Thanks
    Last edited by steven723; 11-07-2008 at 05:15 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Hello steven

    If you have the number of periods in Q1 try this formula

    =SUMPRODUCT(OFFSET(P1,,,Q1,1),Q1-ROW(INDIRECT("1:"&Q1))+1)/(Q1*(Q1+1)/2)

  3. #3
    Registered User
    Join Date
    11-02-2010
    Location
    Cirencester, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Weighted Moving Average

    This is a brilliant formula Daddy Long Legs. How do I adjust it to calc. WMA in the other direction as my data is going from newest to oldest not oldest to newest.

    Thank you.
    Last edited by hazza147; 02-10-2014 at 09:55 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1