Sidechair

chart.point.from_time()

Browse the reference

Creates a chart point from a timestamp and a price, with the bar index left empty.

Try it in the editor

The point works with drawings placed by time, with xloc.bar_time. Its index field is na, so it cannot place a drawing by bar index.

Use it when the anchor comes from a time value, such as a session start or a timestamp from time(), and especially for a point that may lie past the last bar.

Syntax

Pine Script
chart.point.from_time(time: series int, price: series int/float) -> chart.point

Arguments

NameTypeDefaultDescription
timeseries intrequiredTimestamp of the anchor in milliseconds, the unit of the time variable. The point's bar index is left na.
priceseries int/floatrequiredPrice level of the anchor. It is the y value drawings use for this point.

Returns

chart.point: A new chart.point with a time and a price.

Example

Pine ScriptLine from the session open to nowOpen in editor
//@version=6
indicator("chart.point.from_time: session anchor", overlay = true)
var float openPx = na
var int openT = na
if timeframe.change("D")
    openPx := open
    openT := time
if barstate.islast and not na(openT)
    a = chart.point.from_time(openT, openPx)
    b = chart.point.from_time(time, close)
    line.new(a, b, xloc = xloc.bar_time)

See also

Runs on Sidechair