Skip to content
Algo Trade Analytics Docs

matrix.rows() - Pine Script Function

The function returns the number of rows in the matrix.

matrix.rows(id) → series int
NameTypeDescription
idany matrix typeA matrix object.

The number of rows in the matrix id.

//@version=6
indicator("`matrix.rows()` Example")// Create a 2x6 matrix with values `0`.var m = matrix.new<int>(2, 6, 0)// Get the quantity of rows in the matrix.var x = matrix.rows(m)// Display using a label.
if barstate.islastconfirmedhistory
label.new(bar_index, high, "Rows: " + str.tostring(x) + "\n" + str.tostring(m))