year

The year of the bar being evaluated. A function of the same name also exists. The variable reads the current bar; the function reads whatever time you hand it.

year(series int time, series string timezone) → series int
ParameterTypeRequired
timeseries intyes
timezoneseries stringyes

Returns series int — A series int.

indicator("Bar year")
plot(year(time, syminfo.timezone))

See also sessions and intervals

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade