UtilityPine Script v6

ta.lowestbars()Lowest Value Offset

Lowest value offset for a given number of bars back.

Syntax

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

Arguments

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

Returns

Offset to the lowest bar.

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="Bars since 20-bar low")

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.

It is the offset from the current bar to the bar where the lowest value in the window was found.

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

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.lowestbars() and other built-in functions instantly.