CurrentTime
CurrentTime returns the clock time at execution as an HHMMSS integer, identical on every bar of the chart. Use TIME to read the closing time of each bar.
Syntax
CurrentTimeHow it works
CurrentTime reads the clock at the moment the code runs and returns the time of day as a six-digit integer HHMMSS, where HH is the hour, MM the minute and SS the second. A value of 073000 stands for 07:30:00. The reference is the time zone of the instrument's market, which may differ from the local machine. The constant takes no parameters and no bracket offset.
The value belongs to the Current family of date and time constants, which describe the moment of execution rather than any bar on the chart. Every bar of a calculation therefore sees the same number: an indicator refreshed at 07:30:00 returns 073000 on every historical bar. The per-bar sibling is TIME, which returns the closing time of each bar being processed and changes along the time axis. Session filters applied to historical data belong with TIME; CurrentTime describes the wall clock now.
Because the value is a packed integer, comparisons work naturally: CurrentTime >= 090000 is true from 09:00:00 onward. In a live ProOrder system CurrentTime is meaningful, since the code executes in real time as bars arrive. In a backtest it reflects the time the test runs, which makes it unsuitable for historical entry or exit conditions.
Examples
Example 1, Wake-up flag (Indicator)
// Set the flag when the script executes at exactly 07:30:00
IF (CurrentTime = 073000) THEN
WakeUp = 1
ELSE
WakeUp = 0
ENDIF
RETURN WakeUpThe indicator plots 1 across the whole chart when recalculated at 07:30:00 market time, and 0 otherwise.
Example 2, Scan inside session hours (ProScreener)
// Return matches only during the cash session
inSession = (CurrentTime >= 090000) AND (CurrentTime < 173000)
SCREENER[inSession AND close > Average[20](close)] (close AS "Close")The screener returns an empty list outside the chosen window, using the packed HHMMSS form for a clean range test.
Example 3, End-of-day shutdown (ProOrder)
// Stop the strategy near the close
DEFPARAM CumulateOrders = false
IF CurrentTime >= 173000 THEN
QUIT
ENDIF
IF close CROSSES OVER Average[20](close) THEN
BUY 1 CONTRACT AT MARKET
ENDIFLive, the system stops itself from 17:30:00 market time onward. Backtests cannot exercise this branch meaningfully, because CurrentTime holds the time of the test run on every bar.
Common errors and gotchas
- Same value on every bar. CurrentTime describes the clock, not the chart, so a condition such as
CurrentTime = 073000is true or false for the entire calculation at once. Per-bar session logic needsTIME. - Backtest blind spot. In a backtest CurrentTime returns the time the test executes, so time filters built on it pass or block wholesale and produce results that do not match live behavior.
- Exact match is fragile.
CurrentTime = 073000only holds for a single second. Range tests such asCurrentTime >= 073000are more reliable for gating logic. - No bracket offset.
CurrentTime[1]does not compile. Only per-bar constants such asTIMEaccept an index likeTIME[N].
Related instructions
TIME, closing time of each bar as an HHMMSS integer, the per-bar sibling of this constant.OpenTime, opening time of each bar as an HHMMSS integer.OpenTimestamp, UNIX time of the open of each bar.Timestamp, UNIX time of the close of each bar.CurrentHour, hour of the clock at execution time.CurrentMinute, minute of the clock at execution time.CurrentSecond, second of the clock at execution time.CurrentYear, year of the clock at execution time.
