Supported Indicators

Ichimoku Kinko Hyo

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)

Create Manual Indicators

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. The following reference table describes the IchimokuKinkoHyo constructor.

IchimokuKinkoHyo()1/2

            IchimokuKinkoHyo QuantConnect.Indicators.IchimokuKinkoHyo (
     *int  senkouAPeriod
   )
        

Creates a new IchimokuKinkoHyo indicator from the specific periods.

IchimokuKinkoHyo()2/2

            IchimokuKinkoHyo QuantConnect.Indicators.IchimokuKinkoHyo (
     string  name,
     *int    senkouBDelayPeriod
   )
        

Creates a new IchimokuKinkoHyo indicator from the specific periods.

Update Manual Indicators

You can update the indicator automatically or manually.

Automatic Update

To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.


private IchimokuKinkoHyo _ichimoku;

// In Initialize()
_ichimoku = new IchimokuKinkoHyo(name);
_ichimoku.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _ichimoku, Resolution.Daily);

// In IndicatorUpdateMethod()
if (_ichimoku.IsReady)
{
    var indicatorValue = _ichimoku.Current.Value;
}
    
# In Initialize()
self.ichimoku = IchimokuKinkoHyo(name)
self.ichimoku.Updated += self.IndicatorUpdateMethod

self.RegisterIndicator(symbol, self.ichimoku, Resolution.Daily)

# In IndicatorUpdateMethod()
if self.ichimoku.IsReady:
    indicator_value = self.ichimoku.Current.Value

To customize the data that automatically updates the indicator, see Custom Indicator Periods and Custom Indicator Values.

Manual Update

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 with a TradeBar, QuoteBar, or an IndicatorDataPoint. The indicator will only be ready after you prime it with enough data.

    
private IchimokuKinkoHyo _ichimoku;
private Symbol symbol;

// In Initialize()
_ichimoku = new IchimokuKinkoHyo();
symbol = AddEquity("SPY").Symbol;

// In OnData()
if (data.QuoteBars.ContainsKey(_symbol))
{
    _ichimoku.Update(data.QuoteBars[symbol]);
}
if (_ichimoku.IsReady)
{
    var indicatorValue = _ichimoku.Current.Value;
}
    
# In Initialize()
self.ichimoku = IchimokuKinkoHyo()
self.symbol = self.AddEquity("SPY").Symbol

# In OnData()
if data.QuoteBars.ContainsKey(self.symbol):
    self.ichimoku.Update(data.QuoteBars[self.symbol])
if self.ichimoku.IsReady:
    indicator_value = self.ichimoku.Current.Value

Create Automatic Indicators

The ICHIMOKU method creates an IchimokuKinkoHyo indicator, sets up a consolidator to update the indicator, and then returns the indicator so you can use it in your algorithm.

The following reference table describes the ICHIMOKU method:

ICHIMOKU()1/1

            IchimokuKinkoHyo QuantConnect.Algorithm.QCAlgorithm.ICHIMOKU (
    Symbol                       symbol,
    Int32                        tenkanPeriod,
    Int32                        kijunPeriod,
    Int32                        senkouAPeriod,
    Int32                        senkouBPeriod,
    Int32                        senkouADelayPeriod,
    Int32                        senkouBDelayPeriod,
    *Nullable<Resolution>  resolution
   )
        

Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically updated on the given resolution.


If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

For more information about the selector argument, see Alternative Price Fields.

Get Indicator Values

To get the value of the indicator, use its Current.Value attribute.

private IchimokuKinkoHyo _ichimoku;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_ichimoku = ICHIMOKU(symbol, tenkanPeriod, kijunPeriod, senkouAPeriod, senkouBPeriod, senkouADelayPeriod, senkouBDelayPeriod);

