ArgMin

Windowed · default period 20Statistics

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

NameTypeDefaultDescription
periodnumber20Rolling window size.

Inputs & Outputs

PortTypeDescription
Inputs
inputnumber[]Source numeric array
Outputs
valuesnumber | nullComputed value at each bar; null before the warmup period completes
timestampsnumber[]Bar timestamps (UNIX ms), aligned 1-to-1 with values
Live mode: In live streaming mode the node updates only the last bar in-place rather than recalculating the full array, keeping CPU usage minimal during real-time data feeds.

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.