---
title: "Ichimoku Kinko Hyo"
description: "This indicator computes the Ichimoku Kinko Hyo indicator. It consists of the following main indicators: Tenkan-sen: (Highest Hi..."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/supported-indicators/ichimoku-kinko-hyo
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/supported-indicators/ichimoku-kinko-hyo.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/28%20Indicators/01%20Supported%20Indicators/049%20Ichimoku%20Kinko%20Hyo
modified: 2026-10-31
index: https://www.quantconnect.com/llms.txt
---

# Ichimoku Kinko Hyo

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Indicators > [Supported Indicators](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/supported-indicators.md) > Ichimoku Kinko Hyo

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

This indicator computes the Ichimoku Kinko Hyo indicator. It consists of the following main indicators: Tenkan-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 9) Kijun-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 26) Senkou A Span: (Tenkan-sen + Kijun-sen )/ 2 from a specific number of periods ago (normally 26) Senkou B Span: (Highest High + Lowest Low) / 2 for the specific period (normally 52), from a specific number of periods ago (normally 26)

To view the implementation of this indicator, see the [LEAN GitHub repository](https://github.com/QuantConnect/Lean/tree/master/Indicators/IchimokuKinkoHyo.cs).

## Using ICHIMOKU Indicator

To create an automatic indicator for `IchimokuKinkoHyo`, call the `ichimoku` helper method from the `QCAlgorithm` class. The `ichimoku` method creates a `IchimokuKinkoHyo` object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the `initialize` method.

```python
class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._ichimoku = self.ichimoku(self._symbol, 9, 26, 17, 52, 26, 26)

    def on_data(self, slice: Slice) -> None:

        if self._ichimoku.is_ready:
            # The current value of self._ichimoku is represented by self._ichimoku.current.value
            self.plot("IchimokuKinkoHyo", "ichimoku", self._ichimoku.current.value)
            # Plot all attributes of self._ichimoku
            self.plot("IchimokuKinkoHyo", "tenkan", self._ichimoku.tenkan.current.value)
            self.plot("IchimokuKinkoHyo", "kijun", self._ichimoku.kijun.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_a", self._ichimoku.senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b", self._ichimoku.senkou_b.current.value)
            self.plot("IchimokuKinkoHyo", "chikou", self._ichimoku.chikou.current.value)
            self.plot("IchimokuKinkoHyo", "tenkan_maximum", self._ichimoku.tenkan_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "tenkan_minimum", self._ichimoku.tenkan_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "kijun_maximum", self._ichimoku.kijun_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "kijun_minimum", self._ichimoku.kijun_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b_maximum", self._ichimoku.senkou_b_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b_minimum", self._ichimoku.senkou_b_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_tenkan_senkou_a", self._ichimoku.delayed_tenkan_senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_kijun_senkou_a", self._ichimoku.delayed_kijun_senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_maximum_senkou_b", self._ichimoku.delayed_maximum_senkou_b.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_minimum_senkou_b", self._ichimoku.delayed_minimum_senkou_b.current.value)
```

For more information about this method, see the [QCAlgorithm class](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/QCAlgorithm/#QuantConnect.Algorithm.QCAlgorithm.ichimoku).

You can manually create a `IchimokuKinkoHyo` indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the `update` method. The indicator will only be ready after you prime it with enough data.

```python
class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._ichimokukinkohyo = IchimokuKinkoHyo(9, 26, 17, 52, 26, 26)

    def on_data(self, slice: Slice) -> None:
        bar = slice.bars.get(self._symbol)
        if bar:
            self._ichimokukinkohyo.update(bar)

        if self._ichimokukinkohyo.is_ready:
            # The current value of self._ichimokukinkohyo is represented by self._ichimokukinkohyo.current.value
            self.plot("IchimokuKinkoHyo", "ichimokukinkohyo", self._ichimokukinkohyo.current.value)
            # Plot all attributes of self._ichimokukinkohyo
            self.plot("IchimokuKinkoHyo", "tenkan", self._ichimokukinkohyo.tenkan.current.value)
            self.plot("IchimokuKinkoHyo", "kijun", self._ichimokukinkohyo.kijun.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_a", self._ichimokukinkohyo.senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b", self._ichimokukinkohyo.senkou_b.current.value)
            self.plot("IchimokuKinkoHyo", "chikou", self._ichimokukinkohyo.chikou.current.value)
            self.plot("IchimokuKinkoHyo", "tenkan_maximum", self._ichimokukinkohyo.tenkan_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "tenkan_minimum", self._ichimokukinkohyo.tenkan_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "kijun_maximum", self._ichimokukinkohyo.kijun_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "kijun_minimum", self._ichimokukinkohyo.kijun_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b_maximum", self._ichimokukinkohyo.senkou_b_maximum.current.value)
            self.plot("IchimokuKinkoHyo", "senkou_b_minimum", self._ichimokukinkohyo.senkou_b_minimum.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_tenkan_senkou_a", self._ichimokukinkohyo.delayed_tenkan_senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_kijun_senkou_a", self._ichimokukinkohyo.delayed_kijun_senkou_a.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_maximum_senkou_b", self._ichimokukinkohyo.delayed_maximum_senkou_b.current.value)
            self.plot("IchimokuKinkoHyo", "delayed_minimum_senkou_b", self._ichimokukinkohyo.delayed_minimum_senkou_b.current.value)
```

For more information about this indicator, see its [reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Indicators/IchimokuKinkoHyo).

## Visualization

The following plot shows values for some of the `IchimokuKinkoHyo` indicator properties:

![IchimokuKinkoHyo line plot.](https://cdn.quantconnect.com/docs/i/writing-algorithms/indicators/supported-indicators/ichimoku-kinko-hyo.png)

## Indicator History

To get the historical data of the `IchimokuKinkoHyo` indicator, call the `self.indicator_history` method. This method resets your indicator, makes a [history request](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md), and updates the indicator with the historical data. Just like with regular history requests, the `indicator_history` method supports time periods based on a trailing number of bars, a trailing period of time, or a defined period of time. If you don't provide a `resolution` argument, it defaults to match the resolution of the security subscription.

```python
class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._ichimoku = self.ichimoku(self._symbol, 9, 26, 17, 52, 26, 26)

        indicator_history = self.indicator_history(self._ichimoku, self._symbol, 100, Resolution.MINUTE)
        timedelta_indicator_history = self.indicator_history(self._ichimoku, self._symbol, timedelta(days=10), Resolution.MINUTE)
        time_period_indicator_history = self.indicator_history(self._ichimoku, self._symbol, datetime(2024, 7, 1), datetime(2024, 7, 5), Resolution.MINUTE)

        # Access all attributes of indicator_history
        indicator_history_df = indicator_history.data_frame
        tenkan = indicator_history_df["tenkan"]
        kijun = indicator_history_df["kijun"]
        senkou_a = indicator_history_df["senkoua"]
        senkou_b = indicator_history_df["senkoub"]
        chikou = indicator_history_df["chikou"]
        tenkan_maximum = indicator_history_df["tenkanmaximum"]
        tenkan_minimum = indicator_history_df["tenkanminimum"]
        kijun_maximum = indicator_history_df["kijunmaximum"]
        kijun_minimum = indicator_history_df["kijunminimum"]
        senkou_b_maximum = indicator_history_df["senkoubmaximum"]
        senkou_b_minimum = indicator_history_df["senkoubminimum"]
        delayed_tenkan_senkou_a = indicator_history_df["delayedtenkansenkoua"]
        delayed_kijun_senkou_a = indicator_history_df["delayedkijunsenkoua"]
        delayed_maximum_senkou_b = indicator_history_df["delayedmaximumsenkoub"]
        delayed_minimum_senkou_b = indicator_history_df["delayedminimumsenkoub"]
```
