Back

VibeFox JS Trading — Demo

Quick start

Plain HTML

One-minute bars shown as 5-minute candles with the toolbar, the drawing toolbar, an EMA and an RSI pane; a local timer sends a live tick every half second. Scroll the wheel to zoom, drag to pan, pick a timeframe or a drawing tool.

Core concepts

Bars

Sixty daily bars written in the code ({ time, open, high, low, close, volume }), shown as days and resampled into weeks. Switch the timeframe with the buttons.

Events

The line above the chart is filled by the events crosshairMove and visibleRangeChange. Move the mouse over the candles, then zoom or pan.

Data and real time

Live updates

A local timer stands in for a real-time feed: addTick() every 200 ms, five seconds of market time per tick, so a new minute bar opens every 12 ticks and barClose counts it.

Markers

Buy and sell markers at bars, above or below the candles, with text and their own color. A click on a marker writes its text above the chart.

Replay

Replay starts 150 bars before the end and plays the history bar by bar. Pause it, step five bars, resume or stop (all bars come back).

Series and chart types

Series types

Pick any of the 14 series types in the list (SERIES_TYPES): candlestick, OHLC, line, area, baseline, histogram, Heikin Ashi, hollow and volume candles, and the built types.

Built chart types

Renko bricks of 0.5 with wicks, built from the time bars (the x axis is the sequence of bricks). Pick Kagi, Point & Figure, line break or range bars; the line above shows getChartTypeInfo().

Indicators

Adding indicators

A 50-period SMA and Bollinger Bands on the price pane, MACD in its own pane with the values in the pane legend and badges on the price axis. Drag the border between the panes to resize them.

Built-in indicators

Pick any of the 50 built-in indicators in the list; the previous one is removed. Overlays go to the price pane, oscillators to a pane of their own.

Your own indicators

A registered indicator "Mid line": the 30-bar SMA of (high + low) / 2, drawn in purple on the price pane like a built-in one.

Drawing tools

Tools

The drawing toolbar with all 48 tools by group; the trend line tool is already active. Click two points on the chart, then pick a Fibonacci, pitchfork or position tool from the toolbar and draw it.

Drawings from code

A dashed, locked trend line extended to the right, a Fibonacci retracement with labels, a parallel channel and a text, added with addDrawing(). Zoom or change the timeframe: the anchors are time and price.

Editing, selection and undo

A rectangle selected with its properties panel open (showDrawingProperties()). Change its color or line, drag the drawing or its handles, then press Ctrl+Z to undo.

Datafeed

Loading and errors

A datafeed whose first loads fail: after the retry the chart shows "Failed to load data" (event dataError). Click Reload to call reloadData().

MemoryDatafeed

The in-memory datafeed with three random symbols and live ticks every half second. Pick another symbol or timeframe in the toolbar; scroll to the left to load older history.

Symbol comparison

Two other symbols as lines over the main candles; the scale switched to percent, so every series starts at 0 % at the first visible bar. Pan the chart: the start moves with the view.

Scales, navigation and navigator

Scales and the visible range

A logarithmic price scale, session break lines and the last 200 bars set with setVisibleRange(). Drag the price scale up or down to zoom the price, double-click the chart to reset both scales.

Navigator and period buttons

The navigator under the chart shows the whole history with the visible range as a window, the period buttons show the last month. Drag or resize the window, or click 5D, 3M or All.

Volume profile

The volume by price levels of the visible range with the point of control. Zoom or pan: the profile is computed again for the new range.

Time zones and sessions

Four days of five-minute bars with the New York schedule: the pre- and post-market hours are shaded, dashed lines mark the session starts, VWAP restarts every trading day and the times are in the exchange zone. Pick another time zone in the list.

Alerts

Two price alert lines and an alert on the price crossing the SMA, checked on live ticks from a local timer that swings the price; every fired alert is added to the list above the chart. Drag an alert line to another price.

Terminal UI

The ready-made toolbar (symbol, timeframes, series type, indicators, comparison, alerts, undo / redo, settings, snapshot, fullscreen) and the drawing toolbar. Open Indicators to search and add one, or Settings to change colors and scales.

Watchlist and symbol search

A watchlist in two groups with the last price, the change and a sparkline, fed live by an in-memory datafeed. Click a row to switch the chart, or click the symbol in the toolbar to search.

Several charts and synchronization

A layout of four charts with one in-memory datafeed: three timeframes of BTCUSD and ETHUSD, the crosshair synchronized by time. Move the mouse over one chart; click a chart to make it active.

Trading from the chart

On the chart

A long position with stop loss and take profit, a buy limit order and a sell stop order, and the depth-of-market ladder; the broker is a small object in the code. Drag an order line to a new price, or click a price in the ladder to place an order.

MockBroker

The in-memory MockBroker fills a market buy at the live price of the chart and keeps the position P&L up to date on every tick. Use Buy / Sell, or the Trade button for the order ticket.

Backtests and strategies

A strategy

A moving-average crossover strategy run on the bars of the chart: trade markers with labels, the equity and drawdown panes. Open the report with the buttons: summary, trades, monthly results.

Export

Click Snapshot: getImage() makes the picture of the chart with the title strip and the OHLCV legend, shown under the chart (exportPNG() downloads the same picture).

Rendering and large data

100 000 one-minute bars, all on screen at once; the line above tells the renderer in use (WebGL on a GPU from 5000 visible bars, else canvas 2D). Zoom in with the wheel down to single candles.

Theming and styling

Themes

Pick a theme in the list above the chart: light, dark, high-contrast and the pack themes of vibefox-js-themes.css (paper, ocean, sunset, graphite-dark).

CSS variables

Blue and orange candles, no grid lines and a custom crosshair, set as --vfjs-trading-* CSS variables of this chart element; the canvas redraws when a variable changes.

Ready-made styles

Pick one of the ready-made styles in the list: classic, terminal (always dark), monochrome, light (always light), or none for the default look.

Density and size

The same chart with --vfjs-size-unit: 1.3px: the toolbar, the axis texts, line widths and markers are larger. Try the compact density in the list.

Localization and RTL

Languages

The chart in Russian: load the language pack vibefox-js-trading.ru.js after the library and set locale: 'ru'. The toolbar, the legend, the month names of the time axis and the indicator names are translated.

Right-to-left

The option rtl: true: the drawing toolbar is on the right and the toolbar runs from the right, while the chart itself is not mirrored (time runs left to right, the price scale stays on the right).

Accessibility

Keyboard

The keyboard bar cursor on a bar (focusBar()); the line above shows what a screen reader hears. Click the chart and press the arrow keys, Home, End, or ↑ / ↓ to zoom.

Bug Report

Thank you for helping us improve. We carefully review every report, but we do not reply to them individually. If your report leads to a change, it will be listed in the product changelog together with the report number. To discuss something in detail, please open a support ticket.

Slide to fit the puzzle