ArgMin
The ArgMin node returns the 0-based index of the lowest value in the rolling window. Index period−1 means the trough is at the most recent bar; index 0 means the trough was period bars ago. Used to detect swing lows, measure how many bars ago the bottom occurred, and build divergence detectors between price troughs and oscillator troughs.
Algorithm
- ▸Iterate through the window and track the index of the minimum non-null value
- ▸output = 0-based index of the minimum value within the window
- ▸Returns null if window has no non-null values
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| period | number | 20 | Rolling window size. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input | number[] | Source numeric array |
| Outputs | ||
| values | number | null | Computed value at each bar; null before the warmup period completes |
| timestamps | number[] | Bar timestamps (UNIX ms), aligned 1-to-1 with values |
Use Cases
Swing Low Detection
If ArgMin returns period−1, the current bar is the lowest bar in the window — a pivot low, useful for support detection and breakout filters.
Bullish Divergence
If price makes a new low (ArgMin=period−1) while an oscillator's ArgMin points to a bar earlier in the window, the oscillator formed a higher trough — bullish divergence.
Trough Age
Use period−1 minus ArgMin as a "bars since trough" counter to build time-based exit rules after a bottom is established.