The CurrentTime function in ProBuilder language is used to retrieve the current time of the trading session in HHMMSS (hours, minutes, seconds) format. This function is particularly useful for strategies that need to execute actions based on specific times during the trading day.
Syntax:
CurrentTime
Example:
Below is a simple example demonstrating how to use the CurrentTime function to check if it is a specific time (07:30:00 AM) and set a variable accordingly:
IF (CurrentTime = 073000) THEN
WakeUp = 1
ELSE
WakeUp = 0
ENDIF
RETURN WakeUp
This script checks if the current time equals 07:30:00 AM. If true, it sets the WakeUp variable to 1, otherwise, it sets it to 0. The RETURN statement then outputs the value of WakeUp.
Additional Information:
- The CurrentTime function is essential for time-specific trading strategies, such as opening or closing positions at particular times of the day.
- Time is represented as a six-digit integer HHMMSS, where HH is the hour, MM is the minute, and SS is the second.
- Ensure that the trading platform’s server time aligns with the time zone expected in your trading strategy to avoid discrepancies.
Understanding and utilizing the CurrentTime function can significantly enhance the precision of trade execution based on time criteria within the ProBuilder environment.