Lipi Reference Lipi

Functions

talib.barssince()

Counts the bars that have gone by since `condition` was last true. The condition slot is wide: an int, a float or a bool expression is accepted.

Syntax

                talib.barssince(series bool condition) → series int
              

Arguments

condition required series bool The test to look back for. Int, float and bool expressions are all accepted.

Return Type

series int

Example


          indicator("Last Breakout Marker", overlay=true)
// Define breakout condition
breakout = close > talib.highest(low, 20)
// Get bars since last breakout
barsSinceBreakout = talib.barssince(breakout)
// Mark breakout bar with an arrow
plotshape(barsSinceBreakout == 0, location=location.abovebar, color=color.green, shape=shape.square, title="Breakout")