Returns the values of a map as a new array, in the order their keys were added.
The array is a copy that matches map.keys() position for position, so the value at index i belongs to the key at index i.
Feed it to array statistics such as array.avg() or array.max() to summarise everything the map holds.
Syntax
map.values(id: any map type) -> array<>
map.values() -> array<>Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | any map type | required | The map whose values are listed. The values come back as a new array. |
Returns
array<>: A new array holding the values.
Example
//@version=6
indicator("map.values: average", overlay = false)
var m = map.new<int, float>()
map.put(m, bar_index % 5, close)
plot(array.avg(map.values(m)), "Mean of stored closes")See also
Runs on Sidechair