Hull Moving Average (HMA)
Calculate the Hull Moving Average (HMA) for a given price series.
The Hull Moving Average (HMA) reduces the lag typically associated with moving averages while improving smoothing, by combining a Weighted Moving Average (WMA) of half the window length, a WMA of the full window length, and a further WMA over the square root of the window length.
The formula is as follows:
\[\text{Raw HMA} = (2 \cdot \operatorname{WMA}(\text{Close},\; \text{Window} / 2)) - \operatorname{WMA}(\text{Close},\; \text{Window})\] \[\text{HMA} = \operatorname{WMA}(\text{Raw HMA},\; \sqrt{\text{Window}})\]Also known as: HMA, Hull MA.
Hull Moving Average (HMA) in Python
get_hull_moving_average is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_hull_moving_average as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_hull_moving_average()
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2026-06-18 | 300.742 | 408.527 | 745.79 |
| 2026-06-22 | 300.078 | 401.871 | 744.779 |
| 2026-06-23 | 298.585 | 397.059 | 742.923 |
| 2026-06-24 | 297.358 | 392.639 | 741.423 |
| 2026-06-25 | 294.781 | 387.266 | 739.795 |
| 2026-06-26 | 293.098 | 384.145 | 739.184 |
| 2026-06-29 | 291.684 | 381.061 | 739.311 |
| 2026-06-30 | 291.599 | 378.891 | 740.005 |
| 2026-07-01 | 291.799 | 377.956 | 741.457 |
| 2026-07-02 | 292.727 | 377.967 | 741.959 |
Parameters
get_hull_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 to consider for the HMA. The number of periods (time intervals) over which to calculate the HMA.
- 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 HMA. 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.