getOldestBarIndex()

ICE Data Services -

getOldestBarIndex()
Previous  Top  Next


getOldestBarIndex( [symbol] )

Returns the bar index of the oldest bar in the series. This will always return a negative integer value unless no data exists for the given symbol, in which case it will return null. If symbol is omitted, the symbol for the current chart it used.

Parameters

symbol
optional. the symbol to use


Usage

function main() {
var nBarIndex;

   ...
   ...

   nBarIndex = getOldestBarIndex();
   
if ( nBarIndex == null ) {
      
//there is no data for the currently-loaded symbol
   }
   
else if ( nBarIndex < 0) {
      
//we have data
      debugPrint( 
"There are currently " + Math.abs( nBarIndex ) + " bars loaded in the chart.\n" );
   }

}