Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

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)