Skip to main content
Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: global · Entries: 24

bar_index (variable)

Definition The index of the bar being evaluated. It is an int series rather than a float, and it changes bar by bar as a price does. Type series int Example

close (variable)

Definition The bar’s closing price. This is the value most calculations start from. On a bar that has not finished forming, the reading is that bar’s closing value so far. Type series float Example

dayofmonth (variable)

Definition The day of the month of the bar being evaluated. Type series int Example

dayofweek (variable)

Definition The day of the week of the bar being evaluated, as an int series. Sunday is 1 and Saturday is 7. Compare with dayofweek.sunday … dayofweek.saturday (same numbers) instead of memorising literals. Type series int Example

high (variable)

Definition The bar’s highest traded price. Pair it with low when you want the bar’s range; the difference between the two is a series like its parts. Type series float Example

hl2 (variable)

Definition The bar’s high and low, averaged: its midpoint. Supplied so you need not write the arithmetic. Four of these averaged prices exist. Each is a float series like the values it averages, so one can stand anywhere a price is wanted. Type series float Example

hlc3 (variable)

Definition The bar’s high, low and close, averaged. Type series float Example

hlcc4 (variable)

Definition The bar’s high, low and close with the close counted twice, averaged. The name records the weighting: four components, of which two are the close. Type series float Example

hour (variable)

Definition The hour of the bar being evaluated. Type series int Example

last_bar_index (variable)

Definition Bar index of the last bar on the chart (the rightmost bar), including the realtime tip when one is forming. Unlike bar_index, this value is the same on every bar in a run: it always points at the chart’s final bar. Type series int Example

last_bar_time (variable)

Definition Open time of the last bar on the chart, in UNIX milliseconds (same convention as time). Matches the timestamp of the rightmost bar, including the unconfirmed realtime bar when present. Type series int Example

low (variable)

Definition The bar’s lowest traded price. Type series float Example

minute (variable)

Definition The minute of the bar being evaluated. Type series int Example

month (variable)

Definition The month of the bar being evaluated. As with the other date parts, there is a function of the same name that takes a time and a timezone instead. Type series int Example

ohlc4 (variable)

Definition The bar’s four values, open, high, low and close, averaged with equal weight. Type series float Example

oi (variable)

Definition Open interest for the bar. It is 0, not na, where the bar carries no open-interest data. This single name is the whole of the open-interest surface. There is no open-interest namespace and no second name. Type series float Example

open (variable)

Definition The opening price of the bar your script is being evaluated on. It is a float series, so it moves on as the script advances through the chart. Type series float Example

second (variable)

Definition The second of the bar being evaluated. Seven date parts are available as variables. weekofyear is not among them: it exists as a function only. Type series int Example

time (variable)

Definition The bar’s opening time, as an int series. It counts milliseconds from the Unix epoch. Note the unit: it is milliseconds, not seconds, so anything expecting seconds needs the value divided by a thousand first. Hand it to one of the date functions - year, month, hour and the rest - together with a timezone to take it apart. Type series int Example

time_close (variable)

Definition The bar’s closing time, distinct from time. It is the opening time advanced by one interval, in the same unit: milliseconds from the Unix epoch. Both are int series, so a script can compare the two or pass either to a date function. Type series int Example

time_sessionday (variable)

Definition The UNIX time, in milliseconds, of the trading day the current bar belongs to. For instruments whose session starts the evening before, it gives the date the session is traded for rather than the calendar date of the bar. Type series int Example

timenow (variable)

Definition The current time, rather than a time taken from the bar. It is the instant the script ran, in milliseconds from the Unix epoch, and it is typed as a series like the bar’s own time values. Type series int Example

volume (variable)

Definition The volume traded in the bar. It is a float rather than an int, so it carries fractional volumes without a conversion. Type series float Example

year (variable)

Definition The year of the bar being evaluated. A function of the same name also exists. The variable reads the current bar; the function reads whatever time you hand it. Type series int Example