Types
array
An ordered, resizable list of values of one type, written `array<type>`, as in `array<float>`. Create one with `array.new<type>(length)`, a typed constructor such as `array.new_float`, or `array.from`, and work with it through the `array` functions. An array declared with `static` keeps its elements from one bar to the next; without `static` it is created again on every bar.
Example
//@lipi=2
indicator("array Example", overlay=true)
// The last 10 closes, kept across bars
static array<float> closes = array.new_float(0)
array.push(closes, close)
if array.length(closes) > 10 {
array.shift(closes)
}
plot(array.avg(closes), title="10-Bar Average", color=color.blue)