Bentrix Docs
HomePricingDashboard

Ichimoku Kinko Hyo

Trend & channelsoverlay3 linesin every package

Five series at once: Tenkan-sen and Kijun-sen are midpoints of their own windows, the two Senkou spans are drawn Kijun bars AHEAD and shaded as a cloud, and Chikou is the close drawn the same distance BACK.

It measures where price sits against midpoints on three horizons at once, and the displacement is the point: the cloud states a level before price reaches it, and Chikou compares now against then. Readings: price against the cloud, the cloud's own colour and thickness, Tenkan against Kijun, and Chikou against past price.

01The study, live

Live figureScroll to zoom, drag the bars to pan.
bar —O — H — L — C —conversion line —base line —lagging span —first value at —
Show where:

Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.

What this figure shows

The figure is computed over 300 sample bars, and Ichimoku Kinko Hyo has a value from the first. Counting the conditions the study declares on these bars: the conversion line crosses above the base line twice; the conversion line crosses below the base line twice; price enters the cloud 5 times; price leaves the cloud upward 4 times; price leaves the cloud downward once. Press a condition under the figure to see each place marked.

02Its parts, named

Lagging spanthe close, drawn back in timeConversion linethe middle of the high and low of ashort windowBase linethe middle of the high and low of alonger windowThe bars it readseach bar's open, high, low and close
Computed by Bentrix’s own code over the sample bars. It is drawn on once, as you reach the figure.

03What you see

Five lines: the conversion line (Tenkan-sen), the base line (Kijun-sen), two leading spans drawn 26 bars ahead with the shaded cloud between them, and the lagging span (Chikou) drawn 26 bars back.

04Where it comes from

Developed by the Japanese journalist Goichi Hosoda before the Second World War and published in 1969 under the pen name Ichimoku Sanjin. Its name means roughly one-glance equilibrium chart. The default periods 9, 26 and 52 come from the Japanese trading week of its time.

05The formula

Each line is a midpoint of a high and low, not an average:

Tenkan=maxH9+minL92,Kijun=maxH26+minL262
Span A=Tenkan+Kijun2 shifted 26 ahead,Span B=maxH52+minL522 shifted 26 ahead
maxHn, minLnthe highest high and the lowest low of the last n bars
shifted 26 aheaddrawn 26 bars to the right

and the lagging span is the close shifted 26 bars back.

06A worked example

The sample bars used here are eight: closes 20, 21, 23, 22, 24, 25, 24, 26; highs 21, 22, 24, 24, 25, 26, 26, 27; lows 18, 19, 20, 21, 21, 23, 23, 23; opens 19, 20, 21, 23, 22, 24, 25, 24.

Every Ichimoku line is a midpoint of a highest high and a lowest low. Take a Tenkan of 3 and a Kijun of 6 in place of 9 and 26.

  • Tenkan: the last three bars have highs 26, 26, 27 and lows 23, 23, 23 → (27 + 23) / 2 = 25.00
  • Kijun: the last six bars have a highest high of 27 and a lowest low of 20 → (27 + 20) / 2 = 23.50
  • Senkou Span A = (25.00 + 23.50) / 2 = 24.25, drawn 6 bars ahead (the Kijun period)
  • Senkou Span B: the midpoint of the longest window, also drawn ahead
  • Chikou: today's close, 26, drawn 6 bars back

So the cloud standing at today's bar was computed 26 bars ago with the defaults, and the cloud that today's prices produce is drawn 26 bars into the empty right-hand side.

07Built in Assay

The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.

THE SCRIPT’S GRAPH
//@version=6
indicator("Ichimoku Kinko Hyo", overlay = true)
tenkanLength = input.int(9, "Tenkan period")
kijunLength = input.int(26, "Kijun period")
senkouLength = input.int(52, "Senkou period")
// Each line is the middle of a window: halfway between its highest high and its lowest low.
tenkan = (ta.highest(high, tenkanLength) + ta.lowest(low, tenkanLength)) / 2
kijun = (ta.highest(high, kijunLength) + ta.lowest(low, kijunLength)) / 2
spanA = (tenkan + kijun) / 2
spanB = (ta.highest(high, senkouLength) + ta.lowest(low, senkouLength)) / 2
// Nothing is drawn until the longest window is full.
ready = not na(spanB)
plot(ready ? tenkan : na, "Tenkan")
plot(ready ? kijun : na, "Kijun")
// The close, drawn kijunLength bars back.
plot(close, "Chikou", offset = -kijunLength)
// The two spans, drawn kijunLength bars ahead; the cloud lies between them.
plot(spanA, "Senkou A", offset = kijunLength)
plot(spanB, "Senkou B", offset = kijunLength)

Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.

