Skip to content
Algo Trade Analytics Docs

array.indexof() - Pine Script Function

The function returns the index of the first occurrence of the value, or -1 if the value is not found.

array.indexof(id, value) → series int
NameTypeDescription
idany array typeAn array object.

The index of an element.

//@version=6
indicator("array.indexof example")
a = array.new_float(5,high)index = array.indexof(a, high)
plot(index)