Functions
year()
The year of a time you supply. Eight functions of this shape exist, each taking a time and a timezone, and both arguments are required. The variable of the same name reads the current bar instead.
Syntax
year(series int time, series string timezone) → series int
Arguments
time required series int The time to read. Required. An int in any form, so the bar's own `time` is accepted and so is a constant. timezone series string The timezone to read it in. Required. A string in any form; `syminfo.timezone` is the chart instrument's. Return Type
series int Example
indicator("Year Function Example", overlay=true)
// Get current bar year
currentYear = year(time)
// Plot year in Data Window
plot(currentYear, title="Current Year")