Custom Formula Collection

Moving Average of Only One Day of a the Week

Frequently we get requests for a formula that would take only one day of the week and average them for several weeks. For example construct a moving average of only the Fridays. This can be done in MetaStockTM for Windows by using the following formula.

The following MetaStock formula is for a moving average of the Friday of every week, if you want it calculated on any other day you would substitute a 1 for Monday, 2 for Tuesday, 3 for Wednesday, and 4 for Thursday. The number of day you wanted would replace the two 5's already in the formula. This moving average is currently a 6 week or 6 Friday moving average. If you wanted to change it to another periodicity you would change the 30 to the number of weeks or specific days multiplied by 5. In other words if you wanted a 4 day moving average of Friday you would change the 30 to 4*5 or 20.

Mov(If(DayOfWeek( )=5,C,Peak(1,If(DayOfWeek( )=5,C,0),1)),30,S)

For additional help with formulas, please see the Formula Primer.

Can't find the custom formula you need? MetaStock can create formulas for you.