Appends all items of a second array to the end of the first and returns the first array.
After array.concat(a, b) the array a holds its own items followed by those of b, while b is unchanged. The returned value is a itself, not a new array, so the result can be assigned or ignored.
The two arrays have to hold the same item type, and the combined length may not pass 100,000 items.
Syntax
array.concat(id1: any array type, id2: any array type) -> array<type>
array.concat(id2: any array type) -> array<type>Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| id1 | any array type | required | The array that is read, or that receives the result. |
| id2 | any array type | required | The array whose items are appended to the first array. It is left as it is. |
Returns
array<type>: The first array, now including the items of the second.
Remarks
- To merge into a fresh array and keep both sources untouched, call
array.copy()on the first one and concatenate onto the copy.
Example
//@version=6
indicator("array.concat: all levels", overlay = true)
supports = array.from(low, low[1])
resistances = array.from(high, high[1])
all = array.concat(array.copy(supports), resistances)
plot(array.min(all), "Lowest", color.red)
plot(array.max(all), "Highest", color.green)See also
Runs on Sidechair