Ichimoku Cloud

Haiyue
10min

Ichimoku Cloud (Ichimoku Kinko Hyo)

Indicator Overview
  • Category: Trend — Overlay Indicator
  • Default Parameters: tenkanPeriod=9, kijunPeriod=26, senkouBPeriod=52, displacement=26
  • Output: Five lines + cloud (Kumo) region
  • Applicable Markets: Stocks, Futures, Forex, Cryptocurrencies

I. What is the Ichimoku Cloud

The Ichimoku Cloud (Ichimoku Kinko Hyo) is a comprehensive technical analysis system developed by Japanese journalist Goichi Hosoda (pen name “Ichimoku Sanjin”) starting in the 1930s. He spent nearly 30 years developing and verifying it with the help of university students performing manual calculations, and officially published it in 1969.

“Ichimoku Kinko Hyo” translates to “equilibrium chart at a glance” in Japanese. Its core philosophy is to present trend direction, support/resistance, and momentum strength simultaneously on a single chart, allowing traders to make decisions without switching between multiple indicators.

Five Core Lines

NameJapaneseMeaning
Conversion LineTenkan-senShort-term equilibrium price (9 periods)
Base LineKijun-senMedium-term equilibrium price (26 periods)
Leading Span ASenkou Span AUpper cloud boundary (average of Tenkan and Kijun, shifted forward 26 periods)
Leading Span BSenkou Span BLower cloud boundary (52-period equilibrium price, shifted forward 26 periods)
Lagging SpanChikou SpanCurrent closing price shifted backward 26 periods
Parameter Origins

The default parameters 9-26-52 originate from the Japanese stock market’s early 6-day trading week: 9 represents one and a half weeks, 26 represents one month, and 52 represents two months. Although modern markets have shifted to a 5-day trading week, this parameter set remains widely used across global markets.

II. Mathematical Principles and Calculation

Core Formulas

Conversion Line (Tenkan-sen):

Tenkant=HH9+LL92Tenkan_t = \frac{HH_9 + LL_9}{2}

Where HH9HH_9 is the highest high over the past 9 periods, and LL9LL_9 is the lowest low over the past 9 periods.

Base Line (Kijun-sen):

Kijunt=HH26+LL262Kijun_t = \frac{HH_{26} + LL_{26}}{2}

Leading Span A (Senkou Span A):

SenkouAt+26=Tenkant+Kijunt2SenkouA_{t+26} = \frac{Tenkan_t + Kijun_t}{2}

This value is plotted 26 periods ahead of the current time.

Leading Span B (Senkou Span B):

SenkouBt+26=HH52+LL522SenkouB_{t+26} = \frac{HH_{52} + LL_{52}}{2}

Also plotted 26 periods ahead of the current time.

Lagging Span (Chikou Span):

Chikout26=ClosetChikou_{t-26} = Close_t

The current closing price is plotted 26 periods behind.

Cloud (Kumo):

Kumo=The area between Senkou Span A and Senkou Span BKumo = \text{The area between Senkou Span A and Senkou Span B}

When SenkouA>SenkouBSenkouA > SenkouB, it forms a bullish cloud (typically green); otherwise, it forms a bearish cloud (typically red).

Calculation Steps

  1. For each time point, calculate the midpoint (HighestHigh+LowestLow)/2(Highest High + Lowest Low) / 2 for the 9-period, 26-period, and 52-period windows
  2. Average Tenkan and Kijun to obtain Senkou A, then shift it forward by 26 periods
  3. Calculate the 52-period midpoint price for Senkou B, then shift it forward by 26 periods
  4. Shift the closing price backward by 26 periods to form Chikou

III. Python Implementation

import numpy as np
import pandas as pd

def ichimoku_cloud(df: pd.DataFrame,
                   tenkan_period: int = 9,
                   kijun_period: int = 26,
                   senkou_b_period: int = 52,
                   displacement: int = 26) -> pd.DataFrame:
    """
    Calculate the five lines and cloud of the Ichimoku Cloud.

    Parameters
    ----------
    df : DataFrame, must contain 'high', 'low', 'close' columns
    tenkan_period : Conversion line period, default 9
    kijun_period  : Base line period, default 26
    senkou_b_period : Leading Span B period, default 52
    displacement  : Forward/backward shift periods, default 26

    Returns
    ----------
    DataFrame with tenkan, kijun, senkou_a, senkou_b, chikou columns
    """
    high = df['high']
    low = df['low']
    close = df['close']

    # ---------- Conversion Line ----------
    tenkan = (high.rolling(window=tenkan_period).max()
              + low.rolling(window=tenkan_period).min()) / 2

    # ---------- Base Line ----------
    kijun = (high.rolling(window=kijun_period).max()
             + low.rolling(window=kijun_period).min()) / 2

    # ---------- Leading Span A (shifted forward by displacement periods) ----------
    senkou_a = ((tenkan + kijun) / 2).shift(displacement)

    # ---------- Leading Span B (shifted forward by displacement periods) ----------
    senkou_b = ((high.rolling(window=senkou_b_period).max()
                 + low.rolling(window=senkou_b_period).min()) / 2).shift(displacement)

    # ---------- Lagging Span (shifted backward by displacement periods) ----------
    chikou = close.shift(-displacement)

    result = pd.DataFrame({
        'tenkan': tenkan,
        'kijun': kijun,
        'senkou_a': senkou_a,
        'senkou_b': senkou_b,
        'chikou': chikou
    }, index=df.index)

    return result


