getValue( barType, barIndex [, numBars] [, symbol] )
Returns the value of the specified type at the specified bar index relative to the bar currently being processed.
Parameters
barType
|
type of value to retrieve: "open", "high", "low", "close", "time", "rawtime", "volume", "oi", "year", "month", "day", "hour", "minute", "second"
|
barIndex
|
bar index of series to retrieve
|
numBars
|
optional. number of bars of data to return
|
symbol
|
optional. specify a symbol to use
|
Note: using getValue( "time" ) can be very processor-intensive and, for that reason, its use is not recommended. Instead you should use getValue( "rawtime" ) which returns the number of seconds elapsed since 1/1/1970, or the getYear(), getMonth(), getDay(), getHour(), getMinute(), getSecond() functions.
|
Usage
function main() {
...
...
//retrieve the close from 10 bars ago
myVar = getValue( "close", -10 );
//retrieve the rawtime of the current bar
myVar = getValue( "rawtime", 0 );
//retrieve the most recent 20 high values into an array
myArray = getValue( "high", 0, -20 );
}
|