getPreviousTradingDay()

eSignal EFS 2

getPreviousTradingDay()

Top  Previous  Next

 

getPreviousTradingDay( date [, symbol] )

 

Returns a date object that contains the date of the prior 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 prior trading day, if any

 

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

 

               }

       }

 

 

}