array.new_float() - Pine Script Function
array.new_float()
Section titled “array.new_float()”Overview
Section titled “Overview”The function creates a new array object of float type elements.
Syntax
Section titled “Syntax”array.new_float(size, initial_value) → array<float>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| size | series int | Initial size of an array. Optional. The default is 0. |
Returns
Section titled “Returns”The ID of an array object which may be used in other array.*() functions.
Remarks
Section titled “Remarks”- An array index starts from 0.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.new_float example")length = 5a = array.new_float(length, close)plot(array.sum(a) / length)