dotnetCHARTING Send comments on this topic.
WeightedMovingAverage(Series,Series,ElementValue,Int32) Method
See Also 
dotnetCHARTING Namespace > FinancialEngine Class > WeightedMovingAverage Method : WeightedMovingAverage(Series,Series,ElementValue,Int32) Method


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.
weightSeries
A series 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.
elementValue
Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
lengthOfMA
The number of periods over which the weighted moving average is evaluated.
Evaluate the Weighted Moving Average(WMA) where the weights associated to all the elements of the historical values are given and the WMA is evaluated for all periods for which there is sufficient historical data.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function WeightedMovingAverage( _
   ByVal s As Series, _
   ByVal weightSeries As Series, _
   ByVal elementValue As ElementValue, _
   ByVal lengthOfMA As Integer _
) As Series
Visual Basic (Usage)Copy Code
Dim s As Series
Dim weightSeries As Series
Dim elementValue As ElementValue
Dim lengthOfMA As Integer
Dim value As Series
 
value = FinancialEngine.WeightedMovingAverage(s, weightSeries, elementValue, lengthOfMA)
C# 
public static Series WeightedMovingAverage( 
   Series s,
   Series weightSeries,
   ElementValue elementValue,
   int lengthOfMA
)

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.
weightSeries
A series 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.
elementValue
Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
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.

Exceptions

ExceptionDescription
ArgumentExceptionThrown if the length of the weights and series differ or if either series is empty.

Remarks

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.

See Also

© 2008 All Rights Reserved.