// In OnData()
if (_ichimoku.IsReady)
{
    var tenkan = _ichimoku.Tenkan.Current.Value;
    var kijun = _ichimoku.Kijun.Current.Value;
    var senkouA = _ichimoku.SenkouA.Current.Value;
    var senkouB = _ichimoku.SenkouB.Current.Value;
    var chikou = _ichimoku.Chikou.Current.Value;
    var tenkanMaximum = _ichimoku.TenkanMaximum.Current.Value;
    var tenkanMinimum = _ichimoku.TenkanMinimum.Current.Value;
    var kijunMaximum = _ichimoku.KijunMaximum.Current.Value;
    var kijunMinimum = _ichimoku.KijunMinimum.Current.Value;
    var senkouBMaximum = _ichimoku.SenkouBMaximum.Current.Value;
    var senkouBMinimum = _ichimoku.SenkouBMinimum.Current.Value;
    var delayedTenkanSenkouA = _ichimoku.DelayedTenkanSenkouA.Current.Value;
    var delayedKijunSenkouA = _ichimoku.DelayedKijunSenkouA.Current.Value;
    var delayedMaximumSenkouB = _ichimoku.DelayedMaximumSenkouB.Current.Value;
    var delayedMinimumSenkouB = _ichimoku.DelayedMinimumSenkouB.Current.Value;
    var current = _ichimoku.Current.Value;
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.ichimoku = self.ICHIMOKU(symbol, tenkanPeriod, kijunPeriod, senkouAPeriod, senkouBPeriod, senkouADelayPeriod, senkouBDelayPeriod)

# In OnData()
if self.ichimoku.IsReady:
    tenkan = self.ichimoku.Tenkan.Current.Value
    kijun = self.ichimoku.Kijun.Current.Value
    senkou_a = self.ichimoku.SenkouA.Current.Value
    senkou_b = self.ichimoku.SenkouB.Current.Value
    chikou = self.ichimoku.Chikou.Current.Value
    tenkan_maximum = self.ichimoku.TenkanMaximum.Current.Value
    tenkan_minimum = self.ichimoku.TenkanMinimum.Current.Value
    kijun_maximum = self.ichimoku.KijunMaximum.Current.Value
    kijun_minimum = self.ichimoku.KijunMinimum.Current.Value
    senkou_b_maximum = self.ichimoku.SenkouBMaximum.Current.Value
    senkou_b_minimum = self.ichimoku.SenkouBMinimum.Current.Value
    delayed_tenkan_senkou_a = self.ichimoku.DelayedTenkanSenkouA.Current.Value
    delayed_kijun_senkou_a = self.ichimoku.DelayedKijunSenkouA.Current.Value
    delayed_maximum_senkou_b = self.ichimoku.DelayedMaximumSenkouB.Current.Value
    delayed_minimum_senkou_b = self.ichimoku.DelayedMinimumSenkouB.Current.Value
    current = self.ichimoku.Current.Value

Visualization

To plot indicator values, in the OnData event handler, call the Plot method.

private IchimokuKinkoHyo _ichimoku;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_ichimoku = ICHIMOKU(symbol, tenkanPeriod, kijunPeriod, senkouAPeriod, senkouBPeriod, senkouADelayPeriod, senkouBDelayPeriod);

// In OnData()
if (_ichimoku.IsReady)
{
    Plot("My Indicators", "tenkan", _ichimoku.Tenkan);
    Plot("My Indicators", "kijun", _ichimoku.Kijun);
    Plot("My Indicators", "senkoua", _ichimoku.SenkouA);
    Plot("My Indicators", "senkoub", _ichimoku.SenkouB);
    Plot("My Indicators", "chikou", _ichimoku.Chikou);
    Plot("My Indicators", "tenkanmaximum", _ichimoku.TenkanMaximum);
    Plot("My Indicators", "tenkanminimum", _ichimoku.TenkanMinimum);
    Plot("My Indicators", "kijunmaximum", _ichimoku.KijunMaximum);
    Plot("My Indicators", "kijunminimum", _ichimoku.KijunMinimum);
    Plot("My Indicators", "senkoubmaximum", _ichimoku.SenkouBMaximum);
    Plot("My Indicators", "senkoubminimum", _ichimoku.SenkouBMinimum);
    Plot("My Indicators", "delayedtenkansenkoua", _ichimoku.DelayedTenkanSenkouA);
    Plot("My Indicators", "delayedkijunsenkoua", _ichimoku.DelayedKijunSenkouA);
    Plot("My Indicators", "delayedmaximumsenkoub", _ichimoku.DelayedMaximumSenkouB);
    Plot("My Indicators", "delayedminimumsenkoub", _ichimoku.DelayedMinimumSenkouB);
    Plot("My Indicators", "ichimokukinkohyo", _ichimoku.Current);
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.ichimoku = self.ICHIMOKU(symbol, tenkanPeriod, kijunPeriod, senkouAPeriod, senkouBPeriod, senkouADelayPeriod, senkouBDelayPeriod)

# In OnData()
if self.ichimoku.IsReady:
    self.Plot("My Indicators", "tenkan", self.ichimoku.Tenkan)
    self.Plot("My Indicators", "kijun", self.ichimoku.Kijun)
    self.Plot("My Indicators", "senkoua", self.ichimoku.SenkouA)
    self.Plot("My Indicators", "senkoub", self.ichimoku.SenkouB)
    self.Plot("My Indicators", "chikou", self.ichimoku.Chikou)
    self.Plot("My Indicators", "tenkanmaximum", self.ichimoku.TenkanMaximum)
    self.Plot("My Indicators", "tenkanminimum", self.ichimoku.TenkanMinimum)
    self.Plot("My Indicators", "kijunmaximum", self.ichimoku.KijunMaximum)
    self.Plot("My Indicators", "kijunminimum", self.ichimoku.KijunMinimum)
    self.Plot("My Indicators", "senkoubmaximum", self.ichimoku.SenkouBMaximum)
    self.Plot("My Indicators", "senkoubminimum", self.ichimoku.SenkouBMinimum)
    self.Plot("My Indicators", "delayedtenkansenkoua", self.ichimoku.DelayedTenkanSenkouA)
    self.Plot("My Indicators", "delayedkijunsenkoua", self.ichimoku.DelayedKijunSenkouA)
    self.Plot("My Indicators", "delayedmaximumsenkoub", self.ichimoku.DelayedMaximumSenkouB)
    self.Plot("My Indicators", "delayedminimumsenkoub", self.ichimoku.DelayedMinimumSenkouB)
    self.Plot("My Indicators", "ichimokukinkohyo", self.ichimoku.Current)

The following image shows the plot values in a matplotlib plot. To load algorithm plot data into the Research Environment, see Charts.

For more information about plotting indicators, see Plotting Indicators.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: