Indicator TutorialPine Script v5

How to Create the Ichimoku Cloud on TradingView

From conversion and base lines to the Kumo: a complete Pine Script v5 implementation guide.

The Ichimoku Cloud bundles trend, momentum, support/resistance, and forward projection into one chart system. This tutorial walks through each component, how the cloud is built, and a production-ready Pine Script v5 script you can paste into TradingView.

What Is the Ichimoku Cloud?

The Ichimoku Kinko Hyo (often called Ichimoku Cloud) is a Japanese charting method that plots multiple moving averages and projects a shaded region—the Kumo (cloud)—into the future to visualize equilibrium and potential support or resistance.

It includes five plots: Tenkan-sen (conversion line), Kijun-sen (base line), Senkou Span A and Senkou Span B (cloud boundaries, shifted forward), and Chikou Span (closing price shifted backward).

Traders use the cloud to judge trend bias, momentum crosses, and whether price is trading above or below the equilibrium zone.

Why Traders Use This Indicator

  • Single framework for trend direction, momentum, and forward-looking structure.
  • Cloud thickness highlights volatility and strength of support or resistance.
  • Tenkan/Kijun crosses provide clear trigger-style signals with defined context.
  • Chikou Span confirms whether current price is above or below past price action.
  • Widely recognized on TradingView, making collaboration and education easier.
ParameterDefaultDescription
Tenkan period9Lookback for the conversion line: midpoint of highest high and lowest low over this period.
Kijun period26Lookback for the base line; also used as the displacement for Chikou Span.
Senkou B period52Lookback for Senkou Span B midpoint; longer period defines slower cloud boundary.
Displacement26Bars to shift Senkou spans forward and Chikou backward—classic Ichimoku uses Kijun length.

How the Ichimoku Components Work Together

Tenkan-sen = (Highest high + Lowest low) / 2 over Tenkan period.

Kijun-sen = (Highest high + Lowest low) / 2 over Kijun period.

Senkou Span A = (Tenkan-sen + Kijun-sen) / 2, plotted Kijun bars ahead.

Senkou Span B = (Highest high + Lowest low) / 2 over Senkou B period, plotted Kijun bars ahead.

Chikou Span = Close, plotted Kijun bars in the past.

The cloud is the area between Senkou Span A and B; color often depends on which span is higher.

Signal Interpretation

Trend bias: Price above a thick bullish cloud (Span A above Span B) supports long-biased reading; below a bearish cloud, the opposite.

TK cross: Tenkan crossing above Kijun is a bullish momentum signal inside the broader cloud context; crossunder is bearish.

Kumo twist: When Senkou Span A and B cross, cloud color changes—often watched as a regime shift.

Chikou filter: Chikou above price from 26 bars ago suggests bullish confirmation; below suggests bearish confirmation.

Combining with Other Indicators

Pair Ichimoku with volume or OBV to validate breakouts through the cloud. Use ATR or percentage stops because cloud signals are not explicit stop prices.

RSI or MACD can help avoid chasing TK crosses in choppy markets when price oscillates inside the Kumo.

The Hard Way: Writing Pine Script Manually

Challenges of Manual Coding

Aligning forward and backward offsets so Chikou and Senkou spans line up with textbook charts.

Filling between two offset series for a clean cloud without repainting artifacts.

Choosing consistent highs/lows (wick vs body) when implementing midpoint calculations.

Handling insufficient history at the start of the series without lookahead bias.

Keeping inputs documented when users expect classic 9/26/52 defaults.

Pine Script v5
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify — Educational Ichimoku Cloud (manual calculation)

//@version=5
indicator("Ichimoku Cloud (Manual v5)", shorttitle="Ichimoku", overlay=true)

tenkanLen = input.int(9, "Tenkan period", minval=1)
kijunLen = input.int(26, "Kijun period", minval=1)
senkouBLen = input.int(52, "Senkou Span B period", minval=1)
displace = input.int(26, "Displacement (Kijun)", minval=1)

donchian(len) =>
    (ta.highest(high, len) + ta.lowest(low, len)) / 2.0

tenkan = donchian(tenkanLen)
kijun = donchian(kijunLen)
senkouA = (tenkan + kijun) / 2.0
senkouB = donchian(senkouBLen)

plot(tenkan, color=color.new(color.red, 0), title="Tenkan-sen", linewidth=1)
plot(kijun, color=color.new(color.blue, 0), title="Kijun-sen", linewidth=1)

pSpanA = plot(senkouA, color=color.new(color.green, 0), title="Senkou Span A", offset=displace)
pSpanB = plot(senkouB, color=color.new(color.orange, 0), title="Senkou Span B", offset=displace)
fill(pSpanA, pSpanB, color=senkouA > senkouB ? color.new(color.green, 85) : color.new(color.red, 85), title="Kumo")

plot(close, color=color.new(color.purple, 0), title="Chikou Span", offset=-displace, linewidth=1)

