Midpoint Price over period (MIDPRICE)
Summary
Midpoint of the price range over a rolling window: the average of the highest high and lowest low across the last optInTimePeriod bars. An overlap-study line plotted on price.
Formula
MIDPRICE = (Highest(High, N) + Lowest(Low, N)) / 2, over the N=optInTimePeriod bars ending at each index
This is the Donchian Channel centerline: DONCHIAN emits this line as its middle output, alongside the two extrema.
Inputs
inHigh— High price of each barinLow— Low price of each bar
Outputs
outReal— Midpoint of the period's high/low extremes
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 14 | 2–100000 | Window length over which the high/low extremes are taken |
Properties
Numerical Stability: Start-Independent
| ✅ Overlap Input i |
| ☐ Independent Y-Axis |
| ☐ Candlestick |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: midprice.c · midprice.yaml
| Native | File |
|---|---|
| C | ta_MIDPRICE.c |
| Rust | midprice.rs |
| Java | Core_MIDPRICE.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Midpoint Price