The Yesterday function in ProBuilder language is designed to retrieve the date of the day preceding the bar that is N periods before the current bar. This function is useful for analyzing historical data relative to a specific point in time in the past. The date is returned in the YYYYMMDD format, which is a standard numerical format for representing dates.
Syntax:
Yesterday[N]
Where N is the number of periods before the current bar. If N is 1, the function returns the date of the day just before the current bar.
Example:
Suppose you want to find the date of the day before the bar that occurred 5 days ago:
dateFiveDaysAgo = Yesterday[5]
This line of code will store the date of the day preceding the bar 5 periods before the current bar into the variable dateFiveDaysAgo.
Additional Information:
- The function is particularly useful in back-testing scenarios where the analysis of conditions or events on specific past dates is required.
- Ensure that the value of N is within the range of available data to avoid errors.
- The function only considers trading days, skipping over non-trading days such as weekends or holidays, depending on the dataset’s configuration.
This function does not calculate or manipulate market data but simply retrieves historical date information, making it a straightforward yet powerful tool for date-based data analysis in financial markets.