Lipi Reference Lipi

Functions

talib.barssince()

Counts the number of bars since the last time the condition was true.

Syntax

                talib.barssince(series bool condition) → series int
              

Arguments

condition required series bool The condition to check for.

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")