Bentrix Docs
HomePricingDashboard

Heikin Ashi

Candles made of averages. Each one blends the period with the one before, so a trend shows as a long run of one colour and the noise inside it disappears. The prices drawn are not traded prices.

The same 120 hourly bars, as Heikin Ashi

01What you see

Candles that change colour far less often than ordinary ones. In a trend they come in long runs of one colour, often with no wick on one side; around a turn they shrink, grow wicks on both sides, and change colour.

02How it is built

Heikin Ashi — Japanese for average bar — replaces each period's four prices with averages. For period t with open O, high H, low L and close C:

HAclose=O+H+L+C4
HAopen=HAopen,t−1+HAclose,t−12(the first: O+C2)
HAhigh=max(H, HAopen, HAclose)HAlow=min(L, HAopen, HAclose)
O, H, L, Cthe open, high, low and close of period t
HAopen, HAclosethe Heikin Ashi candle's open and close
HAhigh, HAlowthe Heikin Ashi candle's high and low
t−1the period before

Step by step: the close is the period's average price; the open sits halfway between the previous Heikin Ashi candle's open and close; the high and the low are stretched so the body always fits inside the wicks.

Because each open is built from the candle before, every candle carries a little of the whole history before it — that is what smooths it.

03Reading it

  • Rising candles with no lower wick — a strong rise. Traders often stay in while they keep coming.
  • Falling candles with no upper wick — a strong fall.
  • Small bodies with long wicks on both sides — the trend is pausing or turning.
  • A colour change — the average has turned; often confirmed by a second candle of the new colour.

04Important: these are not real prices

The open and close of a Heikin Ashi candle are averages, so no trade happened at those prices. Your orders are still filled at the market's real bid and ask, and the price lines on the chart show the real quote. If you test a rule that enters at the Heikin Ashi close, the backtest will use a price you could not have had — read the real candles for entries.

05Settings

SettingChoicesNew chart
Smoothing1 (plain Heikin Ashi) to 5001
Colours, bodies, widthas on CandlestickClassic

Smoothing above 1 first smooths the period's open, high, low and close with an exponential average of that many periods, then builds Heikin Ashi from the smoothed prices. It never reads a candle the clock has not reached.

06Indicators on it

Indicators are computed on the real candles, not on the averages, so an RSI reads the same on a Heikin Ashi chart as on a candlestick chart.

07From 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": "heikin_ashi",
    "style": {
      "candles": {
        "bodies": "filled",
        "ha_smoothing": 1
      }
    }
  }
}

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. Heikin Ashi’s candles are computed from these with the formula above, so a program applies the same four lines to the candles it reads.

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_="heikin_ashi")
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: "heikin_ashi" });
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: "heikin_ashi");
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]("heikin_ashi")}))
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("heikin_ashi"));
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("heikin_ashi"));
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_ = "heikin_ashi")
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 = "heikin_ashi")
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_("heikin_ashi"))?;
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