← Rajandran R's posts

OpenAlgo Charts — A charting engine you actually own

View Original ↗

OpenAlgo Charts is a from-scratch, dependency-free HTML5-canvas charting engine: 13 chart types plus six transforms, 90+ indicators, 43 drawing tools, order flow, and live on-chart trading: 37 KB Brotli for the base engine, and nothing you don’t import.

Every trading app hits the same wall. The chart is the product, the place where the user spends the whole session, and yet it is the one piece most teams rent. You pick a vendor library, accept its licence, accept its bundle size, accept the features it decided you needed, and then spend weeks bending it into something that looks like yours.

OpenAlgo Charts starts from the other end. It is original code, written from scratch for the OpenAlgo ecosystem, with zero runtime dependencies and a permissive licence. You read it, fork it, ship it inside a commercial product, and nobody sends you an invoice for a seat.

What it is

One canvas pipeline per pane. No SVG, no DOM node per bar, no framework underneath, which is why the whole thing stays small and stays smooth when the data gets long. The time axis is gapless by default, so weekends, holidays and session breaks collapse instead of leaving dead space in the middle of your chart.

The library ships as six tiers you import separately: the base engine, indicators, drawing tools, transforms, profiles and order flow, and trading. Each tier registers itself into the base engine’s registries, so a feature you never import costs you exactly nothing. Everything together is 74.2 KB Brotli, and the budget is enforced in CI: there are no runtime dependencies to exclude from the measurement.

The feature tour

Chart types. Candles, hollow and volume candles, OHLC bars, high-low, line, line with markers, step, area, HLC area, baseline, columns and histogram. On top of those sit the transforms traders ask for by name: Heikin Ashi, Renko, Range bars, Line Break, Point & Figure with fixed, percent or ATR box sizing, and Kagi.

Indicators. Twenty built in: SMA, EMA, WMA, VWAP, Bollinger Bands, Supertrend, HalfTrend, Parabolic SAR, Ichimoku Cloud, RSI, MACD, Stochastic, ADX/DMI, CCI, MFI, ATR, William VIX FIX, Volume, OBV and A/D. The chart owns the whole lifecycle: pane placement, reference levels, fixed ranges like RSI’s 0 to 100, recompute on new data, teardown. Colour, opacity, thickness and line style come free on every plot, generated from the indicator’s own descriptor. Indicators whose input isn’t OHLCV (open interest, cumulative delta, anything from an external feed) get a separate contract built for exactly that.

Drawing tools. Forty-three of them: trend lines and rays, rectangles and ellipses, paths and curves, parallel and Fibonacci channels, retracements, extensions, time zones, speed fans, Gann fan and box, cyclic and sine lines, long and short position tools with risk/reward and risk-based sizing, price and date range measurers, text, callouts, flags, brush and highlighter. Anchors are stored as time and price, never pixels, so a drawing survives zoom, resolves inside collapsed session gaps, and still holds past the last bar. Magnet snap, per-anchor dragging, undo/redo where a whole drag counts as one step, and persistence are all in the box.

Profiles and order flow. Volume Profile, Market Profile (TPO), Footprint and cumulative delta: the analysis layer most open libraries simply don’t have.

Trading on the chart itself

This is the part that turns a chart into a terminal. Order, position and bracket lines with live P&L. One-click placement and drag-to-modify. OCO, validation, and a real order state machine behind it rather than a pile of callbacks. A depth-of-market ladder from 5 to 200 levels. And an analyzer mode, a sandbox where every action behaves exactly as it will live, but nothing leaves your machine until you arm it.

The data underneath is OpenAlgo-native: REST history plus WebSocket ticks with auto-reconnect and resubscribe, live candle aggregation, tick and volume bars, event markers for earnings, dividends and expiry, and one unified event bus for the lot. Any other broker fits behind a small data-feed adapter.

This is not a library looking for its first user. It runs inside the OpenAlgo open-source application itself, doing the heavy lifting for chart-based trading, custom technical indicators and drawing, across the 35+ brokers OpenAlgo now supports. Every rough edge gets found there first.

