Skip to content
Algo Trade Analytics Docs

matrix.get() - Pine Script Function

The function returns the element with the specified index of the matrix.

matrix.get(id, row, column) → <matrix_type>
NameTypeDescription
idany matrix typeA matrix object.

The value of the element at the row and column index of the id matrix.

  • Indexing of the rows and columns starts at zero.
//@version=6
indicator("`matrix.get()` Example", "", true)// Create a 2x3 "float" matrix from the `hl2` values.m = matrix.new<float>(2, 3, hl2)// Return the value of the element at index [0, 0]
of matrix `m`.x = matrix.get(m, 0, 0)
plot(x)