# ========== Usage Example ==========
if __name__ == "__main__":
    np.random.seed(42)
    n = 120
    dates = pd.date_range('2024-01-01', periods=n, freq='B')

    # Simulate OHLCV data
    price = 100 + np.cumsum(np.random.randn(n) * 0.8)
    df = pd.DataFrame({
        'open':  price + np.random.uniform(-0.5, 0.5, n),
        'high':  price + np.abs(np.random.randn(n)) * 1.2,
        'low':   price - np.abs(np.random.randn(n)) * 1.2,
        'close': price + np.random.uniform(-0.3, 0.3, n),
        'volume': np.random.randint(1000, 5000, n)
    }, index=dates)

    ichi = ichimoku_cloud(df)
    merged = df.join(ichi)
    print(merged[['close', 'tenkan', 'kijun', 'senkou_a', 'senkou_b', 'chikou']].tail(15))

    # Determine cloud color
    merged['cloud_bullish'] = merged['senkou_a'] > merged['senkou_b']
    print("\nCloud status for the last 5 periods:")
    print(merged[['senkou_a', 'senkou_b', 'cloud_bullish']].dropna().tail(5))
Practical Tip

In backtesting, Senkou A/B using shift(displacement) will produce NaN values at the end of the series. If you need to evaluate “future cloud” signals, you can skip the shift and compare the raw values directly.

IV. Problems the Indicator Solves

1. Trend Identification

  • Price above the cloud —> Uptrend
  • Price below the cloud —> Downtrend
  • Price inside the cloud —> Consolidation / Transition phase

2. Support and Resistance

The cloud itself acts as a dynamic support/resistance zone. A thicker cloud implies stronger support/resistance; a thinner cloud makes it easier for price to break through.

3. Crossover Signals

Signal TypeConditionMeaning
TK Bullish CrossTenkan crosses above KijunShort-term momentum turns bullish
TK Bearish CrossTenkan crosses below KijunShort-term momentum turns bearish
Strong Bullish CrossTK bullish cross above the cloudHigh-confidence buy signal
Weak Bullish CrossTK bullish cross below the cloudLow-confidence signal, proceed with caution

4. Lagging Span Confirmation

When Chikou (Lagging Span) is above the price from 26 periods ago, it confirms a bullish trend; when it is below, it confirms a bearish trend.

5. Cloud Twist

A crossover of Senkou A and Senkou B (cloud color change) signals a potential trend reversal ahead.

Note

Ichimoku Cloud signals are most reliable when all five elements align: TK cross direction, price-to-cloud relationship, Lagging Span confirmation, cloud color, and cloud thickness all point in the same direction.

V. Advantages, Disadvantages, and Use Cases

Advantages

  1. Comprehensive information: A single chart displays trend, support/resistance, and momentum, reducing “indicator clutter”
  2. Forward-looking: The cloud is projected 26 periods ahead, providing potential future support/resistance levels
  3. Adaptive: Based on period midpoints rather than averages, more stable than moving averages during sharp volatility
  4. Excellent in trending markets: Signals are clear with few false signals in strong trends

Disadvantages

  1. Poor in ranging markets: All five lines intertwine during consolidation, generating confusing signals
  2. Visually complex: Beginners need time to learn reading five lines and a cloud
  3. Lagging nature: Based on historical extreme values, slow to react to sudden reversals
  4. Fixed parameters: The default 9-26-52 may not be suitable for short timeframes (e.g., 1-minute charts)

Use Cases

ScenarioSuitabilityNotes
Daily/Weekly trend tradingHighThe classic application timeframe
Forex 4H chartsHighContinuous forex market fits the parameters well
Crypto daily chartsMedium-High24/7 market may require parameter adjustments
1-minute scalpingLowToo much noise, unstable signals
Narrow range consolidationLowLines intertwine, no clear direction

Comparison with Similar Indicators

DimensionIchimoku CloudBollinger BandsMoving Average Set
Information DimensionsTrend + S/R + MomentumVolatility + Overbought/OversoldTrend direction
Forward-lookingYes (cloud projection)NoNo
Number of Parameters42Varies by line count
Learning CurveSteepGentleGentle
Best Practices
  • Use daily or higher timeframes for optimal results
  • First observe cloud color and thickness for the overall trend, then look for TK crossovers for entry points
  • Combine with volume indicators (e.g., OBV) for signal confirmation
  • Follow signals in trending markets; reduce position size or pause trading during consolidation