array.indexof() - Pine Script Function
array.indexof()
Section titled “array.indexof()”Overview
Section titled “Overview”The function returns the index of the first occurrence of the value, or -1 if the value is not found.
Syntax
Section titled “Syntax”array.indexof(id, value) → series intParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Returns
Section titled “Returns”The index of an element.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.indexof example")a = array.new_float(5,high)index = array.indexof(a, high)plot(index)