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.

timenow - Pine Script Variable

timenow returns the current wall-clock timestamp in milliseconds since 1970-01-01 UTC. Unlike time, it reflects the actual moment the script executes, not the bar’s open or close.

  • Because timenow changes on every update, using it in realtime calculations may lead to repainting.
  • Useful for countdown timers or gating logic by absolute time (timenow >= targetTs).
  • It always reflects UTC-based milliseconds; convert to human-readable strings with str.format_time.
//@version=6
indicator("Wall-clock timestamp", overlay=false)
target = input.time(timestamp("UTC", 2024, 12, 31, 23, 59), "Deadline (UTC)")
secondsToTarget = (target - timenow) / 1000.0
plot(secondsToTarget, "Seconds until deadline", color=color.purple)
plot(0, color=color.gray)