hl2()
Previous Top Next
Return Value(s)
Notes
Code Examples
See Also
Previous Top Next
The hl2() function creates a series based on (high+low)/2 or retrieves individual (high+low)/2 values.
Syntax
Parameters
hl2( [ nBarIndex][, sym() | inv()] )
Parameters
Parameter: | Description: | Default: |
nBarIndex |
[Optional] Number of bar index of series to retrieve |
n/a |
sym() or inv() |
[Optional] Function of sym() or inv() to determine source for close values. |
n/a |
Return Value(s)
Returns a Series Object when nBarIndex is not specified.
Returns a single price value when nBarIndex is specified.
Notes
N/A
Code Examples
function main() {
//retrieve the value for the current price bar
myVar = hl2(
0
)
;
//retrieve the value for the previous price bar
myVar = hl2(
-1
)
;
//retrieve the current value for a specific symbol
myVar =hl2
(
0
,
sym("IBM")
)
;
//retrieve the current value for a specific symbol/interval
myVar =hl2
(
0
,
sym("IBM,5")
)
;
//retrieve the current value for a specific bar interval
myVar =hl2
(
0
,
inv(15)
)
;
//create a Series Object of the (high+low)/2 prices.
xSeries =hl2
()
;
//create a Series Object of the (high+low)/2 prices for a specific symbol.
xSeries = hl2(
sym("IBM")
)
;
//create a Series Object of the (high+low)/2 prices for a specific symbol/interval.
xSeries =hl2
(
sym("IBM,5")
)
;
//create a Series Object of the (high+low)/2 prices for a specific interval.
xSeries = hl2(
inv(15)
)
;
}
See Also