The Month function in ProBuilder language is used to retrieve the month number from the date of a specific bar on the chart. This function is particularly useful for analyzing data or creating conditions based on monthly cycles or specific months of the year.
Month[N]
Where N is the index of the bar relative to the current bar. N can be 0 (the current bar), 1 (the previous bar), etc. If N is omitted, it defaults to 0.
lastMonth = Month[1]
IF lastMonth = 12 THEN
itWereChristmasMonth = 1
ELSE
itWereChristmasMonth = 0
ENDIF
RETURN itWereChristmasMonth
This example checks if the previous bar’s month was December (month 12). If it was, the variable itWereChristmasMonth is set to 1, otherwise, it is set to 0.
This function does not require any specific market data but operates based on the date information associated with each chart bar.