tkBull = ta.crossover(tenkan, kijun)
tkBear = ta.crossunder(tenkan, kijun)
plotshape(tkBull, title="TK Bull", style=shape.triangleup, location=location.belowbar, size=size.tiny, color=color.new(color.teal, 0))
plotshape(tkBear, title="TK Bear", style=shape.triangledown, location=location.abovebar, size=size.tiny, color=color.new(color.maroon, 0))

cloudBull = senkouA > senkouB

var table info = table.new(position.top_right, 2, 6, border_width=1)
if barstate.islast
    table.cell(info, 0, 0, "Tenkan", text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 1, 0, str.tostring(tenkan, format.mintick), text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 0, 1, "Kijun", text_color=color.white, bgcolor=color.new(color.gray, 70))
    table.cell(info, 1, 1, str.tostring(kijun, format.mintick), text_color=color.white, bgcolor=color.new(color.gray, 70))
    table.cell(info, 0, 2, "Span A (raw)", text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 1, 2, str.tostring(senkouA, format.mintick), text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 0, 3, "Span B (raw)", text_color=color.white, bgcolor=color.new(color.gray, 70))
    table.cell(info, 1, 3, str.tostring(senkouB, format.mintick), text_color=color.white, bgcolor=color.new(color.gray, 70))
    table.cell(info, 0, 4, "Kumo color", text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 1, 4, cloudBull ? "Bull (A>B)" : "Bear (A<B)", text_color=color.white, bgcolor=color.new(color.gray, 60))
    table.cell(info, 0, 5, "Displacement", text_color=color.white, bgcolor=color.new(color.gray, 70))
    table.cell(info, 1, 5, str.tostring(displace), text_color=color.white, bgcolor=color.new(color.gray, 70))

Maintenance Note: When TradingView updates time zone or session handling, verify that daily/weekly Ichimoku variants still match your broker session. Offset-based plots require enough bars on chart; extend history if lines look truncated.

The Easy Way: Build with Pineify Visual Editor

What if you could create the same indicator without writing a single line of code? Pineify is a visual editor designed for TradingView users who want professional-grade indicators through an intuitive interface.

FeatureManual Pine ScriptPineify Visual Editor
Offset logicEasy to mismatch Span/Chikou shifts vs textbook defaults.Visual builder reduces offset errors with labeled parameters.
Cloud fillRequires plot references and fill() wiring by hand.Drag-and-drop style configuration for fills and colors.
AlertingMust code alertcondition() for each signal type.Structured conditions speed up alert setup without boilerplate.
Iteration speedEach tweak reloads script and retests visually.Faster experimentation with reusable modules and presets.
DocumentationComments and inputs maintained manually in code.Exports and UI labels stay aligned with generated logic.

Less boilerplate when adding filters, alerts, and styling around Ichimoku.

Consistent naming and grouping of Tenkan/Kijun/Senkou parameters.

Easier multi-timeframe experiments without losing track of offsets.

Shareable configurations for teams teaching Ichimoku setups.

Lower risk of subtle repainting mistakes when extending the script.

Step-by-Step Tutorial

1

Create a new indicator project

Open Pineify and start an indicator with overlay mode so cloud and price share the pane.

2

Add Donchian midpoints

Implement Tenkan, Kijun, and Senkou B as midpoint of high/low over their periods.

3

Derive Senkou Span A

Average Tenkan and Kijun, then apply forward displacement to match Kijun length.

4

Plot Chikou with negative offset

Shift the close series backward on the chart for classic Chikou confirmation.

5

Style the Kumo

Fill between Span A and B with bullish/bearish colors based on which span is higher.

6

Publish alerts

Add TK cross and Kumo breakout alerts once logic matches your trading plan.

7

Validate on history

Compare against TradingView built-in Ichimoku to confirm periods and offsets.

Trading Strategies & Pro Tips

Kumo breakout trend follow

Trade in the direction of the breakout when price closes outside the cloud and Chikou agrees.

Pro Tip: Require cloud color (Span A vs B) to align with breakout direction.

TK cross with cloud filter

Take long TK crosses only above the cloud; short crosses only below.

Pullback to Kijun

In a trending market, enter when price retests Kijun after respecting the cloud.

Pro Tip: Combine with a volatility filter to skip narrow-range chop.

Kumo twist watch

Use twists as timing hints when slower Span B catches up to Span A.

Common Mistakes to Avoid

  • Forgetting that Senkou spans are plotted into the future while Chikou is shifted back.
  • Mixing session-specific highs/lows without documenting the session choice.
  • Treating TK crosses as standalone signals without cloud context.
  • Using too few bars so forward-shifted plots disappear off the right edge.
  • Confusing built-in ta.ichimoku() defaults with custom input sets.

Frequently Asked Questions

Build Ichimoku faster with Pineify

  • Generate structured Ichimoku logic without hand-wiring every offset.
  • Iterate on alerts, colors, and filters in a guided workflow.
  • Keep teams aligned with shareable indicator configurations.

Disclaimer: Trading involves significant risk. The indicators, code, and strategies provided are for educational purposes only and do not constitute financial advice. Past performance is not indicative of future results.