Sidechair

chart.point.copy()

Browse the reference

Returns a new chart point with the same index, time and price as an existing one.

Try it in the editor

Chart points are objects, so assigning one to another variable shares it. A copy breaks that link: edit the copy and the original stays as it was.

Take one before a script nudges a point that other drawings already use, for instance an anchor that is reused to build a channel.

Syntax

Pine Script
chart.point.copy(id: chart.point) -> chart.point

Arguments

NameTypeDefaultDescription
idchart.pointrequiredThe chart.point to duplicate. The copy gets its own index, time and price fields.

Returns

chart.point: A new chart.point.

Example

Pine ScriptGap between a frozen anchor and the closeOpen in editor
//@version=6
indicator("chart.point.copy: frozen anchor", overlay = true)
var anchor = chart.point.now(close)
frozen = chart.point.copy(anchor)
plot(close - frozen.price, "Gap from anchor")

See also

Runs on Sidechair