Skip to content
Algo Trade Analytics Docs

matrix.set() - Pine Script Function

The function assigns value to the element at the row and column of the id matrix.

matrix.set(id, row, column, value) → void
NameTypeDescription
idany matrix typeA matrix object.
//@version=6
indicator("`matrix.set()` Example")// Create a 2x3 "int" matrix containing values `4`.m = matrix.new<int>(2, 3, 4)// Replace the value of element at row 1 and column 2 with value `3`.matrix.set(m, 0, 1, 3)// Display using a label.
if barstate.islastconfirmedhistory
label.new(bar_index, high, str.tostring(m))