Indexes of lowest and highest values over a specified period (MINMAXINDEX)
Summary
Returns the absolute input indices of the lowest and highest values within each rolling window of optInTimePeriod bars. Index variant of MINMAX.
Formula
outMinIdx[i] = index of min(inReal[i-optInTimePeriod+1 .. i])
outMaxIdx[i] = index of max(inReal[i-optInTimePeriod+1 .. i])
Notes
- When several bars in a window share the extreme value, the index of one of them is returned — not necessarily the first or the last.
Inputs
inReal— Input series scanned for extremes
Outputs
outMinIdx— Absolute index (into inReal) of the window minimumoutMaxIdx— Absolute index (into inReal) of the window maximum
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 30 | 2–100000 | Window length in bars |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: minmaxindex.c · minmaxindex.yaml
| Native | File |
|---|---|
| C | ta_MINMAXINDEX.c |
| Rust | minmaxindex.rs |
| Java | Core_MINMAXINDEX.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Lowest/Highest Index