map.keys() - Pine Script Function
map.keys()
Section titled “map.keys()”Overview
Section titled “Overview”Returns an array of all the keys in the id map. The resulting array is a copy and any changes to it are not reflected in the original map.
Syntax
Section titled “Syntax”map.keys(id) → array<type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any map type | A map object. |
Remarks
Section titled “Remarks”- Maps maintain insertion order. The elements within the array returned by this function will also be in the insertion order.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("map.keys example")a = map.new<string, float>()a.put("open", open)a.put("high", high)a.put("low", low)a.put("close", close)keys = map.keys(a)ohlc = 0.0for key in keys ohlc +=a.get(key)plot(ohlc/4)