ta.barssince
Count the bars since a condition last held, such as the last up bar.
ta.barssince(condition)Bars since the condition was last true: 0 on the bar it is true.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
condition | Series | bool | - | - | The condition to time. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
- 1 bar.
- Missing values
- na until the condition has been true at least once.
Example
ta.barssince(close > open)plot(ta.barssince(close > open), "Bars since up bar")