tostrader994857
New member
Entered the code below, but chart label just says "N/A". I am trying to calculate implied stock move by obtaining atm put and call option prices. Then inputting a formula which is defined as "Y". But when i try to plot the value of Y, it just says "N/A", but the value of the ATMStrike is displayed.
Input ExpirationDate = 20240209;
input strikeDistance = 1; # change this value based on symbol , 5 for SPX, 1 for SPY etc.
def c = close(symbol = GetUnderlyingSymbol());
plot ATMStrike = Round(c / strikeDistance, 0) * strikeDistance;
def atmPut = close(GetATMOption(GetUnderlyingSymbol(), ExpirationDate, OptionClass.PUT));
def atmCall = close(GetATMOption(GetUnderlyingSymbol(), ExpirationDate, OptionClass.CALL));
def underlyingStockLastPrice = close(GetUnderlyingSymbol(), priceType = PriceType.LAST);
def move = (atmPut + atmCall - (ATMStrike - underlyingStockLastPrice));
plot Y = (move / underlyingStockLastPrice) * 100;
AddLabel(yes , "Closest Strike: " + ATMStrike + " ", Color.Gray);
AddLabel(yes , Y , Color.Gray);
Input ExpirationDate = 20240209;
input strikeDistance = 1; # change this value based on symbol , 5 for SPX, 1 for SPY etc.
def c = close(symbol = GetUnderlyingSymbol());
plot ATMStrike = Round(c / strikeDistance, 0) * strikeDistance;
def atmPut = close(GetATMOption(GetUnderlyingSymbol(), ExpirationDate, OptionClass.PUT));
def atmCall = close(GetATMOption(GetUnderlyingSymbol(), ExpirationDate, OptionClass.CALL));
def underlyingStockLastPrice = close(GetUnderlyingSymbol(), priceType = PriceType.LAST);
def move = (atmPut + atmCall - (ATMStrike - underlyingStockLastPrice));
plot Y = (move / underlyingStockLastPrice) * 100;
AddLabel(yes , "Closest Strike: " + ATMStrike + " ", Color.Gray);
AddLabel(yes , Y , Color.Gray);