Skip to content
Algo Trade Analytics Docs

matrix.concat() - Pine Script Function

The function appends the m2 matrix to the m1 matrix.

matrix.concat(id1, id2) → matrix<type>
NameTypeDescription
id1any matrix typeMatrix object to concatenate into.

Returns the id1 matrix concatenated with the id2 matrix.

  • The number of columns in both matrices must be identical.
//@version=6
indicator("`matrix.concat()` Example")// Create a 2x4 "int" matrix containing values `0`.m1 = matrix.new<int>(2, 4, 0)// Create a 2x4 "int" matrix containing values `1`.m2 = matrix.new<int>(2, 4, 1)// Append matrix `m2` to `m1`.matrix.concat(m1, m2)// Display matrix elements.
if barstate.islastconfirmedhistory
var t = table.new(position.top_right, 2, 2, color.green)
table.cell(t, 0, 0, "Matrix Elements:")
table.cell(t, 0, 1, str.tostring(m1))