# Weighted Moving Average

Contents[Hide]

The Weighted Moving Average (WMA) function computes the average of a set of input values over a specified number of time periods. In this function, a greater weight is given to more recent data. The function can be used to smooth a data series, which helps to reduce noise and make it easier to spot data trends.

The mathematical formula being calculated is as follows:

`WMAt = (n * Yt / K) + ((n-1) * Yt-1 / K)`

Where Y is the value, n is the number of periods, and K is the sum of n-based multipliers (for example, for n=3, K=3+2+1=6).

## 1. Syntax

```WGHTMOVAVG(d0,s0,Alignment)
```

## 2. Input

The Weighted Moving Average function requires the following input:

• d0 - Input data values - The set of data values for which the Weighted Moving Average is calculated.

## 3. Parameters

The Weighted Moving Average function requires the following parameters:

• s0 Period - The number of time periods to use in the calculation. The default value is 10.
• Alignment (Optional) – Hierarchy placeholder to be used as the alignment axis.

## 4. Output

The Weighted Moving Average function generates the following output:

• Weighted Moving Average - The Weighted Moving Average result set.