Creates a chart point from a timestamp and a price, with the bar index left empty.
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
chart.point.from_time(time: series int, price: series int/float) -> chart.pointArguments
| Name | Type | Default | Description |
|---|---|---|---|
| time | series int | required | Timestamp of the anchor in milliseconds, the unit of the time variable. The point's bar index is left na. |
| price | series int/ | required | Price 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
//@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