UtilityPine Script v6

ta.lowestbars()Lowest Value Offset

Lowest value offset for a given number of bars back.

TradingView language reference

Syntax

Syntax
ta.lowestbars(source, length) → series int

Arguments

ParameterTypeDescription
sourceseries int/floatSeries to scan.
lengthseries intLookback length.

Returns

Signed offset to the lowest bar: 0 for the current bar, -1 for one bar back, and so on.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.lowestbars")
lb = ta.lowestbars(low, 20)
plot(lb, title="Signed offset to 20-bar low")
plot(-lb, title="Nonnegative bars back", color=color.orange)

Trading Applications

Find how many bars ago the lowest value occurred

Build time-based support detection

Detect aging lows for potential bounces

Use in swing low identification

Related Functions

Frequently Asked Questions

ta.lowestbars(source, length) returns how many bars ago the minimum of source occurred within the last length bars (ignoring na), expressed as a bar offset.

The offset is zero or negative. Negate it to obtain a nonnegative bars-back distance. The one-argument overload uses low; this is a rolling minimum location, not a confirmed swing pivot.

Pair offsets with pivot logic: fresh lows with small offsets can indicate continued pressure; lows that are “old” may be used as reference for mean reversion or stop placement in larger systems.

Generate ta.lowestbars() Code with AI

Draft Pine Script using ta.lowestbars() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.