# Sessions & Key Levels

> UTC daily and weekly key levels (PDH, PDL, PDM, DO, PWH, PWL, WO) with swept state plus Asia, London, and NY session boxes.

Canonical page: [https://docs.kami.trade/studies/sessions/](https://docs.kami.trade/studies/sessions/)

`sessions` plots institutional UTC daily and weekly reference levels — Previous Day High/Low/Midpoint, Daily Open, Previous Week High/Low, and Weekly Open — tracks whether each level has already been swept, and shades intraday Asia, London, and New York session ranges.

## Parameters

| Parameter | Default | Range | Type | Timeframe overrides |
| --- | --- | --- | --- | --- |
| `window` | `500` | `60..2000` | integer | — |
| `showIntraday` | `1` | `0..1` | integer (`0` or `1`) | Drawn only on intervals `<= 1h` |
| `showWeekly` | `1` | `0..1` | integer (`0` or `1`) | — |

## Key Levels & UTC Boundaries

All boundaries are strictly UTC so every perp venue aligns to the same daily and weekly resets:

| Level | Meaning | Tone | Swept rule |
| --- | --- | --- | --- |
| `PDH` | Previous completed UTC day high | `'down'` | Current UTC day LTF high `> PDH` |
| `PDL` | Previous completed UTC day low | `'up'` | Current UTC day LTF low `< PDL` |
| `PDM` | Previous day midpoint `(PDH + PDL) / 2` | `'neutral'` | — |
| `DO` | Current UTC day `00:00` open | `'accent'` | — |
| `PWH` | Previous completed UTC week (Mon `00:00`) high | `'down'` | Current UTC week high `> PWH` |
| `PWL` | Previous completed UTC week (Mon `00:00`) low | `'up'` | Current UTC week low `< PWL` |
| `WO` | Current UTC week Monday `00:00` open | `'accent'` | — |

### Data-Source & Truncation Guards

- **HTF preference**: Uses supplied closed `1d` HTF candles (`source: 'htf'`) whenever at least `2` daily bars are available, falling back to aggregating LTF candles (`source: 'ltf'`).
- **No fabricated mid-day opens**: In LTF fallback mode, `DO` is emitted only if the LTF series actually reaches or precedes `00:00 UTC` of the current day; likewise `WO` requires Monday `00:00 UTC` coverage, and `PDH`/`PDL` require an earlier day to confirm the previous day was not truncated on the left edge.
- **Viewport price guard**: Level drawings are emitted only when inside `[ltfLo - boundAtr, ltfHi + boundAtr]` so distant historical weekly levels never squash the chart's Y-axis. All computed levels remain available in `facts.levels`.

## Intraday Session Boxes

When `showIntraday = 1` and the chart interval is `<= 1h`, Kami scans the last 24 hours (`lastT - 86_400_000`) for the latest active or completed session in each UTC window:

| Session | UTC Window |
| --- | --- |
| **Asia** | `00:00 – 08:00 UTC` |
| **London** | `08:00 – 13:00 UTC` |
| **NY** | `13:00 – 21:00 UTC` |

Each box renders as a faint neutral `zone` with a dashed 50% midpoint (`mid`).

## Drawings & Facts

- **Drawings**: In-bounds `level` lines (appending `✓` to swept levels, e.g. `PDH ✓`) plus up to `3` faint intraday session `zone` boxes.
- **Facts (`SessionsFacts`)**: `lastClose`, `levels[]` (`id`, `price`, `side`, `distanceAtr`, `swept`), `sessions[]`, and `source` (`'ltf' | 'htf'`).

## Activation

- **Studies menu**: `Sessions: PDH, PDL, DO, WO and Asia/LDN/NY` (`Sessions`)
- **Slash command**: `/sessions`
- **Chat phrases**: `sessions`, `session levels`, `pdh`, `pdl`, `pdm`, `pwh`, `pwl`, `daily open`, `weekly open`, `previous day high`, `asia`, `london`, `ny`
