Skip to content
Algo Trade Analytics Docs

array.reverse() - Pine Script Function

The function reverses an array. The first array element becomes the last, and the last array element becomes the first.

array.reverse(id) → void
NameTypeDescription
idany array typeAn array object.
//@version=6
indicator("array.reverse example")
a = array.new_float(0)
for i = 0 to 9
array.push(a, close[i])
plot(array.get(a, 0))array.reverse(a)
plot(array.get(a, 0))