Date and time/probuilder · probacktest · proorder · proscreener

CurrentMinute

CurrentMinute returns the minute of the clock at execution time, 0 to 59, identical on every bar of the chart. Use Minute to read the minute of each bar's close.

Syntax

probuilder
CurrentMinute

How it works

CurrentMinute reads the clock at the moment the code runs and returns the minute within the current hour, from 0 to 59. 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 14:20 returns 20 on every historical bar. The per-bar sibling is Minute, which returns the minute of the close of each bar being processed and changes along the time axis. Session filters applied to historical data belong with Minute or TIME; CurrentMinute describes the wall clock now.

In a live ProOrder system CurrentMinute is meaningful, since the code executes in real time as bars arrive. In a backtest it reflects the minute the test runs, which makes it unsuitable for historical entry or exit conditions.

Examples

Example 1, Top-of-hour flag (Indicator)

probuilder
// Set the flag when the script executes in the first minute of an hour
IF (CurrentMinute = 0) THEN
    onTheHour = 1
ELSE
    onTheHour = 0
ENDIF
RETURN onTheHour

The indicator plots 1 across the whole chart when recalculated between minute 0 and minute 0 of the current hour, and 0 at any other point in the hour.

Example 2, Scan on a set minute (ProScreener)

probuilder
// Return matches only during the first half of the current hour
inFirstHalf = CurrentMinute < 30
SCREENER[inFirstHalf AND close > Average[20](close)] (close AS "Close")

The screener returns an empty list once the clock passes minute 30, a way to keep a scheduled scan quiet in the second half of each hour.

Example 3, Minute-aligned entry (ProOrder)

probuilder
// Only allow entries near the top of the hour
DEFPARAM CumulateOrders = false
readyToTrade = CurrentMinute <= 5
IF readyToTrade AND close CROSSES OVER Average[20](close) THEN
    BUY 1 CONTRACT AT MARKET
ENDIF

Live, the system only takes signals in the first five minutes of the hour. Backtests cannot exercise this branch meaningfully, because CurrentMinute holds the minute of the test run on every bar.

Common errors and gotchas

  • Same value on every bar. CurrentMinute describes the clock, not the chart, so a condition such as CurrentMinute = 0 is true or false for the entire calculation at once. Per-bar timing logic needs Minute or TIME.
  • Backtest blind spot. In a backtest CurrentMinute returns the minute the test executes, so filters built on it pass or block wholesale and produce results that do not match live behavior.
  • Market time zone, not local time. The minute is referenced to the instrument's market. Reading the clock does not adjust for the viewer's local offset.
  • No bracket offset. CurrentMinute[1] does not compile. Only per-bar constants such as Minute[N] accept an index.
  • Minute, minute of the close of each bar, the per-bar sibling of this constant.
  • OpenMinute, minute at the open of each bar.
  • CurrentHour, hour of the clock at execution time.
  • CurrentSecond, second of the clock at execution time.
  • CurrentTime, full clock time at execution as an HHMMSS integer.
  • CurrentYear, year of the clock at execution time.
  • TIME, closing time of each bar as an HHMMSS integer.
  • Timestamp, UNIX time of the close of each bar.