Sidechair

chart.left_visible_bar_time

Browse the reference

The timestamp, in milliseconds, of the leftmost bar on screen right now.

Try it in the editor

It has the input qualifier, so it is one value for the whole run, and the script runs again with a new value when the user scrolls or zooms. It is in the same units as time.

Pair it with chart.right_visible_bar_time to test whether a bar is in view, which keeps heavy drawing or accumulation to what the reader can see.

Type

input int

Remarks

  • On Sidechair: chart.left_visible_bar_time is not supported yet, and a script that names it stops with an error before it runs.

Example

Pine ScriptHighest high among the bars in viewOpen in editor
//@version=6
indicator("chart.left_visible_bar_time: visible range", overlay = true)
inView = time >= chart.left_visible_bar_time and time <= chart.right_visible_bar_time
var float hh = na
hh := inView ? (na(hh) ? high : math.max(hh, high)) : hh
plot(hh, "High in view")

See also

Not on Sidechair yet