Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
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)
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.