Skip to main content

ema

Calculate the Exponential Moving Average (EMA).

EMA is a cumulative calculation, including all data. Past values have a diminishing contribution to the average, while more recent values have a greater contribution. This method allows the moving average to be more responsive to changes in the data.

Example:​

from openbb import obb
stock_data = obb.equity.price.historical(symbol="TSLA", start_date="2023-01-01", provider="fmp")
ema_data = obb.technical.ema(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 calculation, by default 50.50True
offsetintThe offset of the calculation, by default 0.0True

Returns​

The calculated data.