Month

Category: Date and time

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.

Syntax:

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.

Example:

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.

  • The Month function returns an integer between 1 (January) and 12 (December).
  • It is useful for performing operations that depend on the month, such as seasonal analysis or identifying trading patterns specific to certain times of the year.

This function does not require any specific market data but operates based on the date information associated with each chart bar.

Related Instructions:

  • CurrentMonth date and time
  • OpenMonth date and time
  • Logo Logo
    Loading...