getValue() Utility Functions
Returns the value of the specified type at the specified bar index relative to the bar currently being processed.
Syntax
getValue( barType [, barIndex ][, numBars ][, Symbol ] )
Parameters
Parameter: | Description: | Default: |
barType | Required. String for type of value to retrieve: "open", "high", "low", "close", "time", "rawtime", "volume", "oi", "year", "month", "day", "hour", "minute", "second" | n/a |
barIndex | [Optional] The number for the bar index (or beginning index) to retrieve. | 0 |
numBars | [Optional] Total number of bars of data to retrieve. | 1 |
Symbol | [Optional] String specifying a symbol to use, which may also include an interval (e.g., "IBM,5"). | chart symbol |
Return Value(s)
Returns a single value if numBars is not specified or is 1.
Returns an array of values if numBars is specified and greater than 1.
Notes
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 (see Series Functions).
Code Examples
function main(){ //retrieve the close from 10 bars ago var myVar = getValue( "close", -10 ); //retrieve the rawtime of the current bar var myVar = getValue( "rawtime", 0 ); //retrieve the most recent 20 high values into an array //where the [0] element of myArray contains the high at bar 0.
var myArray = getValue( "high", 0, -20 ); // more common method //retrieve the most recent 20 high values into an array //where the [0] element of myArray contains the high at bar -19.
var myArray = getValue( "high", -19, 20 ); // less common method
}
See Also
Utility Functions
eSignal Bulletin Board Search Engine
Help Guides and Tutorials