How to identify remaining days to expire for a traded instrument in a set — Tradetron Community
← Community

How to identify remaining days to expire for a traded instrument in a set

Keyword help 1,085 views

Varalkshmi E A

Hi,

I am looking for a reference to include the logic for identify the days to expire for traded instrument is <= 1, I would like to exit the positions tied to the set.

Regards,
Varalakshmi E A

Amit Pathak

use DayDifference Keyword

Tradetron Team Tradetron team

Use Days Difference (D2-D1) with today’s date and the traded leg’s expiry, in the Set Exit.

Days Difference (D2-D1)(Today('NSE'), Traded Instrument(Entry, expiry, <underlying>, 1, 1, 1)) <= Number(1)

  • Date 1 = today, Date 2 = the leg’s expiry. The result is Date 2 − Date 1, so it is positive before expiry and 0 on expiry day.
  • 1, 1, 1 = set 1, condition 1, leg 1. Change them to point at your leg.
  • Put it in the Set Exit of that set so only its positions are squared off.

Example

The leg expires on the 26th. On the 25th the keyword returns 1, so the exit fires on the 25th.

Note: this counts calendar days, so a weekend or holiday in between counts too. Test in Live Offline. Keyword reference: Keyword Documentation — Tradetron

:sparkles: Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.