Skip to content

High-Level Indicators

Stage 2 adds chart.addIndicator() and stack.addIndicator() — calculate via the async worker pool and render automatically.

Presets

PresetPlacementDefault options
rsioscillator paneperiod: 14
macdoscillator panefastPeriod: 12, slowPeriod: 26, signalPeriod: 9
bollinger / bollingerBandsprice overlayperiod: 20, stdDev: 2
emaprice overlayperiod: 20
smaprice overlayperiod: 20
stochasticoscillator paneperiod: 14, signalPeriod: 3

Single chart

typescript
import { createChart } from 'velo-plot/trading'

const chart = createChart({ container })
chart.addSeries({ id: 'ohlc', type: 'candlestick', data: ohlc })

await chart.addIndicator('bollinger', { period: 20, sourceSeriesId: 'ohlc' })
await chart.addIndicator('rsi', { period: 14, id: 'rsi' })

Stacked chart

typescript
import { createStackedChart } from 'velo-plot/trading'

const stack = createStackedChart({ container, panes: [pricePane, volumePane] })

await stack.addIndicator('rsi', { period: 14, pane: 'new' })
await stack.addIndicator('macd', { pane: 'new', paneHeight: 0.22 })
await stack.addIndicator('stochastic', { period: 14, pane: 'new' })

Options (AddIndicatorOptions)

PropertyTypeDescription
sourceSeriesIdstringPrice source (default: first line/candlestick/bar)
periodnumberLookback for RSI, SMA, EMA, Bollinger, Stochastic
fastPeriod / slowPeriod / signalPeriodnumberMACD parameters
stdDevnumberBollinger standard deviation multiplier
pane'inline' | 'new'Stacked only — append a new pane
paneHeightnumberFlex ratio when pane: 'new' (default 0.25)
idstringRoot series id
labelstringY-axis label for new panes

Return value

typescript
const result = await chart.addIndicator('rsi', { period: 14 })
// { id: 'rsi', preset: 'rsi', placement: 'oscillator', seriesIds: ['rsi-line', ...] }

Low-level helpers

typescript
import {
  addIndicatorToChart,
  buildIndicatorPaneFromPreset,
  computeIndicatorFromSeries,
} from 'velo-plot/trading'

const computed = await computeIndicatorFromSeries(chart, 'macd', { sourceSeriesId: 'ohlc' })
const pane = await buildIndicatorPaneFromPreset('rsi', x, close, { id: 'rsi', height: 0.24 })

Calculations use the Stage 1 worker pool when available. See also Async Indicators and Composite Indicator Panes.

Known limitations

  • Bundle entry — pick velo-plot, velo-plot/trading, velo-plot/scientific, or velo-plot/full. See Bundle Architecture.
  • WebGPU renderer (renderer: 'webgpu') requires an extended bundle entry and is experimental — use WebGL (default) for production.
  • SVG export (exportSVG()) is unavailable on core-only imports and partial elsewhere; see Stage 6 SVG parity.
  • See Plugin status registry for plugin maturity (complete, partial, experimental).

Released under the MIT License.