Exponential Moving Average (EMA)
Calculate the Exponential Moving Average (EMA) for a given price series.
EMA is a technical indicator that gives more weight to recent price data, providing a smoothed moving average that reacts faster to price changes.
The formula is as follows:
\[\text{EMA} = (\text{Close} - \text{Previous EMA}) \cdot (2 / (1 + \text{Window})) + \text{Previous EMA}\]Also known as: EMA.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Exponential Moving Average (EMA) for you. Just ask in plain English.
Calculate the Exponential Moving Average (EMA) in Python
The Exponential Moving Average (EMA) is available in the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_exponential_moving_average as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_exponential_moving_average()
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2026-06-18 | 298.807 | 400.817 | 744.491 |
| 2026-06-22 | 298.567 | 396.353 | 744.477 |
| 2026-06-23 | 297.998 | 393.365 | 743.024 |
| 2026-06-24 | 297.342 | 389.644 | 741.72 |
| 2026-06-25 | 294.383 | 384.736 | 740.73 |
| 2026-06-26 | 292.969 | 383.167 | 739.165 |
| 2026-06-29 | 291.472 | 381.221 | 739.41 |
| 2026-06-30 | 291.191 | 380.127 | 740.391 |
| 2026-07-01 | 291.616 | 380.681 | 741.107 |
| 2026-07-02 | 293.884 | 381.989 | 741.597 |
Parameters
get_exponential_moving_average accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The column name for closing prices in the historical data. Defaults to “Adj Close”.
- window (int, optional): Number of periods for EMA calculation. The number of periods (time intervals) over which to calculate the EMA.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the EMA. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.
Related Overlap Indicators
The Technicals module page introduces the module, and the sidebar lists all of its functions.