TradeZoro
Notifications

Reference

Arrays

Lists of values. Method style works too: prices.push(close).

array.abs(id)

A new array with absolute values.

Returns: the same type as the first argument

ParameterType
idarray

array.avg(id)

Average of the items.

Returns: a number

ParameterType
idarray

array.clear(id)

Removes every item.

Returns: nothing

ParameterType
idarray

array.concat(id1, id2)

Appends the second array to the first.

Returns: the same type as the first argument

ParameterType
id1array
id2array

array.copy(id)

A copy of the array.

Returns: the same type as the first argument

ParameterType
idarray

array.fill(id, value, index_from=0, index_to=na)

Sets items in a range to value.

Returns: nothing

ParameterTypeNotes
idarray
valueany
index_fromintDefault 0
index_tointDefault na

array.first(id)

First item.

Returns: elem0

ParameterType
idarray

array.from(...values)

A new array holding the given values.

Returns: fromarr

ParameterType
valuesany

array.get(id, index)

The item at index (-1 = last).

Returns: elem0

ParameterType
idarray
indexint

array.includes(id, value)

True if the value is in the array.

Returns: true or false

ParameterType
idarray
valueany

array.indexof(id, value)

First index of value (-1 if absent).

Returns: a whole number

ParameterType
idarray
valueany

array.insert(id, index, value)

Inserts an item at index.

Returns: nothing

ParameterType
idarray
indexint
valueany

array.join(id, separator="")

The items joined as text.

Returns: text

ParameterTypeNotes
idarray
separatorstringDefault ""

array.last(id)

Last item.

Returns: elem0

ParameterType
idarray

array.lastindexof(id, value)

Last index of value (-1 if absent).

Returns: a whole number

ParameterType
idarray
valueany

array.max(id)

Largest item.

Returns: a number

ParameterType
idarray

array.median(id)

Median of the items.

Returns: a number

ParameterType
idarray

array.min(id)

Smallest item.

Returns: a number

ParameterType
idarray

array.new(size=0, initial_value=na)

A new array (write the type: array.new<float>(...)).

Returns: newarr

ParameterTypeNotes
sizeintDefault 0
initial_valueanyDefault na

array.new_bool(size=0, initial_value=false)

A new array of bools.

Returns: an array of bool

ParameterTypeNotes
sizeintDefault 0
initial_valueboolDefault false

array.new_box(size=0, initial_value=na)

A new array of boxes.

Returns: an array of box

ParameterTypeNotes
sizeintDefault 0
initial_valueboxDefault na

array.new_color(size=0, initial_value=na)

A new array of colors.

Returns: an array of color

ParameterTypeNotes
sizeintDefault 0
initial_valuecolorDefault na

array.new_float(size=0, initial_value=na)

A new array of floats.

Returns: an array of float

ParameterTypeNotes
sizeintDefault 0
initial_valuefloatDefault na

array.new_int(size=0, initial_value=na)

A new array of ints.

Returns: an array of int

ParameterTypeNotes
sizeintDefault 0
initial_valueintDefault na

array.new_label(size=0, initial_value=na)

A new array of labels.

Returns: an array of label

ParameterTypeNotes
sizeintDefault 0
initial_valuelabelDefault na

array.new_line(size=0, initial_value=na)

A new array of lines.

Returns: an array of line

ParameterTypeNotes
sizeintDefault 0
initial_valuelineDefault na

array.new_string(size=0, initial_value=na)

A new array of strings.

Returns: an array of string

ParameterTypeNotes
sizeintDefault 0
initial_valuestringDefault na

array.pop(id)

Removes and returns the last item.

Returns: elem0

ParameterType
idarray

array.push(id, value)

Adds an item at the end.

Returns: nothing

ParameterType
idarray
valueany

array.range(id)

Largest minus smallest item.

Returns: a number

ParameterType
idarray

array.remove(id, index)

Removes and returns the item at index.

Returns: elem0

ParameterType
idarray
indexint

array.reverse(id)

Reverses the order in place.

Returns: nothing

ParameterType
idarray

array.set(id, index, value)

Replaces the item at index.

Returns: nothing

ParameterType
idarray
indexint
valueany

array.shift(id)

Removes and returns the first item.

Returns: elem0

ParameterType
idarray

array.size(id)

Number of items.

Returns: a whole number

ParameterType
idarray

array.slice(id, index_from, index_to=na)

A copy of part of the array.

Returns: the same type as the first argument

ParameterTypeNotes
idarray
index_fromint
index_tointDefault na

array.sort(id, order="ascending")

Sorts in place (order.ascending or order.descending).

Returns: nothing

ParameterTypeNotes
idarray
orderstringDefault "ascending"

array.sort_indices(id, order="ascending")

Indices that would sort the array.

Returns: an array of int

ParameterTypeNotes
idarray
orderstringDefault "ascending"

array.stdev(id, biased=true)

Standard deviation of the items.

Returns: a number

ParameterTypeNotes
idarray
biasedboolDefault true

array.sum(id)

Sum of the items.

Returns: a number

ParameterType
idarray

array.unshift(id, value)

Adds an item at the start.

Returns: nothing

ParameterType
idarray
valueany

array.variance(id, biased=true)

Variance of the items.

Returns: a number

ParameterTypeNotes
idarray
biasedboolDefault true

Education only. Not financial advice. Examples are teaching samples, not trading results.

Zscript is coming soon

The manual opens when Zscript launches.

Back to home