Index of lowest value over a specified period (MININDEX)
Summary
Returns the absolute index of the lowest value within a rolling window of the given period. Same scan as MIN but outputs the position of the minimum rather than its value.
Chart
Chart metadata i
Outputs
outInteger:line·bar_index
Formula
outInteger[i] = index of min(inReal[i-optInTimePeriod+1 .. i])
Notes
- When several bars in a window share the lowest value, the index of the most recent of them is returned.
Inputs
inReal— Series to scan for its minimum
Outputs
outInteger— Absolute index in inReal of the lowest value in each window
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 30 | 2–100000 | Window length over which the minimum is located |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
C
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double series[252]; /* your data, oldest first */
int out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_MININDEX( 0, n - 1, series, 30, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d; last out = %d\n", outNBElement, outBegIdx, out[outNBElement - 1] );Rust
use ta_lib::Core;
let series = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0i32; 252];
let core = Core::new();
let range = core.minindex(0, series.len() - 1, &series, 30, &mut out)?;
println!("{} values from bar {}; last out = {}", range.count, range.beg_idx, out[range.count - 1]);Java
import io.github.talib.Core;
import io.github.talib.OutRange;
double[] series = new double[252]; // your data, oldest first
int[] out = new int[252];
Core core = Core.DEFAULT;
OutRange r = core.minindex(0, series.length - 1, series, 30, out);
System.out.println(r.count() + " values from bar " + r.begIdx() + "; last out = " + out[r.count() - 1]);C#
using System;
using TALib;
var series = new double[252]; // your data, oldest first
var outInteger = new int[252];
var core = Core.Default;
OutRange r = core.Minindex(0, series.Length - 1, series, 30, outInteger);
Console.WriteLine($"{r.Count} values from bar {r.BegIdx}; last outInteger = {outInteger[r.Count - 1]}");TypeScript
import { minindex } from 'ta-lib';
const series = new Float64Array(252); // your data, oldest first
const { begIdx, values } = minindex(series, { timePeriod: 30 });
console.log(values.length + ' values from bar ' + begIdx + '; last values = ' + values[values.length - 1]);Implementation
Added in 0.4.0.
TA-Lib Definition: minindex.c · minindex.yaml
| Native | File |
|---|---|
| C | ta_MININDEX.c |
| Rust | minindex.rs |
| Java | Core_MININDEX.java |
| C# | Core_MININDEX.cs |
| TypeScript | minindex.ts |
Python: talib.MININDEX, see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Index of Lowest Value, Lowest Value Index, Rolling Argmin
See Also
MIN · MAXINDEX · MINMAXINDEX · MINMAX