Sidechair

chart.point

Browse the reference

The type that holds one spot on the chart as a bar index, a time and a price.

Try it in the editor

A chart.point has three fields: index (the bar index, an int), time (the bar's timestamp in milliseconds, an int) and price (a float). Read them with dot notation, as in pt.price.

The constructors differ in which fields they fill. chart.point.new() sets all three, chart.point.from_index() leaves time na, chart.point.from_time() leaves index na, and chart.point.now() takes the current bar. A drawing placed by xloc.bar_index reads the index, one placed by xloc.bar_time reads the time.

Syntax

index: series int, time: series int, price: series float

Remarks

Example

Pine ScriptTwo points joined by a lineOpen in editor
//@version=6
indicator("chart.point type: two points", overlay = true)
if barstate.islast
    a = chart.point.from_index(bar_index - 20, low)
    b = chart.point.now(high)
    line.new(a, b, color = color.blue, width = 2)

See also

Runs on Sidechair