pinescript, in chart.point.new time, index, price does index is back from current of…
- User
pinescript, in chart.point.new time, index, price does index is back from current of from 0 to current which is newest
Assistant
In Pine Script, when using
chart.point.new(time, index, price), theindexparameter refers to the bar index, which is zero-based and starts from the leftmost bar on the chart (oldest bar = index 0), and increases toward the right (newest bar = highest index).So:
index = 0→ the first (oldest) bar on the chart.index = bar_index→ the current (newest) bar.
Summary:
- Not relative to the current bar (i.e., not "back from current").
- Absolute, starting from 0 at the leftmost bar.
Example:
//@version=5 indicator("Point Example", overlay=true) // Create a point at the current bar p = chart.point.new(time, bar_index, close) plotchar(na, "", "") // dummy plot to allow drawing
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.