08Readings — what traders look for

Price against the cloud: above it is read as an up-trend, below as a down-trend, inside as no clear trend.

Tenkan crossing Kijun: read like a fast and a slow average crossing.

The cloud's colour and thickness ahead: read as where past midpoints would place support or resistance.

The lagging span against price of 26 bars ago: read as whether today's close is above or below the market of then.

How price against the cloud fails. Above the cloud is read as an up-trend, inside as no trend. The cloud under today's price was built from prices 26 to 78 bars old; after a fast move it is far away and says little about now.

How the Tenkan–Kijun cross fails. The two are midpoints of ranges, flat for stretches and stepping when an extreme leaves the window; they cross in ranges repeatedly, and a cross can be caused by an old bar dropping out.

09In different markets and timeframes

Ichimoku is a complete trend system built for daily and weekly charts: it reads best in markets that trend for months. In ranges price sits inside the cloud and the lines flatten. Its numbers come from a six-day trading week.

10With other studies

It is its own companion — five lines read together — and is seldom combined, though the Kijun is the midprice of 26 bars and the cloud's edges are ordinary midpoints drawn ahead.

11What it does not tell you

!

The cloud drawn ahead of price is made of past data shifted forward; it holds no information about the future bars it sits over.

12Inputs and defaults

Ichimoku Kinko Hyo (26, 52)settings card
1Kijun period26
2Senkou period52
3Tenkan period9
4Displacement26
5TimeframeChart
6Wait for the candle to closeOn
  1. 1
    Kijun period — 26The middle window (26): the base line — and the number of bars the spans are drawn ahead and the Chikou back.
  2. 2
    Senkou period — 52The longest window (52): Span B, the slower edge of the cloud.
  3. 3
    Tenkan period — 9The shortest window (9): the conversion line.
  4. 4
    Displacement — 26How many candles ahead the cloud is drawn, and how many back the lagging line. Left alone, it is the base line's period.
  5. 5
    Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
  6. 6
    Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.

What each input changes

  • DisplacementHow many candles ahead the cloud is drawn, and how many back the lagging line. Left as it is, it is the Kijun period — 26 with the default settings — which is the classic layout.
  • In use9, 26 and 52 are Hosoda's; 10, 30 and 60 are sometimes used for a five-day week; 20, 60 and 120 on markets that never close.

13Limits and common misreadings

The default periods suit daily charts; on other timeframes they are a habit, not a calibration.

14Conditions an alert or a strategy can watch

the conversion line crosses above the base line eventthe conversion line crosses below the base line eventprice enters the cloud eventprice leaves the cloud upward eventprice leaves the cloud downward event

Event: the bar it happens on an event happens on one barState: every bar while it holds a state holds on every bar while it lasts

These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.

15Practise it in the laboratory

Put Ichimoku on a chart and scroll to the last bar: note the cloud drawn in the empty space ahead, and identify which bars' prices produced the cloud standing under the current bar.

Open the laboratory

17In Bentrix

  • From the menu: a chart's Indicators button › Trend & channels › Ichimoku Kinko Hyo, or type Ichimoku Kinko Hyo in its search.
  • Its settings: the settings card opens when it is added; its legend's name opens it again.

18From an agent or a program

Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "ichimoku"}).

The study, as a chart files it

This is a new Ichimoku Kinko Hyo’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.

{
  "applied": "close",
  "convention": "talib",
  "kind": "ichimoku",
  "settings": {
    "kijun": 26,
    "senkou": 52,
    "shape": "ichimoku",
    "tenkan": 9
  }
}

An agent

An agent calls the MCP tool with it:

