Sidechair

chart.point.now()

Browse the reference

Creates a chart point at the bar being processed, priced at the close unless you pass a price.

Try it in the editor

The index and time fields come from the bar the script is running on, and the price is the close when no argument is given. It is chart.point.new(time, bar_index, close) in one short call.

Pass a price to keep the bar but choose the level: chart.point.now(high) anchors at the high of this bar.

Syntax

Pine Script
chart.point.now(price: series int/float (optional)) -> chart.point

Arguments

NameTypeDefaultDescription
priceseries int/floatclosePrice level of the point. When left out the current bar's close is used.

Returns

chart.point: A new chart.point on the current bar.

Example

Pine ScriptRay from the first close to the latest barOpen in editor
//@version=6
indicator("chart.point.now: to now", overlay = true)
var float startPx = na
if bar_index == 0
    startPx := close
if barstate.islast
    line.new(chart.point.from_index(0, startPx), chart.point.now(), extend = extend.right)

See also

Runs on Sidechair