GetDaysToExpiration

GetDaysToExpiration ();

Description

Returns the number of days till the expiration of the current option.

Example

declare hide_on_intraday;
input weeks = 4;
AddChartBubble(
GetDaysToExpiration() == 7 * weeks + 1,
high,
"Weeks till expiration: " + weeks,
Color.YELLOW,
yes
);
AddChartBubble(
GetDaysToExpiration() == 1,
high,
"Expiration Friday",
Color.RED,
yes
);

This script shows two bubbles on the option chart: the red one indicating the Expiration Friday and the yellow one indicating a bar four weeks prior to the Expiration Friday.