Ichimoku Cloud explained: five lines and time offsets
The cloud drawn ahead of price contains calculations available now. It does not contain future prices.
Ichimoku combines three high-low midpoint calculations, their average and a displaced closing-price line. Read price against the cloud at the same chart position, then assess the conversion/base relationship. The example below separates calculation time from drawing time, so you can inspect what was actually available when a signal formed.
What do the five Ichimoku lines measure?
The Ichimoku Cloud, or Kumo, is the area between Senkou Span A and Senkou Span B. Tenkan-sen and Kijun-sen describe shorter and longer price ranges; Chikou Span draws the current close behind its actual bar. The high-low midpoints are not simple moving averages of closing prices.
On TradingView, open Indicators, search for Ichimoku Cloud and select the built-in study. Check its inputs before comparing it with a custom script. A period is one chart bar: nine periods on a one-hour chart means nine hourly bars, not nine days.
TradingView's Ichimoku reference describes the components and the limitation of projecting historical calculations ahead. For other studies, browse the TradingView indicators directory.
Why Traders Use This Indicator
- Classify price as above, inside or below the cloud at the current chart position.
- Distinguish a new Tenkan/Kijun cross from an already established alignment.
- Write explicit filters that can be compared with an unfiltered rule.
| Parameter | Default | Description |
|---|---|---|
| Conversion length (Tenkan) | 9 | Lookback for the midpoint of the highest high and lowest low, including the current bar. |
| Base length (Kijun) | 26 | Lookback for a second range midpoint. This is a calculation length, separate from the drawing displacement input. |
| Span B length | 52 | Lookback for the slower cloud boundary. A flat line can mean the range extremes have not changed, rather than price has stopped moving. |
| Displacement | 26 | This example and Pineify use displacement minus one as the actual plot shift: 25 bar positions with the default input. Check the counting convention when comparing scripts. |
Five formulas, two drawing directions
Let midpoint(n) be (highest high over n bars + lowest low over n bars) / 2. All calculations below use the current and earlier bars.
| Line | Calculation | Drawing position |
|---|---|---|
| Tenkan-sen / conversion | midpoint(9) | Current bar |
| Kijun-sen / base | midpoint(26) | Current bar |
| Senkou Span A | (Tenkan + Kijun) / 2 | Ahead by the chosen shift |
| Senkou Span B | midpoint(52) | Ahead by the same shift |
| Chikou / lagging span | Current close | Behind by the same shift |
Count bar positions, not just the input label
Descriptions commonly say the leading spans are 26 periods ahead and Chikou is 26 periods behind. This example follows Pineify's inclusive counting convention: shift = displacement - 1. At an input of 26, it draws 25 bar positions away. A script using an exact offset of 26 draws one position farther. Match the implemented offset when checking two charts.
Pine's plot documentation defines offset as a drawing shift. It does not change the underlying series. To compare price with the cloud visible at the current bar, the example reads the span calculations from shift bars ago. Pine's history-reference operator provides those past values.
A numerical alignment example
Hypothetical values: at bar t, the nine-bar high/low are 112/100 and the 26-bar high/low are 116/96. Tenkan and Kijun both equal 106, so Span A equals 106. With a 52-bar range of 120/90, Span B equals 105. At displacement 26, that new 106/105 cloud point is drawn at t+25. The cloud over t comes from calculations at t-25; it need not equal 106/105.
If the current close is 110, Chikou draws 110 at t-25. That value was not known at t-25. A Chikou comparison against the old high of 108 can be evaluated now, but cannot be recorded as a signal that existed 25 bars earlier.
Signal Interpretation
Compare cloud position, crosses and filters
These are illustrative market conditions, not historical results. A bullish cloud color means Span A exceeds Span B at the same plotted position; it does not make a bullish cross profitable.
| Market condition | Cloud and cross reading | Constraint |
|---|---|---|
| Established rise | Price above the current cloud; Tenkan above Kijun | Alignment may persist without a fresh cross. A crossover-only rule can miss continuation. |
| Sideways range | Price repeatedly enters the cloud; Tenkan crosses Kijun in both directions | An outside-cloud filter rejects some crosses but can still admit failed breakouts. |
| Transition from a decline | Bullish cross occurs while price remains below the current cloud | The long filter rejects the cross. Later price clearance is a separate event. |
| Established decline | Price below the current cloud; Tenkan below Kijun | A bullish cross can be a temporary rebound. The symmetric short filter still requires a fresh bearish cross. |
What this script marks
A long-side marker requires a confirmed Tenkan cross above Kijun and a close above both cloud boundaries visible at the current bar. The short-side marker reverses those comparisons. Cloud color and Chikou are displayed but are not additional signal filters. If the cross fails the cloud test, the script does not enter a waiting state for a later breakout.
The open bar can change Tenkan, Kijun, newly calculated spans and Chikou. A confirmed span point does not need to wait another 25 bars to become fixed merely because it is drawn ahead. Chikou's latest point appears in the past but becomes available only now. These are different behaviors; see TradingView's repainting documentation.
The example waits for the chart bar to close before displaying signal markers or enabling alerts. Create a named alert in TradingView and choose Once Per Bar Close. Recreate it after input or script changes because alerts use a saved script configuration. Sources checked October 16, 2026.
Combining with Other Indicators
An ADX strength filter can impose a separate trend-strength condition. ATR measures recent range and can inform a separately defined stop distance. Neither turns the cloud into a forecast. Cloud thickness is simply the gap between two range-based calculations, not an ATR reading or a probability of support holding.
Compare any additional filter against the same entry, exit, sizing and cost rules without it. Reserve an untouched period for evaluation. This page provides an indicator, not an order-executing strategy or performance test. It is educational information, not investment advice.
To implement a different cloud or Chikou condition, describe its calculation bar, comparison bar and confirmation timing to the Pine Script AI Coding Agent, then inspect the generated code. A successful compilation alone does not establish correct timing.
Writing Pine Script Manually
Challenges of Manual Coding
Using the raw Senkou values as if they were the cloud drawn over the current price bar.
Placing a Chikou-based trade on the historical drawing bar instead of the bar when the close became available.
Mixing a 26-position offset with displacement-minus-one comparisons.
Treating a cross seen during an open bar as a confirmed event.
//@version=6
indicator("Ichimoku: aligned cloud filters", shorttitle="Ichimoku aligned", overlay=true)
conversionLength = input.int(9, "Conversion length", minval=1, maxval=500)
baseLength = input.int(26, "Base length", minval=1, maxval=500)
spanBLength = input.int(52, "Span B length", minval=1, maxval=500)
displacement = input.int(26, "Displacement (inclusive count)", minval=1, maxval=500)
shift = displacement - 1
midpoint(length) =>
(ta.highest(high, length) + ta.lowest(low, length)) / 2.0
conversion = midpoint(conversionLength)
base = midpoint(baseLength)
spanA = (conversion + base) / 2.0
spanB = midpoint(spanBLength)
plot(conversion, "Tenkan / conversion", color=color.blue)
plot(base, "Kijun / base", color=color.red)
plot(close, "Chikou / lagging close", color=color.purple, offset=-shift)
pA = plot(spanA, "Senkou A", color=color.green, offset=shift)
pB = plot(spanB, "Senkou B", color=color.orange, offset=shift)
fill(pA, pB, color=spanA >= spanB ? color.new(color.green, 85) : color.new(color.red, 85), title="Kumo")
// The cloud visible over this bar was calculated shift bars ago.
cloudTop = math.max(spanA[shift], spanB[shift])
cloudBottom = math.min(spanA[shift], spanB[shift])
requiredBars = math.max(conversionLength, math.max(baseLength, spanBLength)) + shift
historyReady = bar_index >= requiredBars - 1
bullCross = ta.crossover(conversion, base)
bearCross = ta.crossunder(conversion, base)
longEvent = barstate.isconfirmed and historyReady and bullCross and close > cloudTop
shortEvent = barstate.isconfirmed and historyReady and bearCross and close < cloudBottom
// Mark events on their calculation bars, never on Chikou's drawing bars.
plotshape(longEvent, title="Confirmed bullish cross above cloud", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, text="L")
plotshape(shortEvent, title="Confirmed bearish cross below cloud", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, text="S")
alertcondition(longEvent, "Bullish cross above cloud", "Confirmed Tenkan/Kijun cross above the current cloud")
alertcondition(shortEvent, "Bearish cross below cloud", "Confirmed Tenkan/Kijun cross below the current cloud")Maintenance Note: This chart-timeframe indicator places no orders. Default signal warmup is 77 bars: 52 calculation bars plus a 25-position shift. Its lines update on the open bar, while markers wait for bar close. Match symbol, session, lengths and actual offsets when checking another implementation; data corrections can still change history.
Build with Pineify Visual Editor
Pineify lets you configure supported indicators and export Pine Script. Available settings and plan requirements vary by indicator. Compare the generated rules with the example before using its signals.
| Feature | Manual Pine Script | Pineify Visual Editor |
|---|---|---|
| Five-line calculation | The copyable example calculates each midpoint explicitly. | The Ichimoku module exposes conversion, base and span outputs. |
| Drawing displacement | The example uses displacement minus one consistently. | The generator uses Lagging Span minus one for leading plots and the opposite shift for Chikou. |
| Custom signal timing | The example compares price with historical span values and confirms crosses at close. | Inspect generated conditions separately from drawing offsets; plots do not shift raw outputs used in conditions. |
Configure the supported Ichimoku lengths and line styles in Visual Editor.
Export the indicator calculation and inspect the generated plot offsets.
Use AI Coding Agent for custom logic, then verify its data timing and signals.
Step-by-Step Tutorial
Add the Ichimoku Cloud indicator
Open Visual Editor and select Ichimoku Cloud. Begin with conversion 9, base 26, Span B 52 and Lagging Span 26.
Inspect the exported calculations
The span outputs are raw series. Verify that any price-versus-cloud condition reads the historical value matching the visible cloud, rather than assuming the drawing offset changes the output.
Specify custom conditions
For an AI Coding Agent request, state the actual bar shift, crossover event, cloud filter and bar-close requirement. Do not rely on the phrase Ichimoku buy signal alone.
Compare bars before creating alerts
Check several closed bars, a cross inside the cloud and one outside it. Confirm that a rejected cross does not become a delayed event unless that behavior was requested.
Trading Strategies & Pro Tips
Cross with an outside-cloud filter
The example observes a bullish cross above the cloud or a bearish cross below it. A cloud breakout without a new cross produces no marker.
Cloud breakout as a separate experiment
Define a transition from inside or below the cloud to a close above its top, rather than reusing the Tenkan/Kijun crossover condition. Moving cloud boundaries can affect that transition.
Chikou confirmation as a separate experiment
One possible filter compares the current close with the high shift bars ago for long observations, and with the old low for shorts. Evaluate and timestamp it now. This filter is not enabled in the example.
Common Mistakes to Avoid
- Calling a projected cloud future data or a price forecast.
- Treating Chikou drawn in the past as evidence that the close was known then.
- Assuming thicker clouds guarantee stronger support or a higher win rate.
- Confusing a persistent Tenkan-above-Kijun state with a new crossover.
- Comparing different chart sessions or offset conventions without documenting them.
- Reading indicator markers as backtested trades without exits, sizing, fees or slippage.
Frequently Asked Questions
Build an Ichimoku rule you can inspect
- Configure supported Ichimoku inputs in Visual Editor.
- Review calculation bars and plot offsets in the exported code.
- Check signals on TradingView before creating alerts or strategy orders.
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.
Related Indicator Tutorials
Ichimoku Cloud Screener
Scan daily Ichimoku Cloud trend states across stocks, crypto pairs, and ETFs. Bullish, bearish, and neutral cloud conditions are easy to compare.
How to Create MACD in TradingView
Learn how to create and customize the MACD indicator in TradingView using Pine Script. Covers the formula, manual coding, and no-code creation with Pineify.
How to Create ADX in TradingView
Read the ADX indicator separately from DI direction, choose ADX or DMI on TradingView, and compare thresholds and smoothing with a Pine v6 example.
How to Create Supertrend in TradingView
Learn how to create and customize the Supertrend indicator in TradingView. Covers the ATR-based formula, Pine Script coding, and no-code creation with Pineify.