Most structures put every leg in one expiry. Calendars and diagonals do not, and the engine supports them by letting each leg name its own. This page explains how that resolves and what it does not do.
The per-leg expiry selector. Two legs on different expiries is a calendar; different expiries and different strikes is a diagonal.
Why time is a position, not just a deadline
Every option is a bet on two things at once: where the underlying goes, and how much time is left. Buy and sell the same strike in two different expiries and you cancel most of the first bet and keep the second — you are trading time itself.
The near leg decays faster than the far leg. That difference is the whole position.
An analogy: two ice blocks, one small, one large, in the same room. Both melt. The small one melts faster. A calendar is selling the small one and buying the large one, and being paid for the difference in melting speed.
Expiry slots, not dates
Each leg row carries its own expiry selector: Wk 0, Wk 1, Wk 2, Mth 0, Mth 1.
These are slots, resolved against the entry day rather than fixed dates. Wk 0 is the nearest weekly expiry on or after that day; Wk 1 the one after; Mth 0 the nearest monthly.
That is what lets one rule run across years. A backtest across several years does not name a single contract anywhere — each cycle resolves its own legs from its own day. Fixed dates would give you one trade.
Same expiry, both legs → a vertical, a strangle, a condor. Different expiries, same strike → a calendar. Different expiries, different strikes → a diagonal.
The duplicate-leg guard understands this. The same strike and side is rejected inside one expiry — where it is just a doubled position, not a structure — but allowed across two, because that is the structure.
Do weekly slots exist on every index?
No, and the answer depends on the window. The archive labels each contract weekly or monthly and carries its expiry date, so the slots resolve out of the data rather than off a calendar we keep in step with the exchange.
| Underlying and window | What Wk 0 resolves to |
|---|---|
| NIFTY, or SENSEX on BSE, any window | The nearest weekly expiry on or after the entry day |
| BankNifty, FinNifty, MidcpNifty, before November 2024 | The nearest weekly expiry, as for NIFTY |
| The same three, after November 2024 | The nearest monthly expiry: weekly contracts were discontinued, so Wk 0 equals Mth 0 and Wk 1 equals Mth 1 |
| An F&O stock, any window | The nearest monthly expiry |
When a weekly slot falls back to a monthly, the result header carries a line saying the underlying has no weekly contracts in that window. A calendar built from Wk 0 and Wk 1 on BankNifty in 2025 is therefore a monthly-to-next-monthly calendar, not a weekly one. On the form, an underlying with monthly contracts only shows a note and its legs use Mth 0 and Mth 1.
What happens at the near leg's expiry
This is the part that decides whether a calendar backtest means what you think it means.
The position is not carried past the nearest leg's expiry. In a hold-to-expiry run the session window is truncated to the earliest expiry across all legs. On that day, both legs are squared off at your configured exit time and the trade reports TIME.
So the far leg is closed at market, at whatever it is worth that afternoon. It is never expired, never assigned, and never left running.
Three consequences worth stating plainly:
- There is no roll. The engine will not close the near leg and open the next one. Rolling is a decision, and the engine does not make decisions for you. What this measures is holding the structure to the near expiry — a narrower question than a rolled calendar programme, but one with an unambiguous answer.
- Margin is estimated once, at entry. It is not re-estimated as the structure changes. Read it as a pre-trade figure.
- Incomplete cycles are skipped, not half-run. If the window cannot reach the required expiry — usually the far leg running past the end of the archive — the cycle is skipped with a reason. A partially simulated calendar would be reporting a result for a trade that never finished.
The common misconception. "A calendar backtest tells me whether selling weeklies against a monthly works." It tells you whether one such structure, held to the near expiry, worked. The rolled programme — sell the next weekly, and the next — is a different strategy, and this measures a single leg of it.
Reading the controls
On each leg row, the expiry selector sits alongside side, lots, strike criterion, SL% and TP%. Its tooltip states the purpose directly: "Which expiry this leg trades. Put two legs on different expiries to build a calendar or a diagonal."
The panel footer repeats the division of responsibility, which is worth internalising: SL%, TP% and Trail act on that leg alone; the position stop and target act on the whole structure. On a calendar that distinction matters more than usual — a leg stop on the near leg leaves you holding a naked long in a further expiry.
Every other per-leg rule works normally across expiries. A leg's stop is a percentage of its own entry premium, so the far leg's stop is calculated on the far leg's price, not on the structure's net debit.
What mistakes do traders make?
Expecting the far leg to be held past the near expiry. It is closed with everything else on the near leg's expiry day.
Reading a calendar result as a rolled-calendar result. They are different strategies. This one has a defined end.
Putting a leg stop on one leg of a calendar without thinking about what remains. Cutting the short near leg leaves a long far leg — a completely different position from the one you tested. Consider Exit all legs when one fires if that is not what you want.
Assuming the margin figure updates. It is an entry-time estimate for the full structure.
Using Wk 2 or Mth 1 near the end of the archive. The far cycle may not fit inside the data, and those cycles are skipped — which can quietly shrink the sample. Check the trade count against the number of cycles you expected.
Next step
Open /backtest, build two legs at the same strike with Wk 0 and Wk 1, and run it. Then compare against the same structure with both legs in Wk 0 — the difference is what the time spread was actually worth. Read stops and targets before adding per-leg rules to a calendar.