Functions
array.slice()
Returns the part of the array from `index_from` up to, but not including, `index_to`. The slice shares its elements with the original array, so a change to one shows in the other. Use `array.copy` on the slice when you need an independent array.
Syntax
array.slice(series array id, series int index_from, series int index_to) → series array
Arguments
id required series array index_from series int index_to series int Return Type
series array Example
//@lipi=2
indicator("array.slice Example", overlay=false)
values = array.from(10.0, 20.0, 30.0, 40.0, 50.0)
middle = array.slice(values, 1, 4)
// middle holds 20.0, 30.0, 40.0
plot(array.avg(middle), title="Average of Middle Three", color=color.blue)