getNextTradingDay()

ICE Data Services -

getNextTradingDay()
Previous  Top  Next

getNextTradingDay( date [, symbol] )
Returns a date object that contains the date of the next trading day when the current bar IS NOT in the most current trading day.

Parameters

date
a valid date object (using "time" or "rawtime")
symbol
optional. the symbol to use


Usage

function main() { 
var nBarIndex;
var nTime;
var nPriorDay;
var nPrice;
   ...
   ...

   
//get the rawtime value for the current bar
   nTime = getValue( 
"rawtime"0 );

   
if ( nTime != null ) {

      
//get the date value for the next trading day, if any
      nPriorDay = getNextTradingDay( nTime );

      
if ( nPriorDay != 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 );

      }
   }
}