xloc

Constants that control the x-axis location mode for label.new() and line.new(). Determines whether x coordinates are interpreted as bar indices or timestamps.

Constants

ConstantDescription
xloc.bar_indexX coordinates are bar indices (default). Use with bar_index.
xloc.bar_timeX coordinates are UNIX timestamps in milliseconds. Use with time.

Example

from pynecore.lib import label, bar_index, time, close, xloc, script

@script.indicator(title="XLoc Demo", overlay=True)
def main():
    label.new(bar_index, close, "By index", xloc=xloc.bar_index)
    label.new(time, close, "By time", xloc=xloc.bar_time)

Compatibility

Both constants are fully supported.