Midpoint Price

The Midpoint Price is the middle of the highest high and the lowest low over the last n periods, including the current one: the middle line of a Donchian Channel.

The formula for the Midpoint Price is as follows:

\[\text{Midpoint Price} = \frac{\text{Max}(\text{High}, n) + \text{Min}(\text{Low}, n)}{2}\]

Where Max(High, n) is the highest high and Min(Low, n) the lowest low of the last n periods. Since it takes the highs and lows rather than the closes, it covers the full range the price traded in, intraday spikes included. It is read like the Midpoint.

The midpoint is the centre of the range the price covered over the last n periods: a moving average that only looks at the extremes. Where a moving average weighs every price of the window, the midpoint moves only when the window sets a new high or low or an old one drops out, so it stays flat while the price moves inside its range and steps when it breaks out.

Also known as: MIDPRICE, midprice, Donchian middle line.

In the Finance Toolkit this is get_midpoint with method="high_low", the same function as Midpoint.

Example · AMZN · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_midpoint:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["AMZN"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_midpoint(method="high_low")

Which returns:

References

  • Paper Donchian, R.D. (1960). “Commodities: High Finance in Copper.” Financial Analysts Journal, 16(6), 133-142.
  • Library Referenced against TA-Lib’s MIDPRICE (Midpoint Price)
  • Library Shares similar logic as pandas-ta-classic’s midprice (Midpoint Price)
Share