- ago
when NextOptionExpiryDate is called on the same day as expiration it returns the same day instead of the next expiration day.
Example:
suppose SPX options expire on 1/18/2022. When you call NextOptionExpiryDate with a bar on that day it returns 1/18/2022. It should be the next one in February.

0
478
Solved
4 Replies

Reply

Bookmark

Sort
- ago
#1
This is a moot point IMHO.
0
Glitch8
 ( 10.94% )
- ago
#2
Hmmm, I think it's a matter of semantics. I could see folks expecting it to behave either way. Wouldn't call this a bug.
0
Cone8
 ( 24.99% )
- ago
#3
Since you know it works this way, just add a day to the date when calling the function.

CODE:
bars.DateTimes[idx].Date.AddDays(1).NextOptionExpiryDate(bars);
0
Best Answer
- ago
#4
Thanks. That works. I didn't know that you can use bars.DateTimes[idx].Date.AddDays(1).NextOptionExpiryDate(bars);
instead of bars.NextOptionExpiryDate.

0

Reply

Bookmark

Sort