Midpoint

Calculate the Midpoint: the middle of the highest and lowest price over a window.

The midpoint is the centre of the range the price covered over the window, a moving average that only looks at the extremes. With the closes it is the midpoint of the highest and lowest close; with the highs and lows it is the midpoint price, the middle line of a Donchian Channel that includes the current period.

The formula is as follows, per method:

\[\text{Midpoint of the closes:}\;\; \text{Midpoint} = \frac{\text{Highest Close}(\text{Window}) + \text{Lowest Close}(\text{Window})}{2}\] \[\text{Midpoint price:}\;\; \text{Midpoint Price} = \frac{\text{Highest High}(\text{Window}) + \text{Lowest Low}(\text{Window})}{2}\]

Also known as: MIDPOINT, midpoint over period, MIDPRICE, midpoint price, Donchian middle line.

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")

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

What was the midpoint of Amazon's 14-day high-low range in 2025?

Which returns:

Parameters

get_midpoint accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the high and low prices are adjusted for dividends in the same way."Close"
windowintThe number of periods, including the current one. Defaults to 14.20
methodstrOptions are: “close” (the midpoint of the closes, MIDPOINT), “high_low” (the midpoint of the highs and lows, MIDPRICE). Defaults to “close”."close"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the midpoint. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

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