Lipi Reference Lipi

Functions

talib.highestbars()

Locates the highest value of `source` within the last `length` bars and returns its position rather than its value. It returns a series int, which makes it the companion to `talib.highest`.

Syntax

                talib.highestbars(series float source, series int length) → series int
              

Arguments

source required series float The series to search.
length required series int How many bars the search covers.

Return Type

series int

Example


          indicator("Highest Bars Example", overlay=true)
// Define input source and period
src = high
length = 20
// Compute the number of bars ago the highest value occurred
bars_since_highest = talib.highestbars(src, length)
// Mark the highest point with a plot shape
plotshape(bars_since_highest == 0, location=location.abovebar, color=color.green, shape=shape.circle, title="Highest")