Skip to content
Algo Trade Analytics Docs

matrix.fill() - Pine Script Function

The function fills a rectangular area of the id matrix defined by the indices from_column to to_column (not including it) and from_row to to_row(not including it) with the value.

matrix.
fill(id, value, from_row, to_row, from_column, to_column) → void
NameTypeDescription
idany matrix typeA matrix object.
//@version=6
indicator("`matrix.
fill()` Example")// Create a 4x5 "int" matrix containing values `0`.m = matrix.new<float>(4, 5, 0)// Fill the intersection of rows 1 to 2 and columns 2 to 3 of the matrix with `hl2` values.matrix.
fill(m, hl2, 0, 2, 1, 3)// Display using a label.
if barstate.islastconfirmedhistory
label.new(bar_index, high, str.tostring(m))