OpenHour

Category: Date and time

OpenHour is a function in ProBuilder language that retrieves the opening hour of the current bar, according to the user’s local time zone. This function is particularly useful for strategies that need to make decisions based on the time of day, such as day trading strategies that might focus on market open or close times.

Syntax:

OpenHour

Example:

iHour = OpenHour
if iHour = 9 then
    // Execute specific trading logic at 9 AM
endif

This example demonstrates how to use the OpenHour function to check if the current bar’s opening hour is 9 AM. If it is, the script executes specific trading logic, which could be tailored to take advantage of typical market behaviors observed at this time.

  • The OpenHour function returns an integer representing the hour the current bar opened, based on the 24-hour clock format.
  • It is crucial to consider the user’s local time zone setting in the trading platform, as this affects the output of OpenHour.

This function does not require any parameters and is straightforward to implement in any trading strategy that requires time-based decision making.

Related Instructions:

  • CurrentHour date and time
  • Hour date and time
  • Logo Logo
    Loading...