Exponential weighted average (EWA#)

Exponential weighted average (EWA#)

This calculates a continuous series between the start and end dates where each value is equal to the previous value plus a weighting factor. This has a smoothing effect on the trend line.

Exponential weighted averages are typically used in the technical analysis of market movements. The weighting factor is given below:

Format

EWA#(Expression,N)

EWA#(Expression,N,parameter)

Where N is an exponential weighting between 0 and 1. The lower the weighting, the greater the smoothing effect. Each weighted value (EWA) in the series is given by:

EWA = Previous EWA + Exponential weighting * (Current value - Previous EWA)

When input null values are displayed as 'N/A', the previous EWA is carried forward to calculate the next EWA. Where a time period instead of a factor is preferred i.e. an EWA based on 25 days - you can work out the factor using the formula - factor = 2/(days+1). So the factor for 25 days is 2/26 = .077.

The optional parameter can be:

R excludes the non-working days from the calculation

L uses sufficient prior history to ensure that the first value in the display range with will be the same regardless of the start date selected

Examples

EWA#(MKS,0.5)

This calculates EWA values as follows, based on Marks and Spencer share price values and a weighting of 0.5:

Marks and Spencer Price

EWA calculation

EWA

866

866

866

858

866 + 0.5*(858 - 866)

862

854

862 + 0.5*(854 - 862)

858

865

858 + 0.5*(865 - 858)

861.5

 

EWA#(FTSE100,0.4,R)

This calculates the exponentially weighted moving average, with a weighting factor of 0.4, using only working days, and not counting non-working days. This provides a more exact mathematical calculation.

Limitations

The L parameter is not currently supported by the web Expression  Builder in DFO / Datastream Charting, but can be used directly in requests / charts.

Further Information

Please refer to the Datastream Infobase article here for further reading

See also

Average functions