Returns how many bars back the lowest value of source in the last length bars occurred, as 0 or a negative number.
ta.lowestbars returns 0 when the lowest value in the window is on the current bar, -1 when it was one bar ago, and so on to -(length - 1). On a tie, the most recent bar is chosen.
With a single argument, ta.lowestbars(length), the source is low. Output begins when length bars are in the window.
Syntax
ta.lowestbars(source: series int/float, length: series int) -> series intArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | Series to scan. Leave it out, passing only the length, to scan low. |
| length | series int | required | Number of bars in the window. A whole number of 1 or more. |
Returns
series int: the bar offset of the window's lowest value: 0 for the current bar, negative for earlier ones.
Remarks
- A result of 0 means the current bar sets the window low.
Example
//@version=6
indicator("Age of low")
age = -ta.lowestbars(low, 30)
plot(age, "Bars since 30-bar low", color = color.blue, style = plot.style_stepline)See also
Runs on Sidechair