Weighted & Hull Moving Average

rush1884

New Member
Joined
Feb 20, 2016
Messages
5
I am desperately looking for some help in calculating 2000, 500, and 100 period hull moving average on a big dataset. I understand to do this I would need to first calculate the weighted moving average of each of these periods also (but I am unsure how to do this without having to type in an extremely long formula (especially for the 2000 period weighted average as every data point would have a different moving average).

The dataset is the Dow Jones Industrial Average Daily Price from 1900 to present. Therefore a 2000 weighted and hull moving average would start on the 2000th trading day in the data and any formula would easily be able to be dragged down to the rest of the data set.

Any help would be great, I was looking to attach the dataset and columns I am trying to work out to the post but it appears that is not allowed.

Thank you.

FYI I have no experience of using code but if this is the most feasible option please let me know.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Here is one way to do a moving average. Look at how I setup sheet1. You can change the value in b2 to whatever you need.


Excel 2012
ABC
1ValuePeriodMovAvg
20.812#N/A
30.740.775
40.760.75
50.870.815
60.80.835
70.660.73
80.520.59
90.390.455
100.630.51
110.360.495
120.460.41
130.490.475
140.530.51
150.450.49
160.430.44
170.540.485
180.290.415
190.350.32
200.40.375
210.40.4
220.320.36
230.360.34
240.220.29
250.310.265
260.270.29
Sheet1
Cell Formulas
RangeFormula
C2=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A2, -$B$2+1,0,$B$2)),NA())
C3=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A3, -$B$2+1,0,$B$2)),NA())
C4=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A4, -$B$2+1,0,$B$2)),NA())
C5=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A5, -$B$2+1,0,$B$2)),NA())
C6=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A6, -$B$2+1,0,$B$2)),NA())
C7=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A7, -$B$2+1,0,$B$2)),NA())
C8=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A8, -$B$2+1,0,$B$2)),NA())
C9=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A9, -$B$2+1,0,$B$2)),NA())
C10=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A10, -$B$2+1,0,$B$2)),NA())
C11=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A11, -$B$2+1,0,$B$2)),NA())
C12=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A12, -$B$2+1,0,$B$2)),NA())
C13=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A13, -$B$2+1,0,$B$2)),NA())
C14=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A14, -$B$2+1,0,$B$2)),NA())
C15=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A15, -$B$2+1,0,$B$2)),NA())
C16=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A16, -$B$2+1,0,$B$2)),NA())
C17=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A17, -$B$2+1,0,$B$2)),NA())
C18=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A18, -$B$2+1,0,$B$2)),NA())
C19=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A19, -$B$2+1,0,$B$2)),NA())
C20=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A20, -$B$2+1,0,$B$2)),NA())
C21=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A21, -$B$2+1,0,$B$2)),NA())
C22=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A22, -$B$2+1,0,$B$2)),NA())
C23=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A23, -$B$2+1,0,$B$2)),NA())
C24=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A24, -$B$2+1,0,$B$2)),NA())
C25=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A25, -$B$2+1,0,$B$2)),NA())
C26=IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A26, -$B$2+1,0,$B$2)),NA())
 
Upvote 0
Here is one way to do a moving average.

I agree, but we have been asked for the Hull moving average (which is new to me!)

If I'm interpreting correctly, the Hull MA for period 100, say, will be:

MA( 2*MA(OriginalData,50) - MA(OriginalData,100), INT(SQRT(100)))

rush1884,

Will we always be averaging the same number of data points, e.g. for period 100, we will always pick up 100 data points = 100 trading days, i.e. we don't need to allow for variations in weekends/holidays/other non-trading days.

You mentioned "weighted", but I assume we're not actually weighting the index values with any other values?
 
Last edited:
Upvote 0
There's a workbook with four user-defined functions and several examples for calculating weighted moving averages and Hull's moving average (which is also just another WMA) at https://app.box.com/s/dfsv8o8omn6x35j31nwtqvgw331adg3u.

Are you really sure you want a 2000-day average? That's 10 years of data. There's a constant in the code that would need to change.
 
Last edited:
Upvote 0
I only know what I've found online (so no expertise :)), but it seems that the Hull moving average (HMA) depends on the weighted moving average (WMA), which is weighted based on how close (in series) the data is relative to the WMA being calculated. For a relatively simple 5-day WMA, the formula would be Day5value(5/15) + Day4value(4/15) + Day3value(3/15) + Day2value(2/15) + Day2value(1/15). It seems that the most reasonable way to approach it would be VBA (code). I'll see what I can come up with.

Edit...I didn't see shg's post. Do that :)

 
Last edited:
Upvote 0
I am desperately looking for some help in calculating 2000, 500, and 100 period hull moving average on a big dataset.

I am also wondering whether this is homework/assignment?

In which case we're still happy to help with Excel questions, but not do all the work.
 
Upvote 0
the excel spreadsheet i created checks with your example. however, when i use the formula =IF(ROW()>=($B$2+1),AVERAGE(OFFSET(A2, -$B$2+1,0,$B$2)),NA()) against data other than than shown in sheet 1 column A results are not correct.

those incorrect results indicate that the formula is incorrect. i am excel formula challenged so i am trying to understand the ''offset'' function,
etc.

in the meantime, any comments, suggestions, etc. will be much appreciated.
 
Upvote 0
I know this is an excel forum but if you're constantly working with very large datasets I recommend looking into R programming. You can calculate the WMA and HMA (and many other technical trading indicators) with two lines of code and fewer than 5 inputs for each line of code. You can then easily export to an excel file and manipulate / work with the dataset however you want. Look up R's TTR library if you're interested in going down that route.
 
Upvote 0
thanks everyone, you have been super helpful. i have stumbled into resolving my problem
so don't pay any attention to any of my posts from now on. i did not create this thread, i jumped
in in the middle of it.
 
Upvote 0

Forum statistics

Threads
1,215,346
Messages
6,124,417
Members
449,157
Latest member
mytux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top