Methods

Core Methods

render ()

Renders the chart and initializes all components.


apexStock.render();

update (newOptions)

Updates the chart with new options while preserving state.


apexStock.update({
  series: [{ data: newData }],
  theme: { mode: "dark" },
});

destroy ()

Cleans up the chart instance and removes event listeners.


apexStock.destroy();

Theme Methods

updateTheme (newTheme)

Changes the chart theme.


apexStock.updateTheme("dark"); // or 'light'

getTheme ()

Returns the current theme.


const currentTheme = apexStock.getTheme(); // 'light' or 'dark'

Indicator Methods

updateIndicator (indicatorKey)

Adds or updates a specific indicator.


apexStock.updateIndicator("rsi");
apexStock.updateIndicator("moving average");

removeIndicator (indicatorKey)

Removes a specific indicator.


apexStock.removeIndicator("rsi");

Chart Configuration Methods

updateChartOptions (newOptions)

Updates chart options with theme handling.


apexStock.updateChartOptions({
  chart: { height: 800 },
  theme: { mode: "dark" },
});

Technical Analysis Methods

Moving Averages

calculateMovingAverage / calculateEMA

Calculate moving averages and exponential moving averages.


const ma = apexStock.calculateMovingAverage(series, period);
const ema = apexStock.calculateEMA(series, period);

Oscillators

calculateRSI / calculateMACD / calculateStochastic

Calculate various oscillator indicators including RSI, MACD, and Stochastic.


const rsi = apexStock.calculateRSI(series, period);
const macd = apexStock.calculateMACD(
  series,
  fastPeriod,
  slowPeriod,
  signalPeriod
);
const stochastic = apexStock.calculateStochastic(series, period, smoothPeriod);

Volatility Indicators

calculateBollingerBands / calculateStdDevIndicator

Calculate volatility indicators including Bollinger Bands and Standard Deviation.


const bb = apexStock.calculateBollingerBands(series, period, stdDev);
const stdDev = apexStock.calculateStdDevIndicator(series, period);

Volume Indicators

calculatePVT / calculateChaikinOsc

Calculate volume-based indicators including Price Volume Trend and Chaikin Oscillator.


const pvt = apexStock.calculatePVT(series);
const chaikin = apexStock.calculateChaikinOsc(series, shortPeriod, longPeriod);

Trend Indicators

calculateADX / calculateCCI / calculateTSI

Calculate trend indicators including ADX, CCI, and TSI.


const adx = apexStock.calculateADX(series, period);
const cci = apexStock.calculateCCI(series, period);
const tsi = apexStock.calculateTSI(series, longPeriod, shortPeriod);

Advanced Indicators

calculateIchimoku / calculateFibonacciRetracements / calculateLinearRegression

Calculate advanced indicators including Ichimoku, Fibonacci Retracements, and Linear Regression.


const ichimoku = apexStock.calculateIchimoku(series);
const fibonacci = apexStock.calculateFibonacciRetracements(series);
const linearReg = apexStock.calculateLinearRegression(series, period);