Year

Category: Date and time

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.

Syntax:

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.

Example:

// 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.

Additional Information:

  • The Year function can only be used with time-based charts where each bar represents a specific date.
  • It is important to ensure that the chart data covers the period N periods before the current bar to avoid errors in retrieving the year.
  • This function returns an integer representing the year (e.g., 2023, 2022).

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.

Related Instructions:

  • CurrentYear date and time
  • OpenYear date and time
  • Logo Logo
    Loading...