Index of highest value over a specified period (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] = index of max(inReal[i-optInTimePeriod+1 .. i])
Notes
- When several bars in a window share the highest value, the index of the most recent of them is returned.
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
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Display Shift |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Implementation
TA-Lib Definition: maxindex.c · maxindex.yaml
| Native | File |
|---|---|
| C | ta_MAXINDEX.c |
| Rust | maxindex.rs |
| Java | Core_MAXINDEX.java |
| C# | Core_MAXINDEX.cs |
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