Bentrix Docs
HomePricingDashboard

Volume Bars

A new bar each time a set number of ticks has traded. Busy periods get many bars, quiet ones few, so every bar on the chart stands for the same amount of activity.

The 300 hourly candles it is built from108 volume bars of 4,000 ticks each

01What you see

Candles, each made of as many periods as it took to trade the set number of ticks. Around news and at the open of a session, bars come thick and fast; overnight, one bar may cover many hours.

02How it is built

Volume bars add up each candle's tick volume V until the sum reaches the count N:

  1. A bar starts with a candle: its open is that candle's open.
  2. Each next candle extends it: the bar's high and low reach the candles' highs and lows, its close is the latest close.
  3. When the run's ticks reach the count, the bar is finished:
∑Vi≥N⇒the bar closes
Vithe tick volume of each candle in the forming bar
Nthe count of ticks a bar holds

A bar is closed by what is already in it, never by the candle after. It closes on the first candle that takes it to the count or past it, so a busy candle can leave a bar holding more than the count. The last bar, still short of the count, is the one forming.

The picture above uses 4,000 ticks a bar; a new chart starts at 1,000.

03Reading it

Time-based candles give a quiet hour and a hectic hour the same width; volume bars give each the same activity. Moves on many bars had broad participation behind them; long stretches inside one bar were quiet. Indicators computed on volume bars react to activity rather than to the clock, which is why some traders prefer them for short-term work.

The count is of ticks — price changes — which is the activity measure forex and CFD feeds carry.

04Settings

SettingChoicesNew chart
Ticks per bar1,000, 5,000, 10,000, or a number you type1,000
Colours, bodiesas on CandlestickClassic

Where the workbench holds the real tick tape, the chart-type menu also offers Tick bars, built from the ticks themselves.

05From 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": "volume_bars",
    "style": {
      "activity": {
        "volume_per_bar": 1000
      }
    }
  }
}

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 volume reached the threshold: the open, high, low and close of the candles it holds:

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_="volume_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: "volume_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: "volume_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]("volume_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("volume_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("volume_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_ = "volume_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 = "volume_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_("volume_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