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.

time_tradingday - Pine Script Variable

time_tradingday returns the timestamp for 00:00 UTC of the trading day that contains the current bar. This is especially useful on overnight markets where the session spans two calendar days.

  • Unlike time, this value always aligns to 00:00 UTC of the trading day, even if the session opens the prior evening.
  • On resolutions above "1D", the value corresponds to the final trading day captured inside the aggregated bar.
  • Useful for grouping bars by trading day or aligning session-based calculations across symbols.
//@version=6
indicator("Trading day comparison", overlay=false)
dayOfWeekExchange = dayofweek(time)
dayOfWeekTrading = dayofweek(time_tradingday, "UTC+0")
plot(dayOfWeekExchange, "Exchange day", color=color.blue)
plot(dayOfWeekTrading, "Trading day UTC", color=color.teal)
bgcolor(dayOfWeekExchange != dayOfWeekTrading ? color.new(color.orange, 85) : na,
title="Overnight session spillover")