Bentrix Docs
HomePricingDashboard

OHLC Bars

The same four prices as a candle, drawn as a vertical line with a tick to the left for the open and a tick to the right for the close. Lighter on the eye when many periods are on screen.

120 hourly bars

01What you see

Each period is one vertical line from its low to its high, with two short ticks:

  • a tick to the left at the open;
  • a tick to the right at the close.

A bar whose close is at or above its open is drawn in the rising colour, one below it in the falling colour.

A rising barthe right tick is above the leftHighLowCloseOpenA falling barthe right tick is below the leftHighLowCloseOpen
The same four prices as a candle, drawn without a body: the stem runs from the low to the high, the left tick is the open, the right tick the close.

02How it is built

The period's own prices, nothing computed:

line=[L, H]left tick=Oright tick=C
O, H, L, Cthe period's own open, high, low and close

03Reading it

Everything you read on a candle is here too — the range, where it closed within it, how it relates to the bar before — with less ink. Many traders prefer bars for long histories: a hundred candles become a wall of bodies, a hundred bars stay readable. Watch where each close sits in its range: closes near the highs, bar after bar, describe buying pressure even when the bars are small.

04Settings

SettingChoicesNew chart
Coloursrising and fallingClassic
Thickness1, 1.5, 2 or 3 px1 px

Alt+1 switches a chart to bars.

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": "ohlc_bars",
    "style": {
      "bars": {
        "falling": [
          239,
          83,
          80
        ],
        "rising": [
          38,
          166,
          154
        ],
        "thickness": "px1"
      }
    }
  }
}

Read it

This type is drawn by time, so bars_get answers what it is built from: the candles of the chart’s market and interval up to the clock, oldest first, as rows of time_ms, open, high, low, close, tick_volume, spread_points, with last_forming saying whether the last one is still forming. this type is a way of drawing those candles, so what a program reads is the candles themselves.

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_="ohlc_bars")
page = client.data.bars_get(bench, market, "H1", limit=20)
print("columns:", page["columns"])
print("last candle still forming:", page["last_forming"])

JSJavaScript

await client.chart.setType({ chart, type: "ohlc_bars" });
const page = await client.data.barsGet({ bench, symbol: market, timeframe: "H1", limit: 20 });
console.log("columns:", page.columns);
console.log("last candle still forming:", page.last_forming);

C#C#

await client.Chart.SetType(chart, type: "ohlc_bars");
var page = await client.Data.BarsGet(bench, market, "H1", limit: 20);
Console.WriteLine($"columns: {page!["columns"]!}");
Console.WriteLine($"last candle still forming: {page!["last_forming"]!}");

GOGo

_ = must(client.Chart.SetType(ctx, mcp.ChartSetTypeArgs{Chart: chart, Type: mcp.Ptr[string]("ohlc_bars")}))
page := must(client.Data.BarsGet(ctx, mcp.DataBarsGetArgs{Bench: bench, Symbol: market, Timeframe: "H1", Limit: mcp.Ptr[int64](20)}))
fmt.Println("columns:", at(page, "columns"))
fmt.Println("last candle still forming:", at(page, "last_forming"))

Java

client.chart.setType(new Bentrix.ChartApi.SetTypeArgs(chart).type("ohlc_bars"));
Object page = client.data.barsGet(new Bentrix.DataApi.BarsGetArgs(bench, market, "H1").limit(20L));
System.out.println("columns:" + " " + at(page, "columns"));
System.out.println("last candle still forming:" + " " + at(page, "last_forming"));

C++C++

client.chart.set_type(ChartApi::SetTypeArgs(chart).type("ohlc_bars"));
auto page = client.data.bars_get(DataApi::BarsGetArgs(bench, market, "H1").limit(20));
std::cout << "columns:" << " " << page["columns"].dump() << std::endl;
std::cout << "last candle still forming:" << " " << page["last_forming"].dump() << std::endl;

Julia

client.chart.set_type(chart; type_ = "ohlc_bars")
page = client.data.bars_get(bench, market, "H1"; limit = 20)
println("columns:", " ", page["columns"])
println("last candle still forming:", " ", page["last_forming"])

RR

client$chart$set_type(chart, type = "ohlc_bars")
page <- client$data$bars_get(bench, market, "H1", limit = 20)
cat("columns:", format(page$columns), "\n")
cat("last candle still forming:", format(page$last_forming), "\n")

RRust

client.chart().set_type(mcp::ChartSetTypeArgs::new(chart.clone()).type_("ohlc_bars"))?;
let page = client.data().bars_get(mcp::DataBarsGetArgs::new(bench.clone(), market.clone(), "H1").limit(20))?;
println!("columns: {}", page["columns"]);
println!("last candle still forming: {}", page["last_forming"]);

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