NDK_EWMA

int __stdcall NDK_EWMA ( double *  X,
size_t  N,
double  lambda,
size_t  step,
double *  retVal 
)

Calculates the estimated value of the exponential-weighted volatility (EWV).

Returns
status code of the operation
Return values
NDK_SUCCESS Operation successful
NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
[in] X is the univariate time series data (a one dimensional array).
[in] N is the number of observations in X.
[in] lambda is the smoothing parameter used for the exponential-weighting scheme. If missing, a default value of 0.94 is assumed
[in] step is the forecast time/horizon (expressed in terms of steps beyond the end of the time series X). If missing, a default value of 0 is assumed.
[out] retVal is the estimated value of the exponential-weighted volatility.
Remarks
1. The time series is homogeneous or equally spaced.
2. The time series may include missing values (NaN) at either end.
3. The EWMA function assumes that the time series has an average equal to zero.
4. The exponential-weighted moving average is calculated as:
  • \(\sigma_t^2=\lambda \sigma_{t-1}^2+(1-\lambda)x_{t-1}^2\) , where:
    • \(x_t\) is the value of the time series value at time t.
    • \(\lambda\) is the smoothing parameter (i.e. a non-negative constant between 0 and 1).
5. The size of the EWMA time series is equal to the input time series, but with the first observation (or last, if the original series is reversed) set to missing (NaN).
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples
   
Namespace:  NumXLAPI
Class:  SFSDK
Scope:  Public
Lifetime:  Static
int NDK_EWMA ( double[]  pData,
UIntPtr  nSize,
double  lambda,
UIntPtr  nStep,
out double  retVal 
)

Calculates the estimated value of the exponential-weighted volatility (EWV).

Return Value

a value from NDK_RETCODE enumeration for the status of the call. 

NDK_SUCCESS  operation successful
Error  Error Code
Parameters
[in] pData is the univariate time series data (a one dimensional array).
[in] nSize is the number of observations in pData.
[in] lambda is the smoothing parameter used for the exponential-weighting scheme. If missing, a default value of 0.94 is assumed
[in] nStep is the forecast time/horizon (expressed in terms of steps beyond the end of the time series pData). If missing, a default value of 0 is assumed.
[out] retVal is the estimated value of the exponential-weighted volatility.
Remarks
1. The time series is homogeneous or equally spaced.
2. The time series may include missing values (NaN) at either end.
3. The EWMA function assumes that the time series has an average equal to zero.
4. The exponential-weighted moving average is calculated as:
  • \(\sigma_t^2=\lambda \sigma_{t-1}^2+(1-\lambda)x_{t-1}^2\) , where:
    • \(x_t\) is the value of the time series value at time t.
    • \(\lambda\) is the smoothing parameter (i.e. a non-negative constant between 0 and 1).
5. The size of the EWMA time series is equal to the input time series, but with the first observation (or last, if the original series is reversed) set to missing (NaN).
Remarks
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI
Class SFSDK
Scope Public
Lifetime Static
Package NumXLAPI.DLL
Examples

	
References
* Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
* Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
* D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
* Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848