Skip to main content
simul8or Chart Patterns Daily Runners
Get 12 free shares worth up to $3,60012 free sharesAD
WelcomeGuest Trader
MARKETSLoading…
Free & open source · v4.1

JavaScript Stock Charts

The chart that runs the simul8or trading simulators, free for your site. Candles, 79 indicators, drawing tools and live data in one library with zero dependencies.

202 KB zip · Works with any data feed · Mouse and touch

Version
4.1
Dependencies
None
Rendering
HTML canvas
Themes
Dark + light
Price
Free
Connecting

Live demo

Real-time prices from Hyperliquid's free public API. No key needed. Scroll zoom Drag pan CtrlZ undo a drawing
Released November 2026

What's new in v4.1

79 indicators in a searchable picker, on top of v4.0's full drawing toolbar.

79 indicators

Search them by name, browse by category and star your favorites. Add the same moving average as many times as you like.

Volume profile

See where the volume traded for the bars on screen or for each session, with the point of control and value area marked.

Hide, tune or remove

Every indicator gets its own legend line. Hover it to hide the line, change its inputs and colors, or take it off the chart.

Supertrend to Ichimoku

Trend stops, channels, pivots, Williams Alligator and Fractals, Zig Zag and 20+ new oscillators like TSI, Vortex and Klinger.

Live examples

Any market, either theme

Both charts below are streaming real prices right now, from the same few lines of code shown further down.

Capabilities

Key Features

Everything you need for stunning financial visualizations.

Multiple Chart Types

Candlestick, line charts, and more with a single click.

Interactive Controls

Intuitive drag to pan, scroll to zoom, and touch controls.

Responsive Design

Automatically adapts to any screen size or device.

Dark/Light Mode

Built-in theme switching with a single click.

High Performance

Optimized canvas rendering for large datasets.

Fullscreen Mode

Expand your charts to fullscreen with a single click.

Developer Guide

Quick Implementation

1Installation
index.html
<link rel="stylesheet" href="stock-chart.css">
<script src="indicators.js" defer></script>
<script src="patterns.js" defer></script>
<script src="emoji-data.js" defer></script>
<script src="stockchart.js" defer></script>
2HTML Container
index.html
<div id="chart-container" style="width: 100%; height: 400px;"></div>
3Initialize the Chart
chart.js
// Sample OHLC data
const data = [
  { t: 1675209600000, open: 180.68, high: 187.12,
    low: 179.26, close: 185.38, volume: 4235600 },
  // ... more data points
];

// Initialize chart
const chart = new StockChart('chart-container', {
  data: data,
  ticker: 'AAPL',
  darkMode: true
});
4Stream Live Prices

The demos on this page use Hyperliquid's free public crypto API. No key or account needed. Load recent candles, then keep the last one updating:

live.js
const API = 'https://api.hyperliquid.xyz';
const toBar = c => ({ t: c.t, open: +c.o, high: +c.h, low: +c.l, close: +c.c, volume: +c.v });

// 1. Last 300 one-minute BTC candles
const res = await fetch(API + '/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ type: 'candleSnapshot', req: {
    coin: 'BTC', interval: '1m', startTime: Date.now() - 300 * 60000, endTime: Date.now() } })
});
const chart = new StockChart('chart-container', {
  data: (await res.json()).map(toBar),
  ticker: 'BTC', timeframe: '1min', chartType: 'candlestick', darkMode: true
});

// 2. Live updates over a WebSocket
const ws = new WebSocket('wss://api.hyperliquid.xyz/ws');
ws.onopen = () => ws.send(JSON.stringify({ method: 'subscribe',
  subscription: { type: 'candle', coin: 'BTC', interval: '1m' } }));
ws.onmessage = e => {
  const msg = JSON.parse(e.data);
  if (msg.channel !== 'candle') return;
  const bar = toBar(msg.data), data = chart.stockData, last = data[data.length - 1];
  if (last && last.t === bar.t) Object.assign(last, bar);
  else {
    data.push(bar);
    if (chart.isViewPinnedToRightEdge)   // keep the newest candle in view
      chart.config.dataOffset = Math.max(0, data.length - chart.config.visibleCandles);
  }
  chart.calculateIndicators();
  chart.drawCharts();
};

Data Format

The chart library expects an array of objects with the following structure:

ohlc.json
[
  {
    t: 1675209600000,  // Timestamp in milliseconds
    open: 180.68,      // Opening price
    high: 187.12,      // Highest price
    low: 179.26,       // Lowest price
    close: 185.38,     // Closing price
    volume: 4235600    // Volume
  },
  // More data points...
]

Important: Data should be sorted chronologically with the oldest data points first.

Configuration Options

Customize your charts to fit your needs:

OptionTypeDefaultDescription
dataArray—Array of OHLC data objects (required)
tickerString'NVDA'Stock symbol to display
chartTypeString'line''line' or 'candlestick'
darkModeBooleanfalseEnable dark mode
timeframeStringauto'1min', '5min', '15min', '1hour', '1day' and more; detected from the data if left out
indicatorsObject—Indicators to start with, e.g. { volume: true, supertrend: true, rsi: true }. Keys for the newer ones are in StockChart.STUDIES
tickerLogoUrlFunction—Optional. symbol => url for a logo next to the ticker

Available Methods

chart.drawCharts()Redraw chart
chart.resizeCanvases()Resize canvases
chart.updateConfig(newConfig)Update options
chart.setIndicatorEnabled('vrvp', true)Turn an indicator on or off
chart.addMovingAverageInstance('ema', 50, '#f5b14a')Add a moving average
chart.destroy()Clean up
Get Started

Ready to create beautiful stock charts?

Get started with our chart library today.

Zero dependencies Works with any data feed Mouse and touch