Ichimoku Cloud Colored
Ichimoku Kinko Hyo with one cloud coloured bar by bar (green where leading span A is above B, red elsewhere) and a label at every Tenkan/Kijun cross.
- Ichimoku
- Updates every tick
- ichimoku
- cloud
- kumo
- tenkan
- kijun
- crossover
MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.

Overview
Ichimoku Kinko Hyo (one-glance equilibrium chart) by Goichi Hosoda. The conversion line (Tenkan-sen) and the base line (Kijun-sen) are the middle of the highest high and lowest low over 9 and 26 bars. Leading span A (Senkou Span A) is the average of those two lines and leading span B (Senkou Span B) the middle of the 52-bar range; both are projected 26 bars forward, counting the current bar as the first. The cloud (Kumo) between them is one area coloured bar by bar, and every Tenkan/Kijun cross gets a label.
How to read it
Price above the cloud is bullish, below it bearish, inside it undecided. Where span A is above span B the cloud is green, elsewhere red; a thick cloud is stronger support or resistance than a thin one, and a colour change ahead of price warns of a possible change of trend.
TK up marks the conversion line crossing above the base line, the classic bullish signal, stronger when it happens above the cloud; TK down is the bearish cross. The lagging span above the price it is drawn against confirms an uptrend, below it a downtrend.
Settings and limitations
The lengths 9, 26 and 52 and the displacement of 26 are Hosoda's originals for a six-day trading week; the preset 20, 60, 120 and 30 is a common choice for markets that trade around the clock. The displacement only moves the spans and the cloud and does not change their values. Cross labels switches the labels. The two cloud colours are appearance settings.
Notes
Formulas (StockCharts ChartSchool, Ichimoku Cloud): Tenkan = (9-bar high + 9-bar low) / 2, Kijun = (26-bar high + 26-bar low) / 2, Senkou A = (Tenkan + Kijun) / 2 and Senkou B = (52-bar high + 52-bar low) / 2, both drawn 26 bars ahead, Chikou = close drawn 26 bars back. The displacement counts the current bar as the first, as TradingView does, so the cloud reaches 25 bars past the last bar. A cross is a bar whose conversion line is above the base line after it was at or below it on the bar before (below after at or above for a bearish cross). Same values as the built-in Ichimoku Cloud, which draws two clouds instead of one coloured one. The chart keeps the 2,000 most recent labels of each direction.
Settings
Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.
| Setting | Type | Default | Range or options | What it does |
|---|---|---|---|---|
| Conversion line length | Whole number | 9 | 1 – 500 | Bars in the conversion line (Tenkan-sen), the middle of their highest high and lowest low. |
| Base line length | Whole number | 26 | 1 – 500 | Bars in the base line (Kijun-sen), the middle of their highest high and lowest low. |
| Leading span B length | Whole number | 52 | 1 – 500 | Bars in leading span B (Senkou Span B), the middle of their highest high and lowest low. |
| Displacement | Whole number | 26 | 1 – 250 | How far the cloud is projected forward and the lagging span drawn back, counting the current bar as the first, as on TradingView. |
| Cross labels | On / off | On | — | Label the bars where the conversion line crosses the base line. |
Presets
Each preset is its own entry in the Indicators toolbox, with these settings changed.
| Toolbox entry | Short name | Settings |
|---|---|---|
| Ichimoku Cloud Colored (20, 60, 120, 30) | Ichimoku 20 | Conversion line length: 20Base line length: 60Leading span B length: 120Displacement: 30 |
What it draws
Lines
- Conversion linesolid · 1 px
#2962FF - Base linesolid · 1.5 px · primary
#B71C1C - Lagging spansolid · 1 px
#43A047 - Leading span Asolid · 1 px
#A5D6A7 - Leading span Bsolid · 1 px
#EF9A9A
Zones
- Cloudfilled at 20% opacity · colored per bar from Cloud colors (2 colors)
#43A047 #E53935
Text labels
- Bullish TK crosspin label · below
#2EA043 - Bearish TK crosspin label · above
#DA3633
Source
Save it as ichimoku-colored.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.
// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** @type {import('./spectral-indicator').IndicatorV3} */
export default {
schemaVersion: 3,
id: 'ichimoku-colored',
name: 'Ichimoku Cloud Colored',
shortName: 'Ichimoku',
version: '1.0.0',
author: 'Spectral',
description: 'Ichimoku Kinko Hyo with one cloud coloured bar by bar (green where leading span A is above B, red elsewhere) and a label at every Tenkan/Kijun cross.',
pane: 'price',
live: { lookback: 'conversionLength + baseLength + spanBLength' },
inputs: {
conversionLength: { type: 'integer', label: 'Conversion line length', default: 9, min: 1, max: 500, description: 'Bars in the conversion line (Tenkan-sen), the middle of their highest high and lowest low.' },
baseLength: { type: 'integer', label: 'Base line length', default: 26, min: 1, max: 500, description: 'Bars in the base line (Kijun-sen), the middle of their highest high and lowest low.' },
spanBLength: { type: 'integer', label: 'Leading span B length', default: 52, min: 1, max: 500, description: 'Bars in leading span B (Senkou Span B), the middle of their highest high and lowest low.' },
displacement: { type: 'integer', label: 'Displacement', default: 26, min: 1, max: 250, description: 'How far the cloud is projected forward and the lagging span drawn back, counting the current bar as the first, as on TradingView.' },
showCrosses: { type: 'boolean', label: 'Cross labels', default: true, description: 'Label the bars where the conversion line crosses the base line.' },
},
palettes: {
kumo: { label: 'Cloud colors', colors: ['#43A047', '#E53935'] },
},
plots: {
conversion: { label: 'Conversion line', color: '#2962FF', lineWidth: 1 },
base: { label: 'Base line', color: '#B71C1C', lineWidth: 1.5, primary: true },
lagging: { label: 'Lagging span', color: '#43A047', lineWidth: 1, offset: '-displacement+1' },
spanA: { label: 'Leading span A', color: '#A5D6A7', lineWidth: 1, offset: 'displacement-1' },
spanB: { label: 'Leading span B', color: '#EF9A9A', lineWidth: 1, offset: 'displacement-1' },
},
zones: {
cloud: { label: 'Cloud', color: '#43A047', opacity: 0.2, offset: 'displacement-1', palette: 'kumo' },
},
labels: {
tkUp: { label: 'Bullish TK cross', color: '#2EA043', style: 'pin', placement: 'below', textSize: 'small' },
tkDown: { label: 'Bearish TK cross', color: '#DA3633', style: 'pin', placement: 'above', textSize: 'small' },
},
presets: [
{ id: 'crypto', name: 'Ichimoku Cloud Colored (20, 60, 120, 30)', shortName: 'Ichimoku 20', inputs: { conversionLength: 20, baseLength: 60, spanBLength: 120, displacement: 30 } },
],
docs: {
overview: 'Ichimoku Kinko Hyo (one-glance equilibrium chart) by Goichi Hosoda. The conversion line (Tenkan-sen) and the base line (Kijun-sen) are the middle of the highest high and lowest low over 9 and 26 bars. Leading span A (Senkou Span A) is the average of those two lines and leading span B (Senkou Span B) the middle of the 52-bar range; both are projected 26 bars forward, counting the current bar as the first. The cloud (Kumo) between them is one area coloured bar by bar, and every Tenkan/Kijun cross gets a label.',
howToRead: 'Price above the cloud is bullish, below it bearish, inside it undecided. Where span A is above span B the cloud is green, elsewhere red; a thick cloud is stronger support or resistance than a thin one, and a colour change ahead of price warns of a possible change of trend.\n\nTK up marks the conversion line crossing above the base line, the classic bullish signal, stronger when it happens above the cloud; TK down is the bearish cross. The lagging span above the price it is drawn against confirms an uptrend, below it a downtrend.',
settings: 'The lengths 9, 26 and 52 and the displacement of 26 are Hosoda\'s originals for a six-day trading week; the preset 20, 60, 120 and 30 is a common choice for markets that trade around the clock. The displacement only moves the spans and the cloud and does not change their values. Cross labels switches the labels. The two cloud colours are appearance settings.',
notes: 'Formulas (StockCharts ChartSchool, Ichimoku Cloud): Tenkan = (9-bar high + 9-bar low) / 2, Kijun = (26-bar high + 26-bar low) / 2, Senkou A = (Tenkan + Kijun) / 2 and Senkou B = (52-bar high + 52-bar low) / 2, both drawn 26 bars ahead, Chikou = close drawn 26 bars back. The displacement counts the current bar as the first, as TradingView does, so the cloud reaches 25 bars past the last bar. A cross is a bar whose conversion line is above the base line after it was at or below it on the bar before (below after at or above for a bearish cross). Same values as the built-in Ichimoku Cloud, which draws two clouds instead of one coloured one. The chart keeps the 2,000 most recent labels of each direction.',
},
calculate(ctx) {
const { bars, inputs, ta } = ctx;
const highs = ta.source(bars, 'high');
const lows = ta.source(bars, 'low');
const midpoint = (length) => {
const highest = ta.highest(highs, length);
const lowest = ta.lowest(lows, length);
return highest.map((high, index) => (high === null || lowest[index] === null ? null : (high + lowest[index]) / 2));
};
const conversion = midpoint(inputs.conversionLength);
const base = midpoint(inputs.baseLength);
const spanA = conversion.map((value, index) => (value === null || base[index] === null ? null : (value + base[index]) / 2));
const spanB = midpoint(inputs.spanBLength);
// One cloud between the spans; palette 0 where span A is above span B, 1 elsewhere.
const cloudColors = spanA.map((value, index) => (value === null || spanB[index] === null ? null : value > spanB[index] ? 0 : 1));
const tkUp = [];
const tkDown = [];
if (inputs.showCrosses) {
for (let index = 1; index < bars.length; index += 1) {
const [now, then, line, lineThen] = [conversion[index], conversion[index - 1], base[index], base[index - 1]];
if (now === null || then === null || line === null || lineThen === null) continue;
if (now > line && then <= lineThen) tkUp.push({ index, value: bars[index].low, text: 'TK up' });
else if (now < line && then >= lineThen) tkDown.push({ index, value: bars[index].high, text: 'TK down' });
}
}
return {
plots: { conversion, base, lagging: ta.source(bars, 'close'), spanA, spanB },
zones: { cloud: { upper: spanA, lower: spanB } },
colors: { cloud: cloudColors },
labels: { tkUp: tkUp.slice(-2000), tkDown: tkDown.slice(-2000) },
};
},
};Adapt it with an LLM
Paste this into your assistant and replace the second-to-last line with the change you want.
Start from this Spectral custom indicator: https://spectral.trade/indicators/ichimoku-colored.js Format reference: https://spectral.trade/docs/custom-indicators.llm.md Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match. Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow. Change I want: <describe the change> Answer with the complete file in one code block, ready to save as <id>.js.


