---
id: "T:cAlgo.API.Indicators.IchimokuKinkoHyo"
kind: "interface"
namespace: "cAlgo.API.Indicators"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# IchimokuKinkoHyo (interface)

Ichimoku Kinko Hyo Indicator.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public interface IchimokuKinkoHyo
```

## Remarks

Ichimoku is a moving average based trend identification system. It contains more data points than standard candlestick charts and thus provides a clearer picture of potential price action.

## Examples

C#:

```csharp
//...
private IchimokuKinkoHyo ichimokuKinkoHyo;
//...
protected override void OnStart()
{
    ichimokuKinkoHyo = Indicators.IchimokuKinkoHyo(9, 26, 52);
}
protected override void OnBar()
{
    Print("ChikouSpan Value = {0}", ichimokuKinkoHyo.ChikouSpan.LastValue);
    Print("KijunSen Value = {0}", ichimokuKinkoHyo.KijunSen.LastValue);
    Print("SenkouSpanA Value = {0}", ichimokuKinkoHyo.SenkouSpanA.LastValue);
    Print("SenkouSpanB Value = {0}", ichimokuKinkoHyo.SenkouSpanB.LastValue);
    Print("TenkanSen Value = {0}", ichimokuKinkoHyo.TenkanSen.LastValue);

    //...
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *
import math

class Test():
    def on_start(self):
        self.ichimokuKinkoHyo = api.Indicators.IchimokuKinkoHyo(9, 26, 52)

    def on_bar(self):
        api.Print(f"ChikouSpan Value = {self.ichimokuKinkoHyo.ChikouSpan.LastValue}")
        api.Print(f"KijunSen Value = {self.ichimokuKinkoHyo.KijunSen.LastValue}")
        api.Print(f"SenkouSpanA Value = {self.ichimokuKinkoHyo.SenkouSpanA.LastValue}")
        api.Print(f"SenkouSpanB Value = {self.ichimokuKinkoHyo.SenkouSpanB.LastValue}")
        api.Print(f"TenkanSen Value = {self.ichimokuKinkoHyo.TenkanSen.LastValue}")
```

C#:

```csharp
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    // This sample cBot shows how to use the Ichimoku Kinko Hyo indicator
    public partial class IchimokuKinkoHyoSample : Robot
    {
        private double _volumeInUnits;

        private IchimokuKinkoHyo _ichimokuKinkoHyo;

        public Position[] BotPositions
        {
            get
            {
                return Positions.FindAll(Label);
            }
        }

        protected override void OnStart()
        {
            _volumeInUnits = Symbol.QuantityToVolumeInUnits(VolumeInLots);

            _ichimokuKinkoHyo = Indicators.IchimokuKinkoHyo(9, 26, 52);
        }

        protected override void OnBar()
        {
            if (Bars.ClosePrices.Last(1) > _ichimokuKinkoHyo.SenkouSpanB.Last(1))
            {
                ClosePositions(TradeType.Sell);

                if (_ichimokuKinkoHyo.TenkanSen.Last(1) > _ichimokuKinkoHyo.KijunSen.Last(1) && _ichimokuKinkoHyo.TenkanSen.Last(2) <= _ichimokuKinkoHyo.KijunSen.Last(2))
                {
                    ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
                }
            }
            else if (Bars.ClosePrices.Last(1) < _ichimokuKinkoHyo.SenkouSpanA.Last(1))
            {
                ClosePositions(TradeType.Buy);

                if (_ichimokuKinkoHyo.TenkanSen.Last(1) < _ichimokuKinkoHyo.KijunSen.Last(1) && _ichimokuKinkoHyo.TenkanSen.Last(2) >= _ichimokuKinkoHyo.KijunSen.Last(2))
                {
                    ExecuteMarketOrder(TradeType.Sell, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
                }
            }
        }

        private void ClosePositions(TradeType tradeType)
        {
            foreach (var position in BotPositions)
            {
                if (position.TradeType != tradeType) continue;

                ClosePosition(position);
            }
        }
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class IchimokuKinkoHyoSample():
    def on_start(self):
        self.volumeInUnits = api.Symbol.QuantityToVolumeInUnits(api.VolumeInLots)
        self.ichimokuKinkoHyo = api.Indicators.IchimokuKinkoHyo(9, 26, 52)

    def on_bar_closed(self):
        if api.Bars.ClosePrices.Last(0) > self.ichimokuKinkoHyo.SenkouSpanB.Last(0):
            self.close_positions(TradeType.Sell)
            if self.ichimokuKinkoHyo.TenkanSen.Last(0) > self.ichimokuKinkoHyo.KijunSen.Last(0) and self.ichimokuKinkoHyo.TenkanSen.Last(1) <= self.ichimokuKinkoHyo.KijunSen.Last(1):
                api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, self.volumeInUnits, api.Label, api.StopLossInPips, api.TakeProfitInPips)
        elif api.Bars.ClosePrices.Last(0) < self.ichimokuKinkoHyo.SenkouSpanA.Last(0):
            self.close_positions(TradeType.Buy)
            if self.ichimokuKinkoHyo.TenkanSen.Last(0) < self.ichimokuKinkoHyo.KijunSen.Last(0) and self.ichimokuKinkoHyo.TenkanSen.Last(1) >= self.ichimokuKinkoHyo.KijunSen.Last(1):
                api.ExecuteMarketOrder(TradeType.Sell, api.SymbolName, self.volumeInUnits, api.Label, api.StopLossInPips, api.TakeProfitInPips)

    def get_bot_positions(self):
        return api.Positions.FindAll(api.Label)

    def close_positions(self, tradeType):
        for position in self.get_bot_positions():
            if position.TradeType != tradeType:
                continue
            api.ClosePosition(position)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "Parameters": [
    {
      "Name": "VolumeInLots",
      "DisplayName": "Volume (Lots)",
      "Type": "Double",
      "DefaultValue": 0.01
    },
    {
      "Name": "StopLossInPips",
      "DisplayName": "Stop Loss (Pips)",
      "Type": "Double",
      "DefaultValue": 10
    },
    {
      "Name": "TakeProfitInPips",
      "DisplayName": "Take Profit (Pips)",
      "Type": "Double",
      "DefaultValue": 10
    },
    {
      "Name": "Label",
      "Type": "String",
      "DefaultValue": "Sample"
    }
  ]
}
```

## Properties

- `IndicatorDataSeries ChikouSpan {get; set;}` — It is used as a support-resistance aid. [details](https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/ChikouSpan/index.md)
- `IndicatorDataSeries KijunSen {get; set;}` — This is a confirmation line, a support-resistance line, and can be used as a trailing stop line. [details](https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/KijunSen/index.md)
- `IndicatorDataSeries SenkouSpanA {get; set;}` — Leading span 1, this line forms one edge of the kumo, or cloud. If the price is above the Senkou span, the top line serves as the first support level while the bottom line serves as the second support level. [details](https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/SenkouSpanA/index.md)
- `IndicatorDataSeries SenkouSpanB {get; set;}` — Leading span 2, this line forms the other edge of the kumo. [details](https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/SenkouSpanB/index.md)
- `IndicatorDataSeries TenkanSen {get; set;}` — It is primarily used as a signal line and a minor support-resistance line. [details](https://help.ctrader.com/ctrader-algo/references/Indicators/IchimokuKinkoHyo/TenkanSen/index.md)

## Inherited members

- `ChartIndicator AddToChart()` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/AddToChart/index.md)
- `Symbol Symbol {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/Symbol/index.md)
- `TimeFrame TimeFrame {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/TimeFrame/index.md)
- `Bars Bars {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/Bars/index.md)

