Technical Indicators

ApexStock ships more than twenty built-in technical indicators. They fall into two groups: overlays, drawn directly on the price chart, and oscillators, rendered in their own panel below the main chart.

Overlays vs oscillators

  • Overlays share the price scale and sit on top of the candles. You can have several active at once.
  • Oscillators have their own y-scale and pane. Only one oscillator is active at a time; enabling a second replaces the first.

Enabling indicators up front

Declare which indicators are available (and enabled) through plotOptions.stockChart.indicators. Pass an object keyed by indicator name:

const apexStock = new ApexStock(document.querySelector('#chart'), {
  chart: { height: 600 },
  series: [{ name: 'ACME', data: candles }],
  plotOptions: {
    stockChart: {
      indicators: {
        'moving average': { enabled: true },
        'bollinger bands': { enabled: true },
        rsi: { enabled: false },
        macd: { enabled: true }, // the active oscillator
      },
    },
  },
})
apexStock.render()

Or pass an array of names to enable exactly those:

plotOptions: {
  stockChart: {
    indicators: ['rsi', 'macd', 'bollinger bands'],
  },
}

Toggling at runtime

Add or update an indicator with updateIndicator() and remove it with removeIndicator(), using the indicator key. Both preserve the current zoom state:

// Overlays stack — add several
apexStock.updateIndicator('moving average')
apexStock.updateIndicator('bollinger bands')

// Oscillators replace one another
apexStock.updateIndicator('rsi')
apexStock.updateIndicator('macd') // removes RSI, shows MACD

// Remove one
apexStock.removeIndicator('bollinger bands')

Indicator keys are case-insensitive.

Overlays

Drawn on the main price chart. Multiple allowed.

IndicatorKeyDescription
Moving Average"moving average"Simple moving average line
Bollinger Bands"bollinger bands"Upper, middle, and lower volatility bands
Exponential Moving Average"exponential moving average"EMA line with exponential weighting
Fibonacci Retracements"fibonacci retracements"0%, 23.6%, 38.2%, 50%, 61.8%, 100% levels
Linear Regression"linear regression"Linear regression trend line
Ichimoku Cloud Indicator"ichimoku cloud indicator"Full Ichimoku system with cloud and lines

Oscillators

Rendered in a separate pane below the chart. One active at a time.

OscillatorKeyDescription
RSI"rsi"Relative Strength Index (0-100)
MACD"macd"Moving Average Convergence Divergence with signal line
Volumes"volumes"Volume bars (needs v on the candles)
Price Volume Trend"price volume trend"Cumulative PVT
Stochastic Oscillator"stochastic oscillator"%K and %D lines
Standard Deviation Indicator"standard deviation indicator"Price volatility measure
Average Directional Index"average directional index"ADX trend strength
Chaikin Oscillator"chaikin oscillator"Volume-based momentum
Commodity Channel Index"commodity channel index"CCI overbought/oversold
Trend Strength Index"trend strength index"TSI momentum
Accelerator Oscillator"accelerator oscillator"Acceleration/deceleration of price
Bollinger Bands %B"bollinger bands %b"Position within the bands (0-1)
Bollinger Bands Width"bollinger bands width"Band width (volatility)

Indicators and volume

Volume-based indicators (Volumes, Price Volume Trend, Chaikin Oscillator) require a v value on each candle. See Data Format.

Indicators and streaming

When you feed live bars with appendData, every active overlay and oscillator updates incrementally instead of recomputing from scratch, so indicators stay exact as new data arrives.

Computing values without rendering

If you need the raw indicator series (for example, to drive your own UI or alerts) rather than a rendered pane, ApexStock also exposes the underlying calculation methods. See Computing Indicator Values.