Creates a chart point from a time, a bar index and a price you supply.
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
chart.point.new(time: series int, index: series int, price: series int/float) -> chart.pointArguments
| Name | Type | Default | Description |
|---|---|---|---|
| time | series int | required | Timestamp of the bar in milliseconds, as in the time variable. Used when a drawing is placed with xloc.bar_time. |
| index | series int | required | Bar index, as in bar_index. Used when a drawing is placed with xloc.bar_index, which is the default. |
| price | series int/ | required | Price level of the point. It is the y value that drawings use for this anchor. |
Returns
chart.point: A new chart.point.
Example
//@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