AddBusDays()

See Also   

Related Topics

 

 

Description

AddBusDays() adds business days to a date.

 

 

Syntax

AddBusDays(date, days)

 

 

Parameters

date

A date to which to you want to add business days.

 

days

A number representing the number of business days to add. This argument may be positive or negative. A positive value adds days. A negative value subtracts.

 

 

Return Value

A date representing the sum of the date and the number of business days.

 

 

Examples

WeekBeforeExpire(instrument)=begin

retval = FALSE

nWeekBefore = AddBusDays(instrument.expire, -5)

if instrument.date >= nWeekBefore then retval = TRUE

if instrument.date > instrument.expire then retval = FALSE

retval

end

 

This function returns TRUE if today is five business days before expiration. This function returns FALSE if today is more than five business days before expiration, or if today is past expiration.

 

 

Comments

This technique is ideal for use in alarms, for it "cleans itself up." If an alarm’s trigger condition is set to WeekBeforeExpire(NG#), and its Trigger When State is set to true, the alarm will trigger during the last five business days of the lead-month contract. Once expiration has passed, and first out month rolls to the lead month, the function evaluates false.