Variables
session.date
Returns the current session's date in YYYYMMDD format. This is useful when you want to detect new sessions, track day changes, or perform session-based calculations like resetting indicators or accumulating values per session.
Example
indicator("Session-based CVD (Fixed)", overlay=false)
// Persistent variable
static customCVD = 0
isNewSession = session.date != session.date[1]
// Reset on new session, accumulate otherwise
customCVD := isNewSession ? 0 : customCVD + orderflow.delta
plot(customCVD, title="Session CVD", style=plotStyle.line, color=color.orange)
Type
series string