VectorExtensions.ExponentialMovingAverage Method

Definition

Namespace: Extreme.DataAnalysis
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

ExponentialMovingAverage(Vector<Double>, Double) Returns a vector whose observations are the exponential moving average of the observations of the vector.
ExponentialMovingAverage(Vector<Double>, Int32) Returns a vector whose observations are the exponential moving average of the observations of the vector.
ExponentialMovingAverage(Vector<Double>, Int32, Int32) Returns a vector whose observations are the exponential moving average of the observations of the vector.

ExponentialMovingAverage(Vector<Double>, Double)

Returns a vector whose observations are the exponential moving average of the observations of the vector.
C#
public static Vector<double> ExponentialMovingAverage(
	this Vector<double> vector,
	double smoothingConstant
)

Parameters

vector  Vector<Double>
The vector to transform.
smoothingConstant  Double
A real number between 0 and 1 that specifies the contribution of the current observation to the average.

Return Value

Vector<Double>
A vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

The new vector gets the name EMA(<name>), where <name> is the name of the original vector.

Exceptions

ArgumentOutOfRangeExceptionsmoothingConstant is less than or equal to zero or greater than 1.

ExponentialMovingAverage(Vector<Double>, Int32)

Returns a vector whose observations are the exponential moving average of the observations of the vector.
C#
public static Vector<double> ExponentialMovingAverage(
	this Vector<double> vector,
	int length
)

Parameters

vector  Vector<Double>
The vector to transform.
length  Int32
The number of observations to be used in the average.

Return Value

Vector<Double>
A vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

The new vector gets the name EMA<n>(<name>), where <name> is the name of the original vector and <n> . is the length.

Exceptions

ArgumentOutOfRangeExceptionlength is less than or equal to zero.

ExponentialMovingAverage(Vector<Double>, Int32, Int32)

Returns a vector whose observations are the exponential moving average of the observations of the vector.
C#
public static Vector<double> ExponentialMovingAverage(
	this Vector<double> vector,
	int length,
	int startLength
)

Parameters

vector  Vector<Double>
The vector to transform.
length  Int32
The number of observations to be used in the average.
startLength  Int32
The number of observations used to compute the first value.

Return Value

Vector<Double>
A vector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

The simple average of the first startLength observations is used as the initial value for the previous period's exponential moving average.

The new vector gets the name EMA<n>(<name>), where <name> is the name of the original vector and <n> . is the length.

Exceptions

ArgumentOutOfRangeExceptionlength is less than or equal to zero.

See Also