Lipi Reference
Lipi

Functions

array.indexof()

Returns the index of the first element equal to `value`, or -1 when no element matches.

Syntax

                array.indexof(series array id, series <type of the array's elements> value) → series int
              

Arguments

id required series array
value required series

Return Type

series int

Example


          //@lipi=2
indicator("array.indexof Example", overlay=false)
levels = array.from(100.0, 200.0, 300.0)
pos = array.indexof(levels, 200.0)
plot(pos, title="Index of 200 (1)", color=color.blue)