{
  "name": "study_values",
  "arguments": {
    "bench": "bentrix://lab/\u2026/bench/\u2026",
    "symbol": "EURUSD",
    "timeframe": "H1",
    "limit": 5,
    "study": {
      "applied": "close",
      "convention": "talib",
      "kind": "ichimoku",
      "settings": {
        "kijun": 26,
        "senkou": 52,
        "shape": "ichimoku",
        "tenkan": 9
      }
    }
  }
}

A program

A program does the same in its language — bench and market as in the built-in indicators guide:

Python

values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "talib", "kind": "ichimoku", "settings": {"kijun": 26, "senkou": 52, "shape": "ichimoku", "tenkan": 9}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
    print("line:", line["line"])
    print("  newest values:", line["values"])

JSJavaScript

const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "ichimoku", "settings": { "kijun": 26, "senkou": 52, "shape": "ichimoku", "tenkan": 9 } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
  console.log("line:", line.line);
  console.log("  newest values:", line.values);
}

C#C#

var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "ichimoku", ["settings"] = new Dictionary<string, object?> { ["kijun"] = 26, ["senkou"] = 52, ["shape"] = "ichimoku", ["tenkan"] = 9 } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
    Console.WriteLine($"line: {line!["line"]!}");
    Console.WriteLine($"  newest values: {line!["values"]!}");
}

GOGo

values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "ichimoku", "settings": map[string]any{"kijun": 26, "senkou": 52, "shape": "ichimoku", "tenkan": 9}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
	fmt.Println("line:", at(line, "line"))
	fmt.Println("  newest values:", at(line, "values"))
}

Java

Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "talib", "kind", "ichimoku", "settings", obj("kijun", 26, "senkou", 52, "shape", "ichimoku", "tenkan", 9))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
    System.out.println("line:" + " " + at(line, "line"));
    System.out.println("  newest values:" + " " + at(line, "values"));
}

C++C++

auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "ichimoku"}, {"settings", Json::Object{{"kijun", 26}, {"senkou", 52}, {"shape", "ichimoku"}, {"tenkan", 9}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
    std::cout << "line:" << " " << line["line"].dump() << std::endl;
    std::cout << "  newest values:" << " " << line["values"].dump() << std::endl;
}

Julia

values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "talib", "kind" => "ichimoku", "settings" => Dict{String,Any}("kijun" => 26, "senkou" => 52, "shape" => "ichimoku", "tenkan" => 9)); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
    println("line:", " ", line["line"])
    println("  newest values:", " ", line["values"])
end

RR

values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "ichimoku", settings = list(kijun = 26, senkou = 52, shape = "ichimoku", tenkan = 9)), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
  cat("line:", format(line$line), "\n")
  cat("  newest values:", format(line$values), "\n")
}

RRust

let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "ichimoku", "settings": {"kijun": 26, "senkou": 52, "shape": "ichimoku", "tenkan": 9}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
    println!("line: {}", line["line"]);
    println!("  newest values: {}", line["values"]);
}

Reading the answer

  • times — the candles’ open times, in milliseconds since 1970 (UTC), oldest first.
  • lines — one entry per line, in this order, each with its line name and its values; values[i] belongs to the candle at times[i].
  • The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
  • null is a candle with no value yet — the warm-up, about 1 × the period at the start of the history.
lineWhat it is
Tenkanconversion line
Kijunbase line
Chikoulagging span

In a strategy

Filed under a key of your choice in a strategy document’s studies — here ichimoku: {"ichimoku": {"applied": "close", "convention": "talib", "kind": "ichimoku", "settings": {"kijun": 26, "senkou": 52, "shape": "ichimoku", "tenkan": 9}}} — its rules can name:

WriteWhat it is
ichimoku.tenkanthis line, as a value in a compare
ichimoku.kijunthis line, as a value in a compare
{"cond": "ichimoku:ichimoku.tenkan_cross_up"}a condition it declares itself
{"cond": "ichimoku:ichimoku.tenkan_cross_down"}a condition it declares itself
{"cond": "ichimoku:cloud.enter"}a condition it declares itself
{"cond": "ichimoku:cloud.leave_up"}a condition it declares itself
{"cond": "ichimoku:cloud.leave_down"}a condition it declares itself

19Sources

  1. Elliott, Nicole. Ichimoku Charts: An Introduction to Ichimoku Kinko Clouds. Harriman House, 2007.
  2. Patel, Manesh. Trading with Ichimoku Clouds. Wiley, 2010.

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