Built-in trading variables providing access to current and historical bar data
All variables support historical indexing (e.g., close[1] for previous bar, close[3] for the 3rd bar, etc.).
open
Opening price of the current bar
open number|ValueWithHistory Current bar's open price with historical access
local current_open = open
local prev_open = open[1]
local open_change = open - open[1]
high
Highest price of the current bar
high number|ValueWithHistory Current bar's high price with historical access
local current_high = high
local prev_high = high[1]
local high_breakout = high > high[1]
low
Lowest price of the current bar
low number|ValueWithHistory Current bar's low price with historical access
close
Closing price of the current bar
close number|ValueWithHistory Current bar's close price with historical access
volume
Trading volume of the current bar
volume number|ValueWithHistory Current bar's volume with historical access
Price Variables - Calculated
Derived price values calculated from OHLC data
Commonly used for technical analysis and indicator calculations.
hl2
Average of high and low prices Calculated as: (high + low) / 2
hl2 number|ValueWithHistory HL2 value with historical access
hlc3
Average of high, low, and close prices Calculated as: (high + low + close) / 3 Also known as "typical price"
hlc3 number|ValueWithHistory HLC3 value with historical access
hlcc4
Weighted average emphasizing close price Calculated as: (high + low + close + close) / 4 Gives double weight to the closing price
hlcc4 number: ValueWithHistory HLCC4 value with historical access