Hi it is currently saturday as I am writing this, and my problem is that the second line of code returns the ATM option contract but the third line of code does not, even though it is the same date. I am running this on symbol APA.
The error I get on the chart when trying to run this is:
Study1: Invalid value for days: 33
I assume I need to convert expdate+8 into a different format as it might be registering as another datatype? I am not sure. Could also due to it being a weekend but it works when I manually type in the date.
UPDATE:
Okay so the code does work but you have to refresh the chart. It still gives the error about invalid days not sure why but it kind of works now.
Code:
def expdate = getYYYYMMDD();
AddLabel(yes, GetATMOption(GetUnderlyingSymbol(), 20230114));
AddLabel(yes, GetATMOption(GetUnderlyingSymbol(), (expdate+8)));
The error I get on the chart when trying to run this is:
Study1: Invalid value for days: 33
I assume I need to convert expdate+8 into a different format as it might be registering as another datatype? I am not sure. Could also due to it being a weekend but it works when I manually type in the date.
UPDATE:
Okay so the code does work but you have to refresh the chart. It still gives the error about invalid days not sure why but it kind of works now.
Last edited by a moderator: