Sidechair

last_bar_time

Browse the reference

The opening time of the last bar on the chart, in milliseconds since 1970-01-01 UTC.

Try it in the editor

last_bar_time is a series int that holds the same timestamp on every bar. It is the time value of the newest bar, so time == last_bar_time is true only on that bar.

Type

series int

Remarks

  • Compare it with timenow to see how old the newest bar is.
  • On a live chart it is the open of the bar that is still forming, so its value moves forward each time a new bar starts.

Example

Pine ScriptHighlight the newest barOpen in editor
//@version=6
indicator("Newest bar", overlay = true)
bgcolor(time == last_bar_time ? color.new(color.orange, 80) : na)
plot((last_bar_time - time) / 60000, "Minutes behind", display = display.data_window)

See also

Runs on Sidechair