此頁面尚未翻譯為繁體中文,因此以英文顯示。

Chart types

25 built-in chart types. Switch at runtime via chart.setChartType(type).

Standard

TypeDescription
candlestickClassic OHLC candles.
barOHLC bars (Western style).
lineClose-line chart.
areaFilled area under the close line.
baselineAbove / below a baseline price, two-color fill.
stepLineStaircase line — emphasizes discrete bar closes.
lineWithMarkersLine plus a dot at each data point.
hollowCandleHollow body when close > previous close.
hlcAreaHigh-low band with a close line.
hiLoA bar from each low to its high, coloured by direction; wide bars carry their high and low.
hlcBarsA stem from each low to its high and a tick at the close, with no open; coloured by the close against the one before.
columnsA column up to each close, coloured by the close against the one before. The columns stand just under the lowest close in view, clear of the volume.
stepAreaThe step line with the area under it filled.
splineA smooth curve through the closes that never goes above a high close or below a low one.
dotsA dot at each close.

Derived

TypeDescription
heikinAshiSmoothed candle series via Heikin-Ashi transform.
smoothedHeikinAshiHeikin-Ashi of prices averaged over period bars first (10, a whole number from 1 to 500; Smoothing length in the widget's settings): its candles turn later and less often, so a trend reads as one run of a colour. chart.setChartTypeOptions({ smoothedHeikinAshi: { period: 20 } }).
renkoFixed price-brick chart; time-independent.
kagiYang/yin reversal lines; the reversal is a percent (4) or an amount of price.
lineBreakA new line once the close breaks the last lines (3 by default).
pointAndFigureX/O columns; box size + reversal count. Boxes too small to see are drawn as solid columns, and columns fewer than the view holds are fitted to it.
rangeBarsEach bar's high-low equals a fixed range, and it closes at its high or its low; the last bar is the one still forming.

Volume-weighted

TypeDescription
volumeCandlesCandle width proportional to volume.
equivolumeFull-range boxes with width proportional to volume share; color tracks close vs prior close (Richard Arms style).

Order flow

TypeDescription
footprintBy each bar, what traded at every price inside it: what the sellers took at the bid and what the buyers took at the ask, from the feed's trades or your own. See the footprint chart.

Switching at runtime

chart.setChartType('equivolume')

Transforms (Heikin-Ashi, Renko, Kagi, Line Break, P&F, Range Bars) are handled internally — chart.getData() still returns the raw input series.

The time axis and the crosshair's time label date a brick, line or column by the bar it was finished on, so the axis of a Renko, Kagi, Line Break, P&F or Range Bars chart reads the years, months and days it spans; bricks finished on one bar share its label. Their own time values still only count them, one apart. axisTimes(series) from @tradecanvas/chart gives those dates for a series built by toRenko and the like.

The crosshair's tooltip and the crosshairMove event date a brick the same way: the payload's time is the axis's date, and prevClose the close of the brick before. On these types the indicators are worked out on the bricks, lines or columns drawn, not the bars under them, so a moving average sits on the bricks and the legend, ChartWidget's data window and an export read it at a brick; an export writes the bricks, dated as the axis dates them. The indicators that count days (VWAP, Session VWAP, the multi-timeframe moving average) and those that read another symbol by time are not drawn there: getActiveIndicators() marks them offChartType: true.

Renko, Kagi, Line Break and Range Bars with fewer bricks or lines than the view holds are fitted to it as Point & Figure is, so they don't sit in the plot's right part. A P&F column's volume is that of the bars it was made of. On these types the time axis keeps the two coarsest kinds of label on view (years and months, say), not a lone day between them.

Settings of the built bar types

Renko's box, the lines a Line Break has to break, Kagi's reversal, Point & Figure's box and reversal, and the range of range bars. What isn't set is worked out from the data (an ATR box for Renko, a fiftieth of the price range, rounded to 1, 2 or 5, for a P&F box…). The settings are kept in a saved state; in ChartWidget they are in the settings dialog for the chart's type.

The automatic range of range bars is the mean true range of the last 100 closed bars, rounded to a 1, 2 or 5 (… 1, 2, 5, 10, 20 …) and to a whole number of the symbol's price step (on a market whose step depends on the price, the largest step those bars traded at): small bars on a one-second chart, larger ones on a daily chart. The bar still forming is left out of it, so a tick changes only the range bars built from that bar; the ones before it stay as they are. When a bar closes and moves the mean to the next 1-2-5 number, or those bars to another price step, every bar is built again on the new range. A bar closes at its low plus the range on the way up, or its high minus the range on the way down: its close is a price it reached, and its wick shows the way it went first. A jump of several ranges, a gap between bars too, makes a bar for each range; the bars that fill a gap stand at prices the gap skipped, which never traded. A range, set or automatic, is raised to 2, 5, 10, 20… times itself, the first that makes no more, when the closed bars would make more than 100,000 range bars, or the bar still forming more than 100,000 on its own; every bar is then built again on the raised range. A range under half the 15th significant digit of the largest price closes no bar, however the prices are written.

Renko's box, Kagi's reversal and a Point & Figure box keep to the same limit: one so small for the prices that the bars before the last would make more than 100,000 bricks, lines or columns, or the last bar that many on its own, is raised to 2, 5, 10, 20… times itself, the first that makes no more, and the chart is built on it. Kagi and Point & Figure make one line or column a bar at most, so only a series of more than 100,000 bars can reach the limit; Line Break, whose setting is a count of lines, makes one line a bar at most too. A box, reversal or range that is no finite number above 0, in a saved state or a shared link, is dropped (the chart goes back to its default: worked out from the data, or Kagi's 4%), so a link can't stall the chart. The settings dialog takes none under 0.00000001 and says so under the field. On a live chart a raised size stays from tick to tick, so a tick builds the bars once, and is worked out again for a new series; toRenko, toKagi, toPointAndFigure and toRangeBars do the same when given a ReshapeMemo as their last argument. Keep one memo for each series, pass it on every run, and call memo.clear() (or make a new one) when the series is replaced, for a new symbol or timeframe: a memo can't tell a new series by itself, and would draw it at the last one's raised size.

chart.setChartTypeOptions({
  renko: { boxSize: 50 },                         // or 'atr' with atrPeriod
  lineBreak: { lines: 2 },
  kagi: { reversal: 25, reversalType: 'price' },  // or a percent
  pointAndFigure: { boxSize: 10, reversal: 3 },
  rangeBars: { range: 20 },
})
chart.getChartTypeOptions()
new Chart(host, { chartTypeOptions: { renko: { boxSize: 50 } } })

The main series, and lines on the price pane

Hide the main series to look at the indicators or compared symbols alone; mark the highest high and lowest low on screen; mark the bid and ask. A feed whose ticks carry bid and ask keeps those up to date by itself.

chart.setMainSeriesVisible(false)
chart.setHighLowLines(true)          // or new Chart(host, { highLowLines: true })
chart.setBidAsk({ bid: 64210.5, ask: 64211 })
chart.setBidAsk(null)

Tags on the price axis that would cover one another (the last price, the bid and ask, the high and low, the day's limits, orders and positions) are moved apart: the last price's stays on its line, those above it go up and those below it down, each only as far as it must. ChartWidget's price scale menu and Settings call it "No overlapping labels". Turn it off to keep every tag on its line:

chart.setAxisLabelsAligned(false)   // or new Chart(host, { features: { alignAxisLabels: false } })