Calculate the Double Exponential Moving Average (DEMA) for a given price series.

DEMA is a technical indicator that attempts to reduce the lag from traditional moving averages by using a combination of two exponential moving averages.

The formula is as follows:

\[\text{EMA} = (\text{Close} - \text{Previous EMA}) \cdot (2 / (1 + \text{Window})) + \text{Previous EMA}\]

Also known as: DEMA, double EMA.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Double Exponential Moving Average (DEMA) for you. Just ask in plain English.

Calculate the Double Exponential Moving Average (DEMA) in Python

The Double Exponential Moving Average (DEMA) is available in the Technicals module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_double_exponential_moving_average as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_double_exponential_moving_average()

Which returns:

Date AAPL MSFT Benchmark
2026-06-18 297.732 388.259 746.117
2026-06-22 297.428 381.601 745.875
2026-06-23 296.518 377.99 742.977
2026-06-24 295.491 373.095 740.548
2026-06-25 290.215 366.139 738.857
2026-06-26 288.132 365.69 736.185
2026-06-29 285.982 364.387 737.039
2026-06-30 286.188 364.591 739.187
2026-07-01 287.649 367.696 740.684
2026-07-02 292.412 371.868 741.654

Parameters

get_double_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 moving average calculation. The number of periods (time intervals) over which to calculate the moving average.
  • 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 DEMA. 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.

The Technicals module page introduces the module, and the sidebar lists all of its functions.

Share