Skip to content
Algo Trade Analytics Docs

array.max() - Pine Script Function

The function returns the greatest value, or the nth greatest value in a given array.

array.max(id, nth) → series float
NameTypeDescription
idarray<int/float>An array object.

The greatest or the nth greatest value in the array.

  • Returns na if the id array is empty.
//@version=6
indicator("array.max")
a = array.from(5, -2, 0, 9, 1)thirdHighest = array.max(a, 2) // 1
plot(thirdHighest)