Creates a chart point from a bar index and a price, with the time left empty.
The point works with drawings placed by bar index, which is the default xloc. Its time field is na, so it cannot place a drawing by timestamp.
It suits swings, where you know the bar offset and the level: chart.point.from_index(bar_index - 5, ph).
Syntax
chart.point.from_index(index: series int, price: series int/float) -> chart.pointArguments
| Name | Type | Default | Description |
|---|---|---|---|
| index | series int | required | Bar index of the anchor, such as bar_index - 5 for a swing five bars back. The point's time is left na. |
| price | series int/ | required | Price level of the anchor, such as a pivot value. It is the y value drawings use for this point. |
Returns
chart.point: A new chart.point with a bar index and a price.
Example
//@version=6
indicator("chart.point.from_index: pivot", overlay = true)
ph = ta.pivothigh(high, 5, 5)
if not na(ph)
p = chart.point.from_index(bar_index - 5, ph)
label.new(p, "H", style = label.style_label_down)See also
Runs on Sidechair