Sidechair

chart.point.new()

Browse the reference

Creates a chart point from a time, a bar index and a price you supply.

Try it in the editor

chart.point.new(time, bar_index, close) fills all three fields. Giving both a time and an index lets the point work whether a drawing is placed by bar index or by timestamp.

Use na for the field you do not know. chart.point.from_index() and chart.point.from_time() are the shorter forms of that.

Syntax

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

Arguments

NameTypeDefaultDescription
timeseries intrequiredTimestamp of the bar in milliseconds, as in the time variable. Used when a drawing is placed with xloc.bar_time.
indexseries intrequiredBar index, as in bar_index. Used when a drawing is placed with xloc.bar_index, which is the default.
priceseries int/floatrequiredPrice level of the point. It is the y value that drawings use for this anchor.

Returns

chart.point: A new chart.point.

Example

Pine ScriptA labelled point on the current barOpen in editor
//@version=6
indicator("chart.point.new: current bar", overlay = true)
p = chart.point.new(time, bar_index, high)
if barstate.islast
    label.new(p, "top")

See also

Runs on Sidechair