wma
Calculate the Weighted Moving Average (WMA).
A Weighted Moving Average puts more weight on recent data and less on past data. This is done by multiplying each bar's price by a weighting factor. Because of its unique calculation, WMA will follow prices more closely than a corresponding Simple Moving Average.
Example
from openbb import obb
stock_data = obb.equity.price.historical(symbol='TSLA', start_date='2023-01-01', provider='fmp')
wma_data = obb.technical.wma(data=stock_data.results, target='close', length=50, offset=0)
Parameters
- standard
| Name | Type | Description | Default | Optional |
|---|---|---|---|---|
| data | List[Data] | The data to use for the calculation. | False | |
| target | str | Target column name. | close | False |
| index | str | Index column name to use with data, by default "date". | date | False |
| length | int | The length of the WMA, by default 50. | 50 | False |
| offset | int | The offset of the WMA, by default 0. | 0 | False |
Returns
OBBject
results : List[Data]
The WMA data.