Pine Script v5 · Indicator
Ichimoku Cloud
A Pine Script v5 indicator built on Highest or Lowest (high, 9). It draws 5 lines and 1 fill on the price chart. It declares 1 alert. 4 settings; defaults include Tenkan-sen (conversion) length 9, Kijun-sen (base) length 26 and Senkou Span B length 52.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does Ichimoku Cloud repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 300 of 300 bars.
- How many settings does Ichimoku Cloud have?
- 4
- Defaults include Tenkan-sen (conversion) length 9, Kijun-sen (base) length 26, Senkou Span B length 52.
- What alerts does Ichimoku Cloud have?
- 1
- Tenkan crosses Kijun.
- Does Ichimoku Cloud run in Pine Script v6?
- Yes
- Every plotted value identical on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
- Does Ichimoku Cloud draw on the price chart?
- Yes
- It is declared with overlay = true.
BTCUSDT · 1D · default settings
- Tenkan-sen
- Kijun-sen
- Chikou Span
- Senkou Span A
- Senkou Span B
- Tenkan-sen
- 82,349.00
- on the last bar
- Kijun-sen
- 83,510.00
- on the last bar
- Chikou Span
- —
- not plotted on the last bar
- Senkou Span A
- 82,929.50
- on the last bar
- Senkou Span B
- 81,181.80
- on the last bar
The value of each line the script plots, on the last of 1,000 bars, with the default settings.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
Nothing to point out.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Lengths | |||
| Tenkan-sen (conversion) length | 9 | int · min 1 | tenkan |
| Kijun-sen (base) length | 26 | int · min 1 | kijun |
| Senkou Span B length | 52 | int · min 1 | senkouB |
| Cloud shift (bars) | 26 | int · min 1 | Senkou Span A Senkou Span B Chikou Span |
What it calculates
- Highest / Lowesthigh, Tenkan-sen (conversion) length (9)
tenkan · line 14 - Highest / Lowesthigh, Kijun-sen (base) length (26)
kijun · line 15 - Highest / Lowesthigh, Senkou Span B length (52)
senkouB · line 17
Signal flow
How price data and settings reach what is drawn. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
What it draws
| Output | Call | Value | By default | Line |
|---|---|---|---|---|
| Tenkan-sen | plot | tenkan | Shown | 20 |
| Kijun-sen | plot | kijun | Shown | 21 |
| Chikou Span | plot | close | Shown | 22 |
| Senkou Span A | plot | senkouA | Shown | 23 |
| Senkou Span B | plot | senkouB | Shown | 24 |
| Kumo | fill | spanA | Shown | 25 |
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| Tenkan crosses Kijun | alertcondition | Tenkan-sen crossed Kijun-sen | 27 |
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip or realtime-only state. Values move while a bar forms and settle when it closes, as every indicator's do.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets, each the most recent 1,000 bars.
| Market | Tenkan-sen | Kijun-sen | Chikou Span | Senkou Span A | Senkou Span B |
|---|---|---|---|---|---|
| BTCUSDT 1D | 82,349.00 | 83,510.00 | — | 82,929.50 | 81,181.80 |
| BTCUSDT 4h | 83,110.10 | 82,791.20 | — | 82,950.60 | 82,349.00 |
| ETHUSDT 1D | 2,428.26 | 2,547.66 | — | 2,487.96 | 2,562.67 |
| ETHUSDT 4h | 2,454.05 | 2,427.81 | — | 2,440.93 | 2,427.85 |
| SOLUSDT 1D | 104.81 | 112.69 | — | 108.75 | 110.39 |
| SOLUSDT 4h | 106.55 | 104.81 | — | 105.68 | 104.81 |
| BNBUSDT 1D | 728.86 | 757.92 | — | 743.39 | 742.29 |
| BNBUSDT 4h | 740.12 | 728.86 | — | 734.49 | 728.86 |
Each line's value on the last bar.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type |
|---|---|---|
| Donchian Channels by Zeal Terminal | highest lowest | v5 indicator |
| Fisher Transform by Zeal Terminal | highest lowest | v5 indicator |
| Volume Profile Lite by Zeal Terminal | highest lowest | v5 indicator |
| Alex Days HiLo Rajib by 14rajib | highest lowest | v4 strategy |
| Donchian Strat EXMO by pskoroplas | highest lowest | v4 strategy |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Yes
Every plotted value identical on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯// © Zeal Terminal-//@version=5+//@version=6indicator("Ichimoku Cloud", overlay = true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 10 ms | Yes 1,000 bars in 23 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Written by Zeal Terminal and published under the Mozilla Public License 2.0.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Zeal Terminal//@version=5indicator("Ichimoku Cloud", overlay = true) // Test material as well as a library entry: the renderer tests expect five// overlay lines and one cloud fill that changes colour (e2e/complex.spec.ts).tenkanLen = input.int(9, "Tenkan-sen (conversion) length", minval = 1, group = "Lengths")kijunLen = input.int(26, "Kijun-sen (base) length", minval = 1, group = "Lengths")senkouLen = input.int(52, "Senkou Span B length", minval = 1, group = "Lengths")shift = input.int(26, "Cloud shift (bars)", minval = 1, group = "Lengths") // Each line is the midpoint of the high-low range over its own window.tenkan = (ta.highest(high, tenkanLen) + ta.lowest(low, tenkanLen)) / 2kijun = (ta.highest(high, kijunLen) + ta.lowest(low, kijunLen)) / 2senkouA = (tenkan + kijun) / 2senkouB = (ta.highest(high, senkouLen) + ta.lowest(low, senkouLen)) / 2bullish = senkouA > senkouB plot(tenkan, "Tenkan-sen", color = #42a5f5)plot(kijun, "Kijun-sen", color = #b0bec5)plot(close, "Chikou Span", color = #66bb6a, offset = 1 - shift)spanA = plot(senkouA, "Senkou Span A", color = #a5d6a7, offset = shift - 1)spanB = plot(senkouB, "Senkou Span B", color = #ef9a9a, offset = shift - 1)fill(spanA, spanB, color = bullish ? color.new(#43a047, 88) : color.new(#e53935, 88), title = "Kumo") alertcondition(ta.cross(tenkan, kijun), "Tenkan crosses Kijun", "Tenkan-sen crossed Kijun-sen")