The expiry of a futures contract as a UNIX timestamp in milliseconds; na for symbols that do not expire.
syminfo.expiration_date is a simple int in UNIX time, milliseconds. It is the last trading date of the contract on the chart. Stocks, indices and spot pairs have no expiry, so it is na.
Subtract the current time and divide by 86400000 to count the days left, for example to fade a signal near expiry.
Type
simple int
Remarks
- On a continuous futures chart it follows the contract in force, and so moves forward at each roll.
- On Sidechair: not supported yet; a script that reads
syminfo.expiration_datestops with the error "syminfo.expiration_date" isn't supported yet.
Example
//@version=6
indicator("Days to expiry")
daysLeft = (syminfo.expiration_date - time) / 86400000
plot(daysLeft, "Days left", color.red)See also
Not on Sidechair yet