Sidechair

timenow

Browse the reference

The current real-world time as a UNIX timestamp in milliseconds, read when the script runs.

Try it in the editor

timenow is a series int holding the wall-clock time of the run, in milliseconds since 1970-01-01 UTC. It is the same on every bar of one run, history included, so it is not a way to find when a bar printed. Use time for that.

Subtract a bar's time from timenow to find its age, or use it with last_bar_time to see how stale the newest bar is.

Type

series int

Remarks

  • The value moves forward each time the script runs again, which on a live chart means on every tick.
  • Do not use timenow to decide a historical signal: history would then depend on when you opened the chart.

Example

Pine ScriptAge of the newest barOpen in editor
//@version=6
indicator("Newest bar age")
ageMin = (timenow - last_bar_time) / 60000
plot(ageMin, "Minutes since newest bar open")

See also

Runs on Sidechair