Three clocks answer different questions
Write the timer unit into the strategy specification. A bar count measures observed chart bars. A timestamp difference includes nights, weekends and holidays. A trading-day count follows session boundaries and must state what counts as day one. These definitions can produce different exits from the same entry.
- For an overnight session, midnight need not start a new trading day. On intraday charts, time_tradingday groups bars by the day on which their session ends.
- If the rule means exit at the end of the second session, use a session-end rule. The second day transition in this example is detected during the third observed trading day, not at the second session close.
- An exchange holiday with no bars produces no observed transition. A data outage can also hide a session, so this counter is not an independent exchange calendar.
| Clock | Definition used here | Boundary |
|---|---|---|
| Completed holding bars | Current bar index minus fill bar index plus one, evaluated at the close | The entry bar counts as one. Missing bars do not advance the count. |
| Elapsed minutes | (Bar closing timestamp minus entry-fill timestamp) / 60,000 | Closed-market time counts, but the script cannot evaluate a missing bar. |
| Trading-day transitions | Count observed changes of time_tradingday after the entry day | Friday to Monday is one transition when Monday is the next session, not three days. |