getFirstBarIndexOfDay()
Previous Top Next
getFirstBarIndexOfDay( date [, symbol] )
Returns the bar index to the first bar for the date specified.
Parameters
date |
a valid date object (using "time" or "rawtime") |
symbol |
optional. the symbol to use |
Usage
function main() {
var nBarIndex;
var nTime;
var nPrice;
...
...
//get the rawtime value for the current bar
nTime = getValue( "rawtime", 0 );
if ( nTime != null ) {
//get the bar index to the first bar of the date in nTime
nBarIndex = getFirstBarIndexOfDay( nTime );
//grab the closing price from that bar
nPrice = close( nBarIndex );
}
}