Visual Basic (Declaration) | |
---|---|
Overloads Public Shared Function WeightedMovingAverage( _ ByVal s As Series, _ ByVal weightSeries As Series, _ ByVal lengthOfMA As Integer _ ) As Series |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public static Series WeightedMovingAverage( Series s, Series weightSeries, int lengthOfMA ) |
Parameters
- s
- An statistical series
- weightSeries
- A series 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.
- lengthOfMA
- The number of periods over which the weighted moving average is evaluated.
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.Exception | Description |
---|---|
ArgumentException | Thrown if the length of the weightsSeries and s differ or if either series is empty. |
That is, the weights are fixed for all given historical values and the window of length
lengthOfMA
over which the GMA is evaluated is shifted along the series.
Application
Generally speaking the WMA where the weights are all set and the window over which GMA is evaluated is shifted is used when you wish to give emphasis to particular dates.
Note: The length of the weights
array must equal or be greater
than the length of the historicalPrices
series. If it's greater than we
ignore the supplementary values.