📢
Loading...
On this page
swap_horiz
xloc
X-axis location constants for labels and lines
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
| Constant | Description |
|---|---|
xloc.bar_index | X coordinates are bar indices (default). Use with bar_index. |
xloc.bar_time | X 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.