Median Price

The Median Price is the middle of the high and the low of a period, the centre of its range. The Awesome Oscillator and the Fractal Adaptive Moving Average are built on it.

The formula for the Median Price is as follows:

\[\text{Median Price} = \frac{\text{High} + \text{Low}}{2}\]

Where High and Low are the highest and lowest price of the period. It ignores where the period opened and closed, so it shows where the price traded rather than where it settled.

A price transform condenses the open, high, low and close of a period into one price. The close alone says where a period ended, not where it traded; averaging it with the high and low, or the open, gives a price that reflects the whole range of the period. Indicators that should reflect the whole bar rather than only the close are built on these prices, and a moving average or oscillator of one of them reacts less to a close at the edge of the range than one of the close.

Also known as: MEDPRICE, HL2.

In the Finance Toolkit this is get_price_transform with method="median", the same function as Price Transform.

Example · NVDA · 2021 to 2025

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

from financetoolkit import Toolkit

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

toolkit.technicals.get_price_transform(method="median")

Which returns:

References

  • Paper Achelis, S.B. (2000). “Technical Analysis from A to Z.” 2nd edition, McGraw-Hill.
  • Library Referenced against TA-Lib’s MEDPRICE (Median Price)
  • Library Shares similar logic as pandas-ta-classic’s hl2 (Median Price)
  • Library Shares similar logic as Tulip Indicators’ medprice (Median Price)
Share