☁️ Advanced Indicator

Custom Ichimoku Cloud Indicator — Ready Pine Script

By PrimeTraderAI Team · May 2026 · 9 min

Ichimoku Kinko Hyo (means “one glance equilibrium chart” in Japanese) is one of the most complete trading indicators. A single chart shows: trend, support, resistance, momentum, and entry/exit signals.

In this post, I’ll hand you a customized Ichimoku version in Pine Script v5 — with improved colors, automatic buy/sell signals, and a status dashboard.

The 5 components of Ichimoku

  • Tenkan-sen (Conversion Line): 9-period average — fast trend
  • Kijun-sen (Base Line): 26-period average — medium trend
  • Senkou Span A: average of Tenkan and Kijun, projected 26 periods ahead
  • Senkou Span B: 52-period average, projected 26 periods ahead
  • Chikou Span: closing price, shifted 26 periods back

The “cloud” (Kumo) is formed by the area between Senkou A and Senkou B. It acts as dynamic support/resistance.

How to interpret

  • Price above the cloud + green cloud → strong uptrend
  • Price below the cloud + red cloud → strong downtrend
  • ⚠️ Price inside the cloud → indecision, avoid trading
  • 📈 Tenkan crosses Kijun upward → buy signal
  • 📉 Tenkan crosses Kijun downward → sell signal

Complete Code

Pine Script v5📋 Copy
//@version=5
indicator("Ichimoku Cloud Custom — IA Trader Pro", overlay=true)

// === PARAMETERS ===
conversionPeriods = input.int(9, "Tenkan-sen (Conversion)")
basePeriods = input.int(26, "Kijun-sen (Base)")
laggingSpan2Periods = input.int(52, "Senkou Span B")
displacement = input.int(26, "Displacement")

// === CALCULATIONS ===
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))

conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)

// === PLOTS ===
plot(conversionLine, "Tenkan-sen", color=#b8893d, linewidth=2)
plot(baseLine, "Kijun-sen", color=#dc2626, linewidth=2)
plot(close, "Chikou Span", offset=-displacement + 1, color=#E040FB, linewidth=1)

p1 = plot(leadLine1, "Senkou Span A", offset=displacement - 1, color=#b8893d, linewidth=1)
p2 = plot(leadLine2, "Senkou Span B", offset=displacement - 1, color=#dc2626, linewidth=1)

// === CLOUD ===
fill(p1, p2, color=leadLine1 > leadLine2 ? color.new(#b8893d, 85) : color.new(#dc2626, 85))

// === BUY/SELL SIGNALS ===
// Buy: Tenkan crosses above Kijun AND price above the cloud
buySignal = ta.crossover(conversionLine, baseLine) and close > leadLine1 and close > leadLine2
// Sell: Tenkan crosses below Kijun AND price below the cloud
sellSignal = ta.crossunder(conversionLine, baseLine) and close < leadLine1 and close < leadLine2

plotshape(buySignal, "BUY", shape.labelup, location.belowbar, color.new(#b8893d, 0), text="▲ BUY", textcolor=color.white, size=size.normal)
plotshape(sellSignal, "SELL", shape.labeldown, location.abovebar, color.new(#dc2626, 0), text="▼ SELL", textcolor=color.white, size=size.normal)

// === DASHBOARD ===
var table dash = table.new(position.top_right, 2, 5, bgcolor=color.new(#fff, 20), border_width=1, border_color=color.new(color.gray, 80))

// Determine price position relative to cloud
priceAbove = close > math.max(leadLine1, leadLine2)
priceBelow = close < math.min(leadLine1, leadLine2)
priceInside = not priceAbove and not priceBelow

status = priceAbove ? "ABOVE CLOUD ▲" : priceBelow ? "BELOW CLOUD ▼" : "INSIDE CLOUD ⚠"
statusColor = priceAbove ? #b8893d : priceBelow ? #dc2626 : #ea580c

cloudColor = leadLine1 > leadLine2 ? "GREEN (up)" : "RED (down)"

if barstate.islast
    table.cell(dash, 0, 0, "Ichimoku Cloud", text_color=#448AFF, text_size=size.small, bgcolor=color.new(#448AFF, 85))
    table.cell(dash, 1, 0, "Status", text_color=#448AFF, text_size=size.small, bgcolor=color.new(#448AFF, 85))
    table.cell(dash, 0, 1, "Price", text_color=color.white, text_size=size.small)
    table.cell(dash, 1, 1, status, text_color=statusColor, text_size=size.small)
    table.cell(dash, 0, 2, "Cloud", text_color=color.white, text_size=size.small)
    table.cell(dash, 1, 2, cloudColor, text_color=leadLine1 > leadLine2 ? #b8893d : #dc2626, text_size=size.small)
    table.cell(dash, 0, 3, "Tenkan vs Kijun", text_color=color.white, text_size=size.small)
    table.cell(dash, 1, 3, conversionLine > baseLine ? "Up ▲" : "Down ▼", text_color=conversionLine > baseLine ? #b8893d : #dc2626, text_size=size.small)
    table.cell(dash, 0, 4, "Strong Signal", text_color=color.white, text_size=size.small)
    table.cell(dash, 1, 4, (priceAbove and conversionLine > baseLine) ? "BUY 🚀" : (priceBelow and conversionLine < baseLine) ? "SELL 📉" : "WAIT ⏸", text_color=color.white, text_size=size.small)

// === ALERTS ===
alertcondition(buySignal, "Ichimoku Buy", "Ichimoku: BUY signal — Tenkan crossed Kijun above the cloud")
alertcondition(sellSignal, "Ichimoku Sell", "Ichimoku: SELL signal — Tenkan crossed Kijun below the cloud")

How to use

  • Recommended timeframes: H1, H4, or daily (Ichimoku doesn’t work well on very short timeframes)
  • Assets: Forex, indices, stocks, crypto — works on any market with volume
  • Wait for signals where the price is clearly above or below the cloud
  • Avoid trading when the price is inside the cloud (indecision)
  • Use stop loss at the Kijun-sen (base line) or below the cloud

💡 Pro tip

Ichimoku is most powerful when you wait for the “5 confirmations”: (1) price above/below the cloud, (2) Tenkan crossing Kijun, (3) Chikou clear of past prices, (4) future cloud in the same direction, (5) volume confirming. The more confirmations, the stronger the signal.

🚀 Test Ichimoku on Deriv — free demo account:

Open Deriv Demo Account →
DM

PrimeTraderAI Team

More at Indicators & Scripts.

⚠️ Educational indicator. Trading involves risk. Disclaimer.

Similar Posts