Skip to content
Algo Trade Analytics Docs

last_bar_time - Pine Script Variable

Time in UNIX format of the last chart bar. It is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970.

int

series

  • Because the value can update on realtime bars, it may repaint when used for forward-looking logic.
  • Please note that using this variable/function can cause indicator repainting.
//@version=6
indicator("Last bar timestamp", overlay=true, max_labels_count=1)
if barstate.islast
label.new(bar_index, high,
str.format_time(last_bar_time, "yyyy-MM-dd HH:mm"),
style=label.style_label_left)