The date of the trading session the current bar belongs to, as a UNIX timestamp at 00:00 UTC.
time_tradingday is a series int. All bars of one trading session share the same value: midnight UTC of the session's date. An overnight session that starts on the evening before belongs to the next calendar day, which is where this differs from the calendar date of time.
Compare it with its previous value to detect the first bar of a new session, or group bars by session with it.
Type
series int
Remarks
- time_tradingday[n] is na before the first bar.
- On Sidechair: the date comes from the session day of the chart's market, the same grouping that
session.isfirstbaruses.
Example
//@version=6
indicator("New trading day", overlay = true)
newDay = time_tradingday != time_tradingday[1]
plotshape(newDay, "New day", shape.diamond, location.abovebar, color.orange, size = size.tiny)
bgcolor(newDay ? color.new(color.orange, 85) : na)See also
Runs on Sidechair