Bars that each cover the same price range. A new bar starts only when the current one has moved a full range from its low to its high, so every bar is the same height and fast markets get more bars.
01What you see
Candles that are all about the same height. When the market is busy, bars come one after another; when it is quiet, one bar can last for hours. Like Renko, the horizontal axis counts bars, not time.
02How it is built
Range bars read one price per candle — the close by default — and a range .
- A bar opens at a close: .
- Each following close extends it: , , and the bar's close is the latest close.
- When the bar's height reaches the range, it is finished and the next bar opens at that close:
H − L ≥ R ⇒ the bar closes; the next opens at C
A single close that jumps — a gap after a weekend or news — can make a bar taller than ; it is not split into several. The last bar on the right is still forming.
The range takes the same choices as a Renko box: Auto, Points, Price, ATR or Percent.
03Reading it
Range bars normalise volatility: every bar represents the same amount of movement. A cluster of bars marks where the market was active; a long stretch with few bars marks a lull. Many bars rising in a row is a sustained move; a bar that opens near one end and closes near the other is a full swing in one direction. Because each bar has an open and a close, candle patterns can be read on them too.
04Settings
| Setting | Choices | New chart |
|---|---|---|
| Range | Auto, Points, Price, ATR, Percent | Auto |
| Source | Close, Open, High, Low, HL2, HLC3, OHLC4, High/Low | Close |
| Colours, bodies | as on Candlestick | Classic |
With High/Low, each candle's high and low extend the bar, so a wick counts toward the range.
05Indicators on range bars
Computed on the range bars by default, or on the candles behind them by the study's Calculate on setting.
06From an agent or a program
Set it
chart_set_type turns a chart into this type, as the Chart type card does; style is laid over the chart’s own, field by field — these are its fields and a new chart’s values:
{
"name": "chart_set_type",
"arguments": {
"chart": "<chart uri>",
"type": "range_bars",
"style": {
"elements": {
"range_box": {
"kind": "auto"
},
"range_source": "closes"
}
}
}
}Read it
chart_elements_get answers what the chart drew, newest last (at most 5,000; 500 when limit is not given), up to the clock. Each element is read as a bar — here, a bar that closed when its range reached the box: an ordinary open, high, low and close:
| Field | What it is |
|---|---|
time, ordinal | the element’s address: the open time (UTC milliseconds) of the time candle whose prices completed it, and its place among the elements that one candle made — a fast hour can make several |
open, high, low, close | its prices, as above |
volume | the ticks of the candles it holds |
forming | true for the last element while it is still being built; it may change or vanish |
An indicator on this chart is computed on these elements by default — study_attach with "on": "candles" computes it on the time candles behind them instead.
In a program
The same two steps in each language — chart, bench and market as in the read the candles guide:
Python
client.chart.set_type(chart, type_="range_bars")
drawn = client.data.chart_elements_get(chart, limit=20)
for e in drawn["elements"]:
print("element:", e)JavaScript
await client.chart.setType({ chart, type: "range_bars" });
const drawn = await client.data.chartElementsGet({ chart, limit: 20 });
for (const e of drawn.elements) {
console.log("element:", e);
}C#
await client.Chart.SetType(chart, type: "range_bars");
var drawn = await client.Data.ChartElementsGet(chart, limit: 20);
foreach (var e in drawn!["elements"]!.AsArray())
{
Console.WriteLine($"element: {e}");
}Go
_ = must(client.Chart.SetType(ctx, mcp.ChartSetTypeArgs{Chart: chart, Type: mcp.Ptr[string]("range_bars")}))
drawn := must(client.Data.ChartElementsGet(ctx, mcp.DataChartElementsGetArgs{Chart: chart, Limit: mcp.Ptr[int64](20)}))
for _, e := range at(drawn, "elements").([]any) {
fmt.Println("element:", e)
}Java
client.chart.setType(new Bentrix.ChartApi.SetTypeArgs(chart).type("range_bars"));
Object drawn = client.data.chartElementsGet(new Bentrix.DataApi.ChartElementsGetArgs(chart).limit(20L));
for (Object e : (List<Object>) at(drawn, "elements")) {
System.out.println("element:" + " " + e);
}C++
client.chart.set_type(ChartApi::SetTypeArgs(chart).type("range_bars"));
auto drawn = client.data.chart_elements_get(DataApi::ChartElementsGetArgs(chart).limit(20));
for (const Json &e : drawn["elements"].arr()) {
std::cout << "element:" << " " << e.dump() << std::endl;
}Julia
client.chart.set_type(chart; type_ = "range_bars")
drawn = client.data.chart_elements_get(chart; limit = 20)
for e in drawn["elements"]
println("element:", " ", e)
endR
client$chart$set_type(chart, type = "range_bars")
drawn <- client$data$chart_elements_get(chart, limit = 20)
for (e in drawn$elements) {
cat("element:", format(e), "\n")
}Rust
client.chart().set_type(mcp::ChartSetTypeArgs::new(chart.clone()).type_("range_bars"))?;
let drawn = client.data().chart_elements_get(mcp::DataChartElementsGetArgs::new(chart.clone()).limit(20))?;
for e in drawn["elements"].as_array().into_iter().flatten() {
println!("element: {}", e);
}