Vela, our next-generation charting platform, is live at vela.luxalgo.com.
LuxAlgo

Chart types and order flow

API reference for Footprint and TPO chart types, order-flow models, data engines, and aggregation helpers.

View as Markdown

This page documents the Footprint and TPO chart types and order-flow indicators, including their data models, data engines, and bar aggregation helpers.

Import symbols on this page from @luxalgo/vela-pro. Related guides: Chart types, Footprint, TPO.

Feature enablers for this area (enableFootprint, enableOrderflowIndicators, enableTpo) are documented on Enablers and options.

Functions

aggregateFootprints

Aggregate neutral Trades into per-bar BarFootprints: bucketing by time into bars and, within each bar, by price into aggressor-split levels. Pure and order-independent. Bars and levels come back ascending (by time, then price).

function aggregateFootprints(trades: readonly Trade[], opts: FootprintBucketOptions): BarFootprint[]

// Unexported supporting type referenced above
interface FootprintBucketOptions {
    bucketMs: number;
    priceTick: number;
    originMs?: number;
}

See also: BarFootprint, Trade.

aggregateSlices

Aggregate pre-aggregated FootprintSlices into per-bar BarFootprints. A slice belongs to the bar containing its open time; its levels re-bucket onto the display priceTick grid (slices carry a much finer grid, so this only ever merges). Exact: summing slice levels across a bar equals aggregating the underlying trades.

function aggregateSlices(
    slices: readonly FootprintSlice[],
    opts: FootprintBucketOptions,
): BarFootprint[]

// Unexported supporting type referenced above
interface FootprintBucketOptions {
    bucketMs: number;
    priceTick: number;
    originMs?: number;
}

See also: BarFootprint, FootprintSlice.

alignToChart

Align per-bar aggregates onto the CHART's bar times: cells[i] is the aggregate of chartTimes[i], or undefined where coverage is missing. This is the model pipeline's alignment contract: series payloads are INDEX-aligned to the chart's bars, so an indicator must emit exactly one entry per chart bar and never a value for a time the chart has no bar (extra leading entries render the whole series shifted). Aggregates outside the chart's bar set are dropped here.

function alignToChart(
    bars: readonly OrderflowBar[],
    chartTimes: readonly number[],
): Array<OrderflowBar | undefined>

See also: OrderflowBar.

buildCumulativeBars

Build the cumulative-delta CANDLES, one slot per chart bar (chart-aligned cells from alignToChart): each candle opens at the running total, closes at open + delta, and wicks to the intra-bar path extremes (the 'average' metric has no sub-bar path: its candles are honestly wickless). The running total resets to 0 on every anchor-period boundary ('all' never resets: the sum runs from the first covered chart bar). Uncovered bars (and, for the count-fed metrics, bars without counts) leave a HOLE in the array while the total carries through: an honest gap, never a fake flat candle, and never a compacted array (compaction is exactly the index shift this module exists to prevent).

function buildCumulativeBars(
    cells: readonly (OrderflowBar | undefined)[],
    times: readonly number[],
    metric: DeltaMetric,
    anchor: CumulativeAnchor,
): OHLCV[]

See also: CumulativeAnchor, DeltaMetric, OrderflowBar. From @luxalgo/vela/plugin: OHLCV.

buildRangeTails

Build the range's volume-tails read: bin every in-range footprint level onto a resolution-bin price grid (side volumes kept separate, overlap-distributed so volume is conserved exactly), then scan the SELL bins from the top and the BUY bins from the bottom until each side's accumulated volume reaches thresholdFrac of the range's total volume.

Returns null when the range holds no volume (not fetched yet, or nothing traded).

function buildRangeTails(
    slices: readonly FootprintSlice[],
    range: { start: number; end: number },
    resolution: number,
    thresholdFrac: number,
    nowMs: number,
): RangeTailsProfile | null

See also: FootprintSlice, RangeTailsProfile.

buildSessionVpDeveloping

The DEVELOPING structure: walk the session's slices in time order on the SAME final row grid the profile uses (stable rows: the developing lines never re-bin as later data widens the range) and emit one step per slice time with the POC and value area of everything traded so far. Steps come back ascending; empty when the session holds no volume.

