Here we evaluate the Weighted Moving Average(WMA) where for each period for which the WMA is evaluated the historical terms are weighted in accordance with the same set of weights.
Syntax
Visual Basic (Declaration) |
|
Public Overloads Shared Function WeightedMovingAverage( _
ByVal s As Series, _
ByVal weights() As Double _
) As Series |
Parameters
- s
- An series of historical values, where the first element corresponds to the market on the last period, the second term to the value on previous period and so on.
- weights
- Array of doubles which assigns weights to the k-th previous historical values for the given period on which the moving average is being evaluated. Here k is just the length of the weights array given.
Return Value
A series where the first term is the value of the moving average corresponding of the latest period, the second term is the value for the previous period and so on.
Exceptions
Exception |
Description |
ArgumentException |
Thrown if the length of the weights and series differ or if either array is empty. |
Remarks
See Also