GetATMOption

GetATMOption ( String optionType );

Default values:

optionType: OptionClass.CALL

Description

Returns the code of the option of the specified series, which has the strike price closest to the current market price. You can specify the series by defining underlying symbol, expiration date, and option type (Put or Call).

Input parameters

Parameter Default value Description
underlyingSymbol current symbol Defines symbol of the option.
yyyyMmDd - Defines expiration date of the option in the YYYYMMDD format.
optionType OptionClass.CALL Defines whether the option is Put or Call. This parameter accepts Option Class constants as value.

Example 1

input expirationDate = 20120421;
AddLabel(IsOptionable(), "ATM Call option is " + GetATMOption(GetUnderlyingSymbol(), expirationDate, OptionClass.CALL));

This script adds a chart label showing the code of the at-the-money Call option of currently chosen symbol with expiration date April 21, 2012.

Example 2

declare lower;
plot AprilATMPutPrice = close(GetATMOption(GetUnderlyingSymbol(), 20120421, OptionClass.PUT));

This script plots the Close price of the at-the-money Put option of currently chosen symbol with expiration date April 21, 2012.