Agentic Trading
Decisions

0021 — Active session windows ("trade like a session trader")

Status: Proposed (targeted for the next version)

Status: Proposed (targeted for the next version)

Context

Seyra is cron/tick-based, not real-time: the live runner wakes every context.barsInterval (floor 5m), reads the last closed bar, makes one decision, and sleeps. She is therefore always up to one bar late, and between ticks a position is unmanaged except by exchange liquidation (there are no resting protective orders yet — see the separate stop-order work).

Today the runner ticks 24/7 at that cadence. Real professional traders do not: most concentrate on a specific session — e.g. a few hours around the US equity/crypto open — and are flat or hands-off the rest of the day. Running an agent around the clock when the strategy's edge only exists in a 1–8 hour window wastes credit, takes trades in low-quality hours, and (for intraday strategies) carries overnight risk through long stretches where the agent is effectively blind between ticks.

Note: SkillSchedule.value (a cron expression) is currently vestigial in the live path — the runner aligns to barsInterval, not to the cron. This ADR also rationalises that: barsInterval governs cadence; the new window governs active hours.

Decision

Add an optional active session window to a Skill. When set, the runner only acts during the window and stands down outside it; cadence within the window is unchanged (still barsInterval).

Config shape (additive; absent ⇒ today's 24/7 behaviour):

activeWindow?: {
  days: ('mon'|'tue'|'wed'|'thu'|'fri'|'sat'|'sun')[]   // which days
  startUtc: string   // "13:30" 24h UTC
  endUtc: string     // "20:00" 24h UTC (may wrap past midnight)
  onClose: 'flatten' | 'hold'   // at window end: close everything, or keep positions
}

Runtime behaviour in the tick loop:

  • Outside the window: do not open new positions. Either skip the tick entirely (hold) or, once at the first tick after window end, flatten all positions and cancel working orders (flatten), then idle until the next window. Standing down is never a strategy "deviation" — it is independent of the leash.
  • Inside the window: normal evaluation (the discretionary overlay + the systematic core).
  • The agent is told, in context, that it is in a bounded session and how long remains — so near close it can wind down rather than open fresh risk it can't manage after the window.

UTC for v1 to match the existing cron convention; a display timezone label can be layered on later without changing the stored times.

Why this is the right shape

  • It matches how pros actually operate — "systematic rules inside a discretionary outer layer," run only during the session where the edge lives (see the agent-in-the-loop product note).
  • onClose: 'flatten' is a risk feature, not just convenience: it removes the overnight/inter-session window where the agent is blind between ticks, which is the most dangerous side effect of the cron model for intraday strategies.
  • Cost concentration: credit is spent on the hours that matter, not 24/7.
  • It makes day-trading horizons first-class and safe (flat outside the session), complementing the horizon-fit gating (scalping is still refused; the tick cadence cannot express it).

What it is NOT

Still bar-cadence, not real-time. The window decides when she is awake, not how fast she reacts. Inside the window she still decides at barsInterval (≥5m); she cannot react to the opening print or a headline in seconds. A future option — finer in-window cadence (cost is bounded to a few hours/day) — is left out of scope here.

Consequences

  • Schema: SkillSchedule (or context) gains the optional activeWindow. Absent ⇒ unchanged 24/7 behaviour, so all existing skills are unaffected.
  • Live runner: the tick loop adds an in-window check + a one-shot flatten at window close; idles efficiently outside the window.
  • Authoring: Seyra asks about session preference, maps the strategy horizon to a suggested window (e.g. a US-open day-trade ⇒ a few hours with flatten; a swing strategy ⇒ no window or a wide one with hold), and fills sensible defaults for novices. Tier affects only this authoring guidance, not runtime.
  • Backtest: the simulator must honour the same window so sim and live stay 1:1 — ticks outside the window are skipped and flatten is applied at close.
  • Supersedes the vestigial cron schedule.value for "when to act."

Honest limits

Trading a session does not create an edge; it concentrates an existing one and removes overnight blind-spot risk for intraday strategies. It is process discipline, not a profit mechanism.

On this page