label.get_x() - Pine Script Function
label.get_x()
Section titled “label.get_x()”Overview
Section titled “Overview”Returns UNIX time or bar index (depending on the last xloc value set) of this label’s position.
Syntax
Section titled “Syntax”label.get_x(id) → series intParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | series label | Label object. |
Returns
Section titled “Returns”UNIX timestamp (in milliseconds) or bar index.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("label.get_x")my_label =label.new(time, open, text="Open bar text", xloc=xloc.bar_time)a = label.get_x(my_label)plot(time - label.get_x(my_label)) //draws zero plot