Bentrix Docs
HomePricingDashboard

Range Bars

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.

The 300 hourly candles it is built from31 range bars of one box

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 R.

  1. A bar opens at a close: O=H=L=C.
  2. Each following close extends it: H=max(H,C), L=min(L,C), and the bar's close is the latest close.
  3. 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
H, Lthe high and the low the forming bar has reached
Cthe latest close read
Rthe range, in price

A single close that jumps — a gap after a weekend or news — can make a bar taller than R; 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

SettingChoicesNew chart
RangeAuto, Points, Price, ATR, PercentAuto
SourceClose, Open, High, Low, HL2, HLC3, OHLC4, High/LowClose
Colours, bodiesas on CandlestickClassic

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:

FieldWhat it is
time, ordinalthe 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, closeits prices, as above
volumethe ticks of the candles it holds
formingtrue 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)

JSJavaScript

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#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}");
}

GOGo

_ = 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++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)
end

RR

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")
}

RRust

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);
}

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed