Skip to main content

wma

Weighted Moving Average.

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​

NameTypeDescriptionDefaultOptional
dataList[Data]The data to use for the calculation.NoneFalse
targetstrTarget column name.closeTrue
indexstrIndex column name to use with data, by default "date".dateTrue
lengthintThe length of the WMA, by default 50.50True
offsetintThe offset of the WMA, by default 0.0True

Returns​

The WMA data.