Returns a NumericalVariable whose observations are the weighted
moving average of the observations of the variable.
Namespace: Extreme.Statistics
Assembly: Extreme.Numerics (Extreme.Numerics)
Syntax
| Visual Basic (Declaration) |
|---|
Public Function GetWeightedMovingAverage ( _ weights As Double(), _ currentWeightIndex As Integer _ ) As NumericalVariable |
| C# |
|---|
public NumericalVariable GetWeightedMovingAverage ( double[] weights, int currentWeightIndex ) |
| C++ |
|---|
public: NumericalVariable^ GetWeightedMovingAverage ( array<double>^ weights, int currentWeightIndex ) |
Parameters
- weights ()
- A Double array containing the weights.
- currentWeightIndex (System.Int32)
- An integer specifying the index in weights that corresponds to the current observation.
Return Value
A NumericalVariable.
Remarks
The weights are applied backwards. If currentWeightIndex is zero, then
the first component of weights gives the weight for the
current observation, the second component gives the weight for the previous
observation, and so on.
The new variable gets the name WMA<n>(<name>), where <name> is the name of the original variable and <n> . is the length of weights.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | weights is nullNothingnullptr. |
| ArgumentOutOfRangeException | currentWeightIndex is less than zero or greater than or equal to the length of weights. |
| InsufficientDataException |
The length of the variable is less than the length of weights.
-or- The length of weights is zero. |