Skip to content

TJ Levels

Key price levels for the chart and the canonical level source for Engine A: session high/low, VWAP with ±1/2/3σ bands, session volume profile (POC / VAH / VAL), previous-day levels, naked levels, overnight session, initial balance, round numbers, RTH cash open AVWAP, prior week benchmarks, footprint microstructure, and universal swing/level zones. Version in the chart's indicator list (TJ Levels vX.Y.Z) always matches _version in Levels.cs.

What it draws

Group Series / Structures
Session H/L SessionHigh, SessionLow (CME 17:00 CT session model)
VWAP Vwap (Σ typical·vol / Σ vol, typical = (H+L+C)/3) + raw per-bar σ store (VwapStdDev, hidden)
VWAP bands VwapDev1Upper/Lower … Dev3Upper/Lower (multiplier-configurable)
Volume Vah, Val, Poc — intraday volume-profile levels
Previous day PdHigh, PdLow, PdVah, PdVal, PdPoc — flat per session
Naked NakedHigh, NakedLow, NakedPoc — persistent untouched-level magnets
Level zones 11 RangeDataSeries fills (± Zone Width ticks) around every level family
Session VA zones 3 RangeDataSeries fills (SessionVahZone, SessionValZone, SessionPocZone, ± width ticks) around session profile levels — v1.0.0
Overnight (ON) ON High, ON Low, ON Mid (17:00–08:30 CT Globex session) + frozen zones — v1.1.0
Initial Balance (IB) IB High, IB Low, IB Mid (15m, 30m, 60m) + 1.5x and 2.0x range extensions — v1.1.0
Round Numbers (RN) Zero-allocation psychological century & big-figure grid with Auto presets (NQ, ES, YM, RTY, CL, GC) — v1.1.0
RTH Cash Open AVWAP RthVwap (08:30 CT anchored VWAP) with Dev1 and Dev2 standard deviation bands — v1.2.0
Prior Week (PW) PriorWeekHigh, PriorWeekLow, PriorWeekPOC, PriorWeekVAH, PriorWeekVAL — v1.2.0
Footprint Microstructure (FP) Stacked Imbalances (300% ratio, 3+ stack) & Unfinished Auctions (extreme volume magnets + wick dots/tags) — v1.3.0
Universal TJZone Engine Universal support/resistance zones unified under TJZone with TJZoneFilterMask (21 families) — v1.4.0

UI Tab Organization (v1.4.2)

Settings are organized into two primary ATAS tabs using [Tab(TabName = ..., TabOrder = ...)]: - Data (Tab 0): Calculation parameters, period settings, swing thresholds, session models, and footprint filters (1. VWAP, 2. Volume, 3. Session, 4. Swing, 8. Overnight, 9. Initial Balance, 10. Century Marks, 11. RTH VWAP, 12. Prior Week, 13. Footprint). - Visualization (Tab 1): Visual styling, line pens, zone fills, marker sizes, opacity, and HUD options (4. Swing visuals, 5. Level Zones, 6. Session H/L Zones, 7. Session VA Zones, 8–13 visual settings, 99. Info).

