Description Usage Arguments Details Value Methods Author(s) See Also Examples

Calculation of a right ended weighted moving average with weights
according to `weights`

.

1 |

`y` |
Objects of classes: numeric, matrix, data.frame, ts, mts, and timeSeries are supported. |

`weights` |
Numeric, a vector containing the weights. |

`trim` |
Logical, if |

If the sum of the weights is greater than unity, a warning is issued.

An object of the same class as `y`

, containing the computed
weighted moving averages.

- y = "data.frame"
The calculation is applied per column of the data.frame and only if all columns are numeric.

- y = "matrix"
The calculation is applied per column of the matrix.

- y = "mts"
The calculation is applied per column of the mts object. The attributes are preserved and an object of the same class is returned.

- y = "numeric"
Calculation of the es trend.

- y = "timeSeries"
The calculation is applied per column of the timeSeries object and an object of the same class is returned.

- y = "ts"
Calculation of the es trend. The attributes are preserved and an object of the same class is returned.

- y = "xts"
Calculation of the es trend. The attributes are preserved and an object of the same class is returned.

- y = "zoo"
Calculation of the es trend. The attributes are preserved and an object of the same class is returned.

Bernhard Pfaff

`filter`

, `trdbilson`

,
`trdbinary`

, `trdhp`

,
`trdes`

, `trdsma`

,
`capser`

1 2 3 4 | ```
data(StockIndex)
y <- StockIndex[, "SP500"]
wma <- trdwma(y, weights = c(0.4, 0.3, 0.2, 0.1))
head(wma, 30)
``` |

```
Loading required package: cccp
Loading required package: Rglpk
Loading required package: slam
Using the GLPK callable library version 4.52
Loading required package: timeSeries
Loading required package: timeDate
Financial Risk Modelling and Portfolio Optimisation with R (version 0.4-1)
[1] NA NA NA 391.205 384.938 395.898 402.343 408.264 408.556
[10] 410.505 412.633 411.220 416.691 416.362 417.228 418.201 423.188 430.449
[19] 435.296 439.885 445.320 444.131 446.805 448.474 448.468 454.988 457.319
[28] 462.336 463.207 465.452
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.