function buildSessionVpDeveloping(
    slices: readonly FootprintSlice[],
    session: TpoSessionSpan,
    rowCount: number,
    valueAreaFrac: number,
): SessionVpDevelopingStep[]

See also: FootprintSlice, SessionVpDevelopingStep, TpoSessionSpan.

buildSessionVpProfile

Bucket one session's footprint levels by price. Only slices whose time falls in [session.start, session.end) count; each level's [price, price + tick) span distributes over the rows it overlaps, proportional to the overlap: total volume is conserved exactly, whatever grid the source served. The value area grows from the POC by repeatedly absorbing the larger adjacent row until it covers valueAreaFrac of the session's volume.

Returns null when the session holds no volume (not fetched yet, or nothing traded).

function buildSessionVpProfile(
    slices: readonly FootprintSlice[],
    session: TpoSessionSpan,
    rowCount: number,
    valueAreaFrac: number,
    nowMs: number,
): SessionVpProfile | null

See also: FootprintSlice, SessionVpProfile, TpoSessionSpan.

buildTpoVolumeProfile

Bucket one session's volume by price from the chart's bars. Only bars whose time falls in [sessionStart, sessionEnd) count; each bar's volume is distributed over the rows its high–low range overlaps, proportionally to the overlap, and split up/down by the bar's close direction: total volume is conserved exactly. The value area grows from the POC by repeatedly absorbing the larger adjacent row until it covers valueAreaFrac of the session's volume. Pure; the layer memoizes calls per profile against the bar array identity.

Returns null when the session holds no volume (or no bars).

function buildTpoVolumeProfile(
    bars: readonly OHLCV[],
    sessionStart: number,
    sessionEnd: number,
    rowCount: number,
    valueAreaFrac: number,
): TpoVolumeProfile | null

See also: TpoVolumeProfile. From @luxalgo/vela/plugin: OHLCV.

deriveTpoStructure

