Sidechair

ta.lowest()

Browse the reference

Returns the lowest value of source over the last length bars, including the current one.

Try it in the editor

ta.lowest scans the window of length values and returns the smallest. With a single argument, ta.lowest(length), the source is the bar low.

The window needs length bars before a value appears, and any na inside it returns na.

Syntax

Pine Script
ta.lowest(source: series int/float, length: series int) -> series float

Arguments

NameTypeDefaultDescription
sourceseries int/floatrequiredSeries to scan. Leave it out, passing only the length, to scan low.
lengthseries intrequiredNumber of bars in the window. A whole number of 1 or more.

Returns

series float: the smallest value in the window, or na while it is not full.

Remarks

  • To place a stop under recent lows, use ta.lowest(low, n)[1] so the current bar is not part of its own stop.

Example

Pine ScriptLowest close with a markerOpen in editor
//@version=6
indicator("Lowest close", overlay = true)
low20 = ta.lowest(close, 20)
plot(low20, "20-bar low close", color = color.red)
plotshape(close == low20, "New low", shape.xcross, location.belowbar, color.red, size = size.tiny)

See also

Runs on Sidechair