The Year function in ProBuilder language is used to retrieve the year from a specific bar on a chart, based on its historical position relative to the current bar. This function is particularly useful for analyzing data across different years or identifying trends over an extended period.
Year[N]
Where N is the number of periods before the current bar. If N is 0, the function returns the year of the current bar.
// Retrieve the year of the bar exactly 10 periods before the current bar
myYear = Year[10]
This example assigns the year of the bar that occurred 10 periods before the current one to the variable myYear.
Understanding the Year function is essential for performing time series analysis in financial markets, allowing traders and analysts to segment data by year for seasonal or annual performance reviews.