MAXINDEX
MAXINDEX
Summary
Returns the index of the highest input value within a rolling window of optInTimePeriod bars. Same as MAX but outputs the location instead of the value.
Formula
outInteger[i] = argmax_{j in [i-optInTimePeriod+1, i]} inReal[j]
Notes
- When several bars in a window share the highest value, which bar's index is returned is not guaranteed to be a specific one of the tied bars.
Inputs
inReal— Input series to scan
Outputs
outInteger— Absolute index (into inReal) of the highest value in each window
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 30 | 2–100000 | Window length over which the max is located |
Properties
Numerical Stability: Start-Independent
| Display Flags |
|---|
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
Implementation
TA-Lib Definition: maxindex.c · maxindex.yaml
| Native | File |
|---|---|
| C | ta_MAXINDEX.c |
| Rust | maxindex.rs |
| Java | Core_MAXINDEX.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Index of Highest Value, Highest Value Index, argmax
See Also
MAX · MININDEX · MIN · MINMAXINDEX