Parameter groups

  • 1. VWAP ([Data]) — Show VWAP Levels (master) and per-band show toggles + multipliers for the three σ bands. Multiplier changes do a targeted O(B) rewrite of that band pair (no replay).
  • 2. Volume ([Data]) — Show Volume Levels (master: POC/VAH/VAL) and Value Area % (50–95, default 70; changing it forces a recalculation — it changes the data).
  • 3. Session ([Data]) — Show Session Levels, Show PD & Naked, and Naked Lookback Sessions (1–20, default 1: how many prior sessions accumulate in the naked queue; depth 1 reproduces the historic roll-overwrite exactly). PD & Naked are a sub-group of Session Levels — with Session Levels off they stay hidden regardless of the PD flag. The PD VAH/VAL/POC trio (and naked POC) belong to the Volume family (they follow Show Volume Levels). Visibility toggles are display-only since v0.8.0: every series always carries its real value; hiding a group flips the series' visibility channel (VisualType = VisualMode.Hide for value series — ValueDataSeries has no Visible setter — and RangeDataSeries.Visible for zones) and re-renders. Toggles never affect data, GetLevelsForBar, or Alpha Signal trading output. (v0.11.0: the Preset and Intraday Only parameters were REMOVED — Show PD & Naked took over the Intraday-Only display role with default true = the old default rendering; Show Swings & Zones is the master toggle of the 4. Swing group.)
  • 4. Swing ([Data] & [Visualization]) — swing period left/right, Leg Alignment (v0.13.0 — Any (default, no leg-direction filter) or Trend (the Mirror-V gate: a swing high's left legs must be bullish and its right legs bearish, a swing low is mirrored, and a doji leg vetoes the swing; since v0.13.1 ALL window candles are checked, including the trend candle (bar-1) — only the pivot candle itself stays unconstrained)), Include Reversal Candle VA, Zone Flip Bars (v1.0.0, 0–20, default 0 = disabled: sustained candle closes beyond an active zone flip its role with identical bounds until its next break), swing markers (Show Swings, Swing High/Swing Low pens, Marker Size, Extend Lines Right), zone visuals (Show Zones, support/resistance colors, Allow Overlap, Extend Zones Right, Show Broken Zones, Draw Zone Borders).
  • 5. Level Zones ([Visualization]) — Show Level Zones, Zone Width (ticks) — since v0.11.0 the total band width (width 4 = a 4-tick band) — and Zone Opacity % (0–100, default 30) applied to the per-family zone colours. Width changes rewrite only the zone bounds from the stored center lines.
  • 6. Session H/L Zones (v0.14.0 — DEFAULT OFF, [Visualization]) — Show Session H/L Zones (master; enabling it forces a full recalculation replay), and the per-family colors Session High Zone Color / Session Low Zone Color.
  • 7. Session VA Zones (v1.0.0 — DEFAULT OFF, [Visualization]) — Show Session VA Zones (master), Session VA Zone Width (ticks) (1–50, default 4: ± width ticks around the level), Session VA Zone Opacity % (0–100, default 30), and per-level fill colors: Session VAH Zone Color, Session VAL Zone Color, and Session POC Zone Color. Renders continuous bands around the session's cumulative VAH, VAL, and POC of the day, immune to intrabar repainting on forming bars.
  • 99. Info ([Visualization]) — Show Control Panel (the on-chart HUD master: five group toggle buttons, draggable; when off the HUD never consumes mouse input), Font (v0.12.0 — the HUD's text face/size/style; sub-property edits rebuild the HUD fonts live via RebuildFonts(), which scales the button font by HUDScale and keeps the title at scaled + 1 bold), Debug Mode, Calculating Badge Color (v0.10.0), and read-only Version / Copyright / Help / Changelog.

The control-panel HUD (v1.4.1 Modernization & Market Map Parity)

A middle-top, draggable panel with a 12-family 2x6 button grid covering all level families: - Row 1: VWAP, VOL, SESS, PD, SWG, VA-Z - Row 2: ON, IB, RN, RTH, PW, FP

Each button renders in its active family accent color when toggled ON, and dimmed gray when OFF.

Key UX features: - Interactive Hover-Box Tooltip Card: Hovering over any button displays a glassmorphic dark tooltip card showing the full family title, real-time [ACTIVE] or [OFF] badge, clear 2-line explanation, and click-to-toggle hint. - Market Map Header Button Parity: - Eye Button (IsLevelsHidden): Left of the minimize control. Clicking it toggles on-chart levels visibility (rendering a red diagonal slash overlay when hidden) while leaving the HUD active and accessible. - Minimize Button (_isMinimized): Toggles between the expanded 2x6 button view and a compact header bar with + / − glyphs. - Seamless Dragging: Moving the HUD via the title bar works consistently in both expanded and collapsed states. - Resizable: Drag either of the two diagonal corner grips (bottom-left / bottom-right) to scale all HUD dimensions via HUDScale (0.5–5.0). - Zero-Allocation: Rendered using pre-allocated fonts, pens, and static string buffers, passing ./audit.sh Check 7 with 0 hot-path heap allocations.

Universal TJZone Engine (v1.4.0)

TJ Levels serves as the universal level and zone provider for strategies and downstream indicators:

  • Universal TJZone Struct: Unifies discrete swing zones and continuous level zones into a single immutable struct, maintaining full backward compatibility with SwingZone inheritance.
  • TJZoneFilterMask (21 Families): High-resolution bitmask filter supporting granular family filtering:
  • Swing Zones, Session High/Low, Session VA (VAH/VAL/POC), Daily High/Low, Prior Day Levels, Overnight Benchmarks, Initial Balance & Extensions, Round Numbers, RTH VWAP & Bands, Prior Week Levels, and Footprint Microstructure (Stacked Imbalances & Unfinished Auctions).
  • Zero-Allocation Provider Pool: CopyActiveZones populates universal support/resistance buffers from a pre-allocated 256-slot synthetic zone pool with dynamic resize overflow protection.
  • Pairwise Confluence Engine: HasZoneConfluence evaluates multi-source intersection (≥ 1 tick overlap) on reaction candles, enabling qualification gates to verify confluence across multiple independent level providers.

Value Area (canonical, decision D1)

TJLevels.ComputeSessionVA expands outward from the running POC with two levels of lookahead per iteration (the next and next-next price level's volume on each side), ties prefer UP (volUp >= volDn), targeting totalVolume × VaPercent / 100. The profile is fed once per closed bar (watermark — forming bar excluded, tick re-calls idempotent) and kept as an incrementally-maintained sorted key list, so the expansion runs without a per-bar re-sort and the result is cached until the profile next mutates. ComputeSessionVA runs every bar (truthful-data rule from v0.8.0) — the cached pair returns on calls where nothing was ingested.

Naked levels (P0-8, decision D7)

  • Queue: fixed-capacity ring (≤ 3 kinds × 20 sessions). At each session roll the just-closed session's H/L/POC join the queue; entries older than the lookback are evicted. Persist-until-touched.
  • Touch test (per bar): the ±1-tick bar-overlap test (high >= level − tick and low <= level + tick) OR the traverse test — previous close on the opposite side while the bar reaches the level (high >= level && prevClose <= level, or the mirror) — so overnight gaps that open past a level kill it even with no bar overlap.
  • Exposure: the series/struct expose the newest active level per kind, falling back to older queued levels as newer ones are touched (single-value interface — only one magnet per kind is ever visible). Zero = no active level of that kind.
  • Exported by TJ Exporter as NakedPDH / NakedPDL / NakedPDPOC (Full mode).

Previous-day breach lifecycle (known behaviour, not a bug)

A PD level reads 0 after it is breached for the rest of the session: PDH/PDL/VAH/VAL breach when a bar closes beyond the level, POC breaches on a cross-and-close. The zero is the level's lifecycle state (it is no longer an active level), not a display effect — zones collapse with it, and GetLevelsForBar reports 0 exactly when the level is dead. Flags reset at the next session roll. PD data arrives asynchronously (platform fixed profile request); the response backfills the elapsed session range on the calc thread.

Swing zones

Fractal swing confirmation (N bars left / N bars right) registers a swing high/low; each swing creates a resistance/support zone from the trend candle's Value Area (footprint VA when available, else the candle body box) — optionally widened by the reversal candle's VA. A zone deactivates when a candle closes beyond its bound; breach flags are one-way. Zone IDs (R1, R2… / S1, S2…) are assigned at creation. Unless Allow Overlap is set, a new zone that overlaps an active same-side zone is skipped. With Leg Alignment = Trend (v0.13.0) the window legs must additionally carry the pivot's direction — a swing high's left leg must close above its open and its right leg below it (mirrored for a swing low, and a doji leg vetoes the swing) — which lowers the swing count further on renko, where brick ties already suppress most swing highs. Since v0.13.1 the trend candle (bar-1) is part of the left leg like every other window candle — a swing high's bar-1 must be bullish (mirrored bearish for a swing low); only the pivot candle itself stays unconstrained.

Zone Flip Re-Arm (v1.0.0)

When Zone Flip Bars > 0 (group 4. Swing, default 0 = disabled / immediate breach): - A candle close beyond an active zone does not immediately deactivate it. Instead, the zone accumulates consecutive closes beyond (BeyondStreak). - If price pulls back and closes inside or behind the zone before reaching Zone Flip Bars, BeyondStreak resets to 0. - Once sustained for Zone Flip Bars consecutive closes, the zone flips its role: - Resistance flips to Support (R1→S). - Support flips to Resistance (S1→R). - The price bounds remain identical, and FlipBar records the exact bar index of the flip. - Lifetime until next break: The flipped zone remains active and rendered in its new role's color until price sustains a close beyond its new boundary (the "next break"), at which point it terminates permanently. Lookahead bias is prevented in parent strategies (CopyActiveSupportZones / CopyActiveResistanceZones) by using FlipBar as the effective creation bar for the flipped role.

Continuous Session VA Zones (v1.0.0)

Configured under group 7. Session VA Zones (default OFF): - Draws continuous filled RangeDataSeries bands (SessionVahZone, SessionValZone, SessionPocZone) centered on the session's cumulative SessionVAH, SessionVAL, and SessionPOC of the day. - Band width is configurable via Session VA Zone Width (ticks) ($\pm x$ ticks around each level), with configurable opacity (default 30%) and individual color properties for VAH, VAL, and POC. - Zero Intrabar Repaint: The profile accumulation feeds strictly closed bars (bar < CurrentBar - 1 ? bar : bar - 1), so the session VA levels and their zones are 100% stable and never repaint on the live forming bar.

Session H/L zones (v0.14.0 — the probe's sessionhl family)

A second, event-born zone family mirroring the owner-proven offline probe (Backtesting/scripts/zone_strategy_probe.py v0.4.4, build_zone_arms_session) 1:1 through the pure single source TraderJan.Indicators/SessionVPairCore.cs. Per side (session HIGH = resistance SH#, session LOW = support SL#; CME 17:00 CT clock via GetCmeSessionKey):

  • Each session's first bar seeds the ratchet and creates no anchor.
  • A bar whose extreme strictly exceeds the running session extreme replaces or sets the pending anchor — the replaced pending never arms a zone (only the newest extreme's anchor does).
  • A strictly later bar that fails the ratchet (High < running session high; Low > running session low; ties do nothing) completes the "V" and the zone borns at that retreat bar with bounds = the combined Value Area of the anchor + retreat candles (SessionVPairCore.BirthBounds over the existing TryGetCandleValueArea — footprint VA with the body-box fallback, the same resolution the Exporter's CandleVAH/VAL columns feed the probe with); degenerate single-price bands floor U at L + tick.
  • A born-beyond birth (the retreat bar closes beyond its own band) is armed dead — it renders as an already-broken zone up to its birth bar and never becomes active (the probe's terminal born_beyond arm; no flip chain in v1).
  • Lifecycle = the swing-zone rules: deactivates on a close beyond the band (one-way flags via the shared ValidateActiveZonesCore), renders per Show Broken Zones / Extend Zones Right, and every completed V births a new zone (per-side ids SH1, SH2… / SL1, SL2…). No overlap dedup: like the probe, every completed V births. No flip re-arm in v1 (parity with swing zones; a GA-able gene later). Pending anchors never span the session roll (dropped at the boundary — zones themselves persist across rolls until breached).

Show Session H/L Zones is default OFF: at default settings the family costs one bool branch per bar, and the indicator, the embedded Alpha Signal child, and every recon/parity surface are byte-identical to v0.13.1. The family is self-contained — Alpha Signal's genome CLI carries no session-zone keys, and nothing but the family's own toggle turns it on. Additive parent hooks (the Zone Setup engine's session source uses exactly these, per the O-1 ruling — v0.14.1 additionally lets WalkZoneStep advance the family so parent reads are current regardless of the child-walk timing): CopyActiveSessionResistanceZones / CopyActiveSessionSupportZones and the SwingZone.ExtremeBar anchor reference.

Shared pure cores (single sources — never re-implement)

Core Serves
TJLevels.ComputeValueArea TJ Exporter v1.11.0 (SessionVAH/VAL columns) + the indicator's defensive self-heal path. Copy+sort wrapper around the sorted core.
TJLevels.ComputeValueAreaFromSorted The indicator's incremental VA path; the semantic reference for the expansion math.
TJLevels.ComputeVwapDevBand The per-bar series writer and the P1-2 targeted band rewrite (band math cannot drift between them).
TJLevels.NakedRoll / NakedProcessBar / NakedDerive The indicator's naked queue and the Exporter's naked columns.
TJLevels.TryGetCandleValueArea Zone creation and the Exporter's CandleVAH/CandleVAL columns.
TJLevels.ValidateZonesCore / ValidateActiveZonesCore / OverlapsExistingZone Zone validation + duplicate detection (work-set lists); ValidateActiveZonesCore (v0.14.0) is the shared breach core the Session H/L family reuses verbatim; also the headless test/benchmark harness.
SessionVPairCore.Step / BirthBounds The Session H/L V-pair family (v0.14.0) — the probe's build_zone_arms_session state machine and the zone_bounds band spec, test-pinned against a shared golden fixture.
TJLevels.IsValidLevelBar / ProfileStepCount Bounds and termination guards (pure, test-pinned).
TJLevels.ZoneHalfWidth / ZoneOpacityAlpha The level-zone band width (TOTAL ticks ÷ 2, single source for all 3 write sites) and the Zone Opacity % → alpha mapping (v0.11.0; pure, test-pinned).
TJLevels.RequiredLegPolarity / IsLegCandleAligned / IsLegAligned / AreLegsAligned The Leg Alignment direction gate (v0.13.0; v0.13.1 — every window candle incl. the trend candle is checked) — the single source for the swing-leg filter (pure, test-pinned).

Backtesting/engine/swing_zones.py mirrors the zone lifecycle from the Exporter's columns; pa_filters.py consumes the exported SessionVAH/VAL. Parity with the Exporter holds when its Value Area % matches (both default 70).

Embedded mode (Alpha Signal)

Alpha Signal embeds TJLevels as a child (IsEmbedded, SuppressOwnZoneWalk): the child skips its own zone walk and the parent drives it via WalkZoneStep(bar); RebuildSessionNow() re-seeds the child's session accumulators after a chart refresh (ATAS never re-walks an embedded child). The parent's only level read is GetLevelsForBar(bar) — truthful for any bar regardless of display settings — plus CopyActiveSupport/ResistanceZones for the zone filter and RenderZoneMarkers for delegated rendering.

Diagnostics (Debug Mode)

  • Per-walk timing — one line per completed recalculation pass, emitted from OnFinishRecalculate:

TIMING|bars=N|profile=X.Xms|write=Y.Yms (incl. va=Z.Zms)|naked=A.Ams|zones=B.Bms|total=T.Tms

write includes va (measured inside the session-series writer); total is profile + write + naked + zones (va not double-counted). Zero cost when Debug Mode is off; one string per finished walk when on. - Event lines: VWAP|live, VA|live, EVT|SWING, EVT|ZONE_C, EVT|ZONE_S, EVT|ZONE_B, PD/naked breach lines, session-commit lines; the Session H/L family adds EVT|SVPEND (pending set/replace/drop-at-roll), EVT|SZONE_C (birth; born-beyond carries note=born_beyond) and EVT|SZONE_B (breach) — v0.14.0. - CALCULATING... badge (v0.10.0, always on, color-configurable): shown top-left while a full recalculation walk is in flight (platform recalcs and the six data-changing setters). Cleared by OnFinishRecalculate, with a self-healing fallback that clears the badge when the walk reaches its final bar. Costs one bool check per frame when idle.

Files

  • TraderJan.Indicators/Levels.cs — the indicator (see _changelog for history).
  • TraderJan.Indicators/SessionVPairCore.cs — the Session H/L V-pair pure core (v0.14.0; Step state machine + BirthBounds, probe-parity).
  • TraderJan.Tests/TJLevelsTests.cs — D1–D10 NUnit suite (VA golden vectors, naked lifecycle, toggle invariance, bounds, guards).
  • TraderJan.Tests/SessionVPairTests.cs — SP1–SP4 NUnit suite (ratchet/replace/tie/ roll-drop state machine, birth bounds, shared breach core, probe-shared golden fixture Fixtures/shl_vpair_probe_golden.json, default-off proof).
  • Backtesting/scripts/make_session_vpair_golden.py — generates the golden fixture from the probe's sessionhl builder (regenerate after an approved probe change).
  • TraderJan.Tests/TJLevelsPerfBenchmark.cs — headless per-stage timing benchmark.
  • Initiative record: Projects/_closed/TJ Levels Correctness & Performance/; Zone Integration: Projects/Zone Strategy Probe/.

Level-gate time classes & dynamic swing legs (v1.7.0, 2026-11-09)

TJ Levels is the level provider for the Alpha Signal level gate. As of v1.7.0 the gate's swing / V-pair stepper runs with the genome's evolved Swing Period Left/Right and Include Reversal Candle VA (legs below the 2..10 floor fall back to 5/5) instead of fixed values. Levels are classed by the CME session in which they were created — the Intraday (lv_intraday) / Intraday+ (lv_prior) switches decide which classes the gate accepts — and lv_reject 0–3 selects the V-vertex rejection mode. Full gate semantics: docs/indicators/alpha-signal.md ("Level Gate time classes").