Functions
array.new_label()
Creates an array of `label` IDs with `size` elements, each set to `initial_value`. Arrays of drawing IDs are the usual way to keep a limited history of drawings: push each new label and delete the oldest when the array grows past a limit. Both arguments are optional; elements start as `na` when `initial_value` is left out.
Syntax
array.new_label(series int size, series label initial_value) → series array<label>
Arguments
size series int initial_value series label Return Type
series array<label> Example
//@lipi=2
indicator("array.new_label Example", overlay=true)
// Keep only the 5 most recent high labels
static array<label> labels = array.new_label(0)
ph = talib.pivothigh(high, 3, 3)
if not na(ph) {
array.push(labels, label.new(bar_index[3], high[3], text="PH"))
if array.length(labels) > 5 {
label.delete(array.shift(labels))
}
}