matrix - Pine Script Type
matrix
Section titled “matrix”Overview
Section titled “Overview”Keyword used to explicitly declare the “matrix” type of a variable or a parameter. Matrix objects (or IDs) can be created with the matrix.new
Remarks
Section titled “Remarks”- Matrix objects are always of “series” form.
Example
Section titled “Example”//@version=6indicator("matrix example")// Create `m1` matrix of `int` type.matrix<int> m1 = matrix.new<int>(2, 3, 0)// `matrix<int>` is unnecessary because the `matrix.new<int>()` function returns an `int` type matrix object.m2 = matrix.new<int>(2, 3, 0)// Display matrix using a label.if barstate.islastconfirmedhistory label.new(bar_index, high, str.tostring(m2))