Derive the auction structure of one profile:

  • POC: the row with the most TPOs (tie → closest to the profile's price midpoint);
  • VA: classic two-row expansion around the POC until vaPercent of TPOs is covered;
  • IB: the price extent of blocks covering the first ibMinutes of the session;
  • singles: mid-profile rows with exactly one TPO whose run touches no extreme (extreme runs are tails/excess, not singles);
  • poor high/low: ≥2 TPOs printed at the very extreme row.
function deriveTpoStructure(profile: TpoProfile, vaPercent: number, ibMinutes: number): TpoStructure

See also: TpoProfile, TpoStructure.

footprintContextMenuAttachment

function footprintContextMenuAttachment(settingsSection: string): WidgetAttachment
ParameterTypeDescription
settingsSectionstringThe footprint tab's title in the chart settings dialog (the registered ChartTypeSettingsSection.title: what "Footprint Settings" opens).

From @luxalgo/vela/plugin: WidgetAttachment.

orderflowBarsFromSlices

Collapse footprint slices into per-bar OrderflowBars. Bars bucket on the [k·bucketMs + origin, …) grid (pass a chart bar's time % bucketMs as originMs so the aggregates land exactly on the chart's bars); the intra-bar delta paths walk the bar's slices in time order. Bars come back ascending.

function orderflowBarsFromSlices(
    slices: readonly FootprintSlice[],
    bucketMs: number,
    originMs?: number,
): OrderflowBar[]

Default: originMs = 0.

See also: FootprintSlice, OrderflowBar.

sessionAt

The session containing ms, or null when ms falls in a custom window's daily gap. Sessions are UTC-anchored: days at midnight, weeks on Monday, months on the 1st.

function sessionAt(kind: TpoSessionKind, ms: number, win?: TpoCustomWindow): TpoSessionSpan | null

See also: TpoCustomWindow, TpoSessionKind, TpoSessionSpan.

sessionsInRange

Every session INTERSECTING [from, to), ascending (bounded by cap, right-anchored).

function sessionsInRange(
    kind: TpoSessionKind,
    from: number,
    to: number,
    win?: TpoCustomWindow,
    cap?: number,
): TpoSessionSpan[]

Default: cap = Infinity.

See also: TpoCustomWindow, TpoSessionKind, TpoSessionSpan.

tpoContextMenuAttachment

function tpoContextMenuAttachment(settingsSection: string): WidgetAttachment
ParameterTypeDescription
settingsSectionstringThe TPO tab's title in the chart settings dialog (the registered ChartTypeSettingsSection.title: what "TPO Settings" opens).

From @luxalgo/vela/plugin: WidgetAttachment.

Classes

FootprintCache

A single-series cache of AGGREGATED order-flow footprints (never raw trades), keyed by bar open-time, plus the time ranges that have been fetched. Two write paths:

  • replace: authoritative aggregation for a fetched window (REPLACE the bars).
  • add: incremental accumulation (ADD into the forming bars).

The data engine owns one per chart: it fetches missing ranges as the user scrolls (REPLACE + markCovered) and folds in live slices, then hands materialize to the renderer. Coverage is tracked so a window fetches once.

class FootprintCache {
    readonly size: number;
    replace(fps: readonly BarFootprint[]): void;
    add(fps: readonly BarFootprint[]): void;
    markCovered(from: number, to: number): void;
    missingRanges(from: number, to: number): Interval[];
    materialize(): BarFootprint[];
    clear(): void;
}

// Unexported supporting type referenced above
type Interval = [number, number];
MemberTypeDescription
sizenumberNumber of cached bars.
replace()(fps: readonly BarFootprint[]) => voidAuthoritatively set the given bars (a complete aggregation for a fetched window).
add()(fps: readonly BarFootprint[]) => voidAccumulate the given (already-aggregated) bars into existing ones.
markCovered()(from: number, to: number) => voidRecord that [from, to) has been fetched (so missingRanges skips it).
missingRanges()(from: number, to: number) => Interval[]The sub-ranges of [from, to) not yet covered by a fetch (left → right).
materialize()() => BarFootprint[]All cached bars as sorted, materialized footprints (for the renderer).
clear()() => void

See also: BarFootprint.

FootprintDataEngine

class FootprintDataEngine implements SeriesDataEngine {
    start(host: SeriesDataEngineHost): void;
    onViewport(range: VisibleRange): void;
    onBars(): void;
    onSettings(values: Record<string, unknown>): void;
    suspend(): void;
    resume(): void;
    stop(): void;
}

// Unexported supporting type referenced above
interface VisibleRange {
    from: number;
    to: number;
}
MemberTypeDescription
start()(host: SeriesDataEngineHost) => void
onViewport()(range: VisibleRange) => voidThe visible range changed (pan/zoom) while the style is active.
onBars()() => voidA static chart's bars grew (a replay revealed its next bar): fetch it, keeping the planned range, and re-push. A live chart's new bars ride the slice subscription.
onSettings()(values: Record<string, unknown>) => voidThe footprint bag changed (dialog tab, context menu, a restored document). The engine has no use for the values itself (the layer reads the bag every frame); it is the per-chart observer of the hideCandles switch.
suspend()() => voidThe style left 'footprint': stop streaming; cache + coverage stay for an instant return.
resume()() => voidThe style returned: re-push the cache, resubscribe (catch-up heals the gap).
stop()() => voidThe chart is going away, or the engine is being replaced: release everything. Its host drops every push from here on.

From @luxalgo/vela/plugin: SeriesDataEngine, SeriesDataEngineHost.

TpoDataEngine

class TpoDataEngine implements SeriesDataEngine {
    constructor(opts?: { chrome?: boolean });
    start(host: SeriesDataEngineHost): void;
    onViewport(range: { from: number; to: number }): void;
    onBars(): void;
    onSettings(values: Record<string, unknown>): void;
    suspend(): void;
    resume(): void;
    stop(): void;
    hitProfile(time: number, price: number): TpoProfile | null;
    sessionGrid(): SessionGrid;
}

// Unexported supporting type referenced above
interface SessionGrid {
    at(ms: number): TpoSessionSpan | null;
    next(ms: number): TpoSessionSpan | null;
    prev(ms: number): TpoSessionSpan | null;
}
MemberTypeDescription
constructor(opts?: { chrome?: boolean })chrome: false for the overlay indicator: must not steal the chart-type engine's WeakMap slot (the merge context menu keys off it).
start()(host: SeriesDataEngineHost) => void
onViewport()(range: { from: number; to: number }) => voidThe visible range changed (pan/zoom) while the style is active.
onBars()() => voidA static chart's bars grew (a replay revealing its next bar): the profiles regrow up to the new data edge, and a bar opening a new session plans it. A live chart refreshes on its own timer instead.
onSettings()(values: Record<string, unknown>) => voidNew settings values from the chart-settings dialog (the type's SDK section). Also delivered once right BEFORE start() whenever stored values exist (a persisted config, a market switch recreating the engine): an engine must accept a pre-start call as pure configuration, so it never fetches on schema defaults the user has edited away.
suspend()() => voidThe style was left: pause fetching; the cache stays for a cheap resume.
resume()() => voidThe style was re-entered: re-push what the layer shows (nothing pushed while suspended reached it).
stop()() => voidThe chart is going away, or the engine is being replaced: release everything. Its host drops every push from here on.
hitProfile()(time: number, price: number) => TpoProfile | nullThe pushed profile under a chart point: the click must land inside the profile's session span AND its painted price extent, so empty chart areas keep the host's own context menu.
sessionGrid()() => SessionGridThe sync session-lookup surface for the current kind/window (merge math, the context menu's neighbor questions): calendar-driven when the market is.

See also: TpoProfile, TpoSessionSpan. From @luxalgo/vela/plugin: SeriesDataEngine, SeriesDataEngineHost.

Interfaces and types

AggressorSide

The taker (aggressor) side of an executed trade:

  • 'buy': the taker lifted the ask (bought into resting sell liquidity).
  • 'sell': the taker hit the bid (sold into resting buy liquidity).

This split is what separates a true footprint (bid/ask volume per price) from a plain volume profile. Each venue exposes it differently; sources normalize to this neutral value at their boundary.

type AggressorSide = 'buy' | 'sell';

BarFootprint

Order-flow detail for ONE bar, keyed to the bar's open time. A sidecar to the canonical OHLCV bar, never embedded in it: footprints are expensive to build, lazily fetched, and not available for every symbol, whereas OHLCV always is.

interface BarFootprint {
    time: number;
    levels: FootprintLevel[];
    buyVolume: number;
    sellVolume: number;
    delta: number;
    buyCount?: number;
    sellCount?: number;
}
MemberTypeDescription
timenumberBar open time, epoch ms: matches the corresponding OHLCV.time.
levelsFootprintLevel[]Price levels, ascending by price (low → high).
buyVolumenumberTotal buy-aggressor volume across all levels.
sellVolumenumberTotal sell-aggressor volume across all levels.
deltanumberbuyVolume - sellVolume for the bar.
buyCount?numberTotal per-side TRADE COUNTS across all levels: present iff the levels carry counts.
sellCount?number

See also: FootprintLevel.

CumulativeAnchor

Where a cumulative sum resets: a calendar period (UTC-anchored) or never.

type CumulativeAnchor = 'day' | 'week' | 'month' | 'all';

DeltaMetric

Which per-bar delta a cumulative series accumulates: raw volume delta, trade-count delta, or the delta of AVERAGE trade sizes (volume ÷ count per side: who trades bigger, not more; needs counts, like 'count').

type DeltaMetric = 'volume' | 'count' | 'average';

FootprintBatch

A footprint range response WITH a completeness signal: slices is everything the source can serve right now, and uncovered lists the sub-ranges of the REQUEST it could not (typically because a server is still back-filling them). Consumers that record coverage must mark it AROUND the uncovered ranges (never over them) and re-ask for those later; absent/empty uncovered means the response is complete.

interface FootprintBatch {
    slices: FootprintSlice[];
    uncovered?: ReadonlyArray<readonly [number, number]>;
    sliceMs?: number;
    servedFrom?: number;
}
MemberTypeDescription
slicesFootprintSlice[]
uncovered?ReadonlyArray<readonly [number, number]>Half-open [from, to) ms ranges of the request that are not served yet.
sliceMs?numberWidth (ms) of the WIDEST slice in the batch: the source's serving granularity for this request (a plan may floor it above the granularity asked for). A consumer bucketing slices into bars must refuse a batch coarser than its bar. Absent = unknown (an older source): callers assume the slices fit.
servedFrom?numberWhere the source actually began serving (epoch ms). Past the request's from when the source clamped the window (a span guard, a plan's lookback horizon): the part before it was never looked at, which is not the same as empty. Absent = served from from.

See also: FootprintSlice.

FootprintLevel

Executed volume at one price bucket within a bar, split by aggressor side.

interface FootprintLevel {
    price: number;
    buyVolume: number;
    sellVolume: number;
    buyCount?: number;
    sellCount?: number;
}
MemberTypeDescription
pricenumberBucket price: the low edge of the row (floor(price / priceTick) * priceTick).
buyVolumenumberVolume executed by buy-aggressors (ask lifts) at this level.
sellVolumenumberVolume executed by sell-aggressors (bid hits) at this level.
buyCount?numberTRADE COUNTS per side: in the venue's pinned trade unit. undefined = the source did not provide counts: distinct from a real 0. Counts aggregate exactly like volumes: re-bucketing sums them.
sellCount?number

FootprintSlice

One PRE-AGGREGATED footprint slice: buy/sell volume-at-price over a fixed one-minute window, timeframe-agnostic. The chart re-buckets slices into any bar duration, so a source never needs to know the chart's timeframe. This is the neutral order-flow unit a feed serves when it can't expose individual trades.

interface FootprintSlice {
    time: number;
    tick: number;
    levels: FootprintLevel[];
}
MemberTypeDescription
timenumberSlice open time, epoch ms (minute-aligned).
ticknumberThe price grid its levels sit on (display re-bucketing only ever merges).
levelsFootprintLevel[]Price levels, ascending by price.

See also: FootprintLevel.

OrderflowBar

One bar's order-flow aggregate: the per-bar unit every pane indicator reads. Counts follow the footprint contract: undefined means the source did not provide them, never a real zero, and one count-less contributing level poisons the whole bar's counts, so real and fake zeros never mix.

interface OrderflowBar {
    time: number;
    buyVolume: number;
    sellVolume: number;
    delta: number;
    buyCount?: number;
    sellCount?: number;
    deltaHigh: number;
    deltaLow: number;
    countDeltaHigh?: number;
    countDeltaLow?: number;
}
MemberTypeDescription
timenumberBar open time, epoch ms: matches the corresponding chart bar's time.
buyVolumenumber
sellVolumenumber
deltanumberbuyVolume - sellVolume.
buyCount?number
sellCount?number
deltaHighnumberExtremes of the RUNNING volume delta inside the bar (relative to the bar's open, which is 0), walked slice by slice in time order: the cumulative candle's wick material. A bar built from one slice degenerates to high = max(0, delta), low = min(0, delta): honest, without wicks.
deltaLownumber
countDeltaHigh?numberCount-delta path extremes: present iff the bar's counts are.
countDeltaLow?number

RangeTailsProfile

The full range read: both tails plus the range extent and equilibrium levels.

interface RangeTailsProfile {
    start: number;
    end: number;
    min: number;
    max: number;
    totalVolume: number;
    supply: TailsZone;
    demand: TailsZone;
    equilibrium: number;
    wEquilibrium: number | null;
    complete: boolean;
}
MemberTypeDescription
startnumber
endnumberExclusive range end.
minnumberPrice extent over every in-range level with volume.
maxnumber
totalVolumenumberTotal (buy + sell) volume in the range: the threshold's denominator.
supplyTailsZone
demandTailsZone
equilibriumnumberPlain range midpoint.
wEquilibriumnumber | nullMidpoint of the two weighted averages: null until BOTH tails reached.
completebooleanWhether the range lies fully in the past (a forming range keeps growing).

See also: TailsZone.

SessionVpDevelopingStep

One step of the DEVELOPING structure: the session's POC and value area as they stood once every slice up to time (inclusive) had traded. Prices, not rows: poc at its row's middle, vaLow/vaHigh at the value area's outer bounds.

interface SessionVpDevelopingStep {
    time: number;
    poc: number;
    vaLow: number;
    vaHigh: number;
}

SessionVpProfile

One session's volume-by-price profile, built from real footprint levels.

interface SessionVpProfile {
    sessionStart: number;
    sessionEnd: number;
    rowH: number;
    rows: SessionVpRow[];
    maxTotal: number;
    poc: number;
    vaFrom: number;
    vaTo: number;
    complete: boolean;
    developing?: SessionVpDevelopingStep[];
}
MemberTypeDescription
sessionStartnumber
sessionEndnumberExclusive session end.
rowHnumberPrice height of one row.
rowsSessionVpRow[]Ascending by price; length = requested row count (a flat session yields 1).
maxTotalnumberLargest single-row total volume (normalization; > 0).
pocnumberIndex of the point-of-control (highest total-volume) row.
vaFromnumberValue-area row span, inclusive [vaFrom, vaTo].
vaTonumber
completebooleanWhether the session lies fully in the past (a forming profile keeps growing).
developing?SessionVpDevelopingStep[]The intra-session POC/VA evolution (see buildSessionVpDeveloping): attached by the indicator only while the developing display is on.

See also: SessionVpDevelopingStep, SessionVpRow.

SessionVpRow

One profile row: [price, price + rowH) with the aggressor-split volume in it.

interface SessionVpRow {
    price: number;
    buy: number;
    sell: number;
}
MemberTypeDescription
pricenumberThe row's LOWER price bound.
buynumber
sellnumber

TailsStep

One rung of a tail's accumulation ladder: the bin [lo, hi) and the cumulative side volume AFTER consuming it, as a fraction of the range's total volume.

interface TailsStep {
    lo: number;
    hi: number;
    frac: number;
}

TailsZone

One accumulated tail (supply from the top, demand from the bottom).

interface TailsZone {
    lo: number;
    hi: number;
    avg: number;
    wavg: number;
    steps: TailsStep[];
    reached: boolean;
}
MemberTypeDescription
lonumberZone price bounds: supply = [boundary, max], demand = [min, boundary]. Meaningful only when reached: an unreached tail consumed the whole range.
hinumber
avgnumberPlain midpoint of the zone.
wavgnumberVolume-weighted price of the consumed side volume (the zone's real center of mass). Falls back to the zone midpoint when nothing was consumed.
stepsTailsStep[]The accumulation ladder, outermost bin first, ending at the bin where the threshold was crossed (every scanned bin when it never was).
reachedbooleanWhether the accumulated side volume reached the threshold inside the range.

See also: TailsStep.

TpoCustomWindow

A custom DAILY session window, minutes from UTC midnight. end <= start wraps past midnight (an overnight session); start === end means the full 24h day.

interface TpoCustomWindow {
    startMin: number;
    endMin: number;
}

TpoProfile

One profile: the letter matrix plus its span anchors. Usually one session; a user-merged group of consecutive sessions folds into ONE profile spanning them all (the layer needs no merge awareness). Pushed by the data engine as TpoProfile[] (ascending by sessionStart) on the 'tpo' native-data channel. Structure (POC/VA/IB/singles/poor) is DERIVED from the matrix at paint time so structural settings never round-trip through the engine.

interface TpoProfile {
    sessionStart: number;
    sessionEnd: number;
    blockMs: number;
    blockCount: number;
    tick: number;
    rows: TpoRow[];
    open: number | null;
    close: number | null;
    complete: boolean;
    cellCounts?: boolean;
}
MemberTypeDescription
sessionStartnumber
sessionEndnumberExclusive session end (the next session's start for calendar sessions).
blockMsnumberOne block's duration (ms): the letter period.
blockCountnumberBlocks the session holds (fixed by span/blockMs, not by data coverage).
ticknumberRow height (price units).
rowsTpoRow[]Ascending by price.
opennumber | nullFirst traded price of the session (null while no data landed).
closenumber | nullLast traded price so far.
completebooleanWhether the session lies fully in the past (a forming profile keeps growing).
cellCounts?booleanWhether the rows' cell metrics carry meaningful TRADE COUNTS (buyN/sellN): false when any contributing footprint level lacked them, so a trades-count display can fall back honestly instead of showing zeros.

See also: TpoRow.

TpoRow

One price row of a profile. blocks holds the ASCENDING indices of the time blocks whose range touched this row: its length is the row's TPO count, and each index is the block's letter for the lettered display.

interface TpoRow {
    price: number;
    blocks: number[];
    cells?: TpoCellMetrics[];
}

// Unexported supporting type referenced above
interface TpoCellMetrics {
    buy: number;
    sell: number;
    buyN?: number;
    sellN?: number;
}
MemberTypeDescription
pricenumberRow bottom price (the row spans [price, price + tick)).
blocksnumber[]
cells?TpoCellMetrics[]Per-cell order-flow metrics aligned index-for-index with blocks: present only when the engine fetched the session's footprints (metric block coloring on, a footprint-capable provider). A cell the block's range touched but nothing traded in carries honest zeros.

TpoSessionKind

How bars group into one TPO profile.

type TpoSessionKind = 'day' | 'week' | 'month' | 'custom';

TpoSessionSpan

One session's time span, [start, end).

interface TpoSessionSpan {
    start: number;
    end: number;
}

TpoStructure

The derived auction structure of one profile (see deriveTpoStructure).

interface TpoStructure {
    poc: number | null;
    vah: number | null;
    val: number | null;
    ibHigh: number | null;
    ibLow: number | null;
    singles: number[];
    poorHigh: boolean;
    poorLow: boolean;
    total: number;
}
MemberTypeDescription
pocnumber | nullRow price of the Point of Control (highest TPO count), or null on an empty profile.
vahnumber | nullValue-area high: the TOP edge price of the highest VA row (row price + tick).
valnumber | nullValue-area low: the bottom edge price of the lowest VA row.
ibHighnumber | nullInitial-balance top edge (max touched price of the IB window + tick).
ibLownumber | nullInitial-balance bottom edge.
singlesnumber[]Row prices of MID-PROFILE single prints (runs touching an extreme are tails, not singles).
poorHighboolean≥2 TPOs at the profile's top row: an unfinished (poor) high.
poorLowboolean≥2 TPOs at the profile's bottom row: an unfinished (poor) low.
totalnumberTotal TPO count across the profile.

TpoVolumeProfile

One session's bucketed volume-by-price profile.

interface TpoVolumeProfile {
    rows: TpoVolumeRow[];
    rowH: number;
    maxTotal: number;
    poc: number;
    vaFrom: number;
    vaTo: number;
}
MemberTypeDescription
rowsTpoVolumeRow[]Ascending by price; length = requested row count (a flat session yields 1).
rowHnumberPrice height of one row.
maxTotalnumberLargest single-row total volume (normalization; > 0).
pocnumberIndex of the point-of-control (highest total-volume) row.
vaFromnumberValue-area row span, inclusive [vaFrom, vaTo].
vaTonumber

See also: TpoVolumeRow.

TpoVolumeRow

One profile row: [price, price + rowH) with the up/down volume that landed in it.

interface TpoVolumeRow {
    price: number;
    up: number;
    down: number;
}
MemberTypeDescription
pricenumberThe row's LOWER price bound.
upnumber
downnumber

Trade

One executed trade, neutral to any venue. The fundamental order-flow primitive: footprints, cumulative delta, and a time-&-sales tape are all aggregations of these.

interface Trade {
    time: number;
    price: number;
    size: number;
    side: AggressorSide;
}
MemberTypeDescription
timenumberExecution time, epoch ms.
pricenumberExecution price.
sizenumberTrade size in the base asset.
sideAggressorSideTaker side: 'buy' lifted the ask, 'sell' hit the bid.

See also: AggressorSide.

On this page