For developers: building on top

The design rule is registries, not switches. Chart types, indicators and drawing tools are all descriptors, so adding one is a registration, never a change to the core. Write your own indicator and it inherits the same settings UI, the same pane handling, the same styling controls as the built-ins. Write your own overlay against the primitive API and you are using the same interface that markers, trading lines and profiles are built on. There is no privileged internal layer you can’t reach.

The drawing layer is deliberately headless: placement, selection, dragging, snapping and undo are handled, but there is no toolbar and no dialog. You supply the chrome, in your own design language, and the engine never fights you for it.

Layouts are one JSON payload. A single call captures viewport, grid, panes, price scales, indicator instances and drawings; another restores them. Saved templates and per-user workspaces need no extra storage plumbing on your side.

And it is readable. A few thousand lines of commented TypeScript with a documented architecture, 620 unit tests across 50 files, strict typechecking, and a full docs site where every code sample on the page is a live chart running the real library. No minified vendor blob to reverse-engineer when something behaves oddly at 3am.

It teaches your AI assistant, too

The repository ships six agent skills: a reference hub with 18 deep-dive files covering the whole API surface and its foot-guns, plus task skills for scaffolding a chart, adding indicators, building a terminal, writing a plugin and debugging. One command installs them into Claude Code, Cursor, Codex, Copilot, Gemini CLI and the rest. Your assistant stops guessing at the API and starts using it.

If you trade or invest

You get a terminal that runs on your own data and your own machine. Your broker connection stays yours; your chart layouts stay on your disk. Study a setup with Renko or Point & Figure, mark it up with a Fibonacci retracement, size the trade with the position tool’s risk-based sizing, then place the order from the chart without switching windows, and rehearse the whole thing in analyzer mode first.

Because the profile and order-flow tier is included rather than sold as an add-on, volume profile, market profile and cumulative delta are simply there. So is the depth ladder. For anyone who has been paying a monthly subscription for exactly that shortlist, the arithmetic is worth doing.

If you run a small broker or a fintech business

Charting is usually the line item that decides whether a retail platform is viable. Per-seat licensing scales with your user count, which means your best growth month is also your worst margin month. An Apache-2.0 engine removes that coupling entirely: your charting cost is engineering time, not a function of how many clients you onboard.

It is also yours to brand. Themes, chrome and layout are all your code, so the terminal looks like your product rather than a vendor’s widget with your logo in the corner. Thirty-seven kilobytes for the base engine matters when your customers trade from mid-range phones on patchy mobile data. And when a client asks how the P&L on their screen was computed, you can show them the file, a conversation that is very hard to have about a closed dependency.

A small team can go from history endpoint to a branded, order-capable terminal without a procurement cycle, a sales call, or a renewal negotiation eighteen months later.

The licence, in plain English

Apache-2.0. Use it commercially. Modify it. Ship it inside a closed-source product. Keep your changes private if you want to. No per-seat fee, no revenue share, no non-commercial asterisk, no attribution gymnastics beyond keeping the licence and NOTICE file with the code and flagging files you changed. It also grants you a patent licence from every contributor, which is the clause your legal reviewer will actually care about.

What it does not give you is a warranty or a support contract; the code ships as is. For a piece of infrastructure you can read end to end, that is a reasonable trade.

Version 1.0.29 is honest about its gaps, and the README lists them: footprint and order flow need trade-by-trade data classified bid/ask, so it is live-session-only unless you add a tick recorder; most profile primitives are dark-tuned and need explicit colours on a light theme; percentage and indexed-to-100 price scales are not implemented; and the optional DOM chrome package (toolbar, dialogs, command palette, objects panel) is the next planned piece, so today that UI lives in the examples.

Getting started

Install it from npm with npm install openalgo-charts, then read the docs and click through the live example gallery at marketcalls.github.io/openalgo-charts.

The source, the architecture document and the runnable demos are at github.com/marketcalls/openalgo-charts.

If you are building something on it, whether an indicator, a plugin or a whole terminal, come and say so in the OpenAlgo community at openalgo.in/discord. That is where the roadmap gets decided.