Ichimoku Kijun Cloud Script

← All 56 scripts

  • Trend
  • On price
  • Advanced

Marks a close back across the Kijun-sen when price is already on the trend side of a coloured Ichimoku cloud. The cloud sets direction and the Kijun cross sets the timing.

  • File iqow-ichimoku-kijun-cloud.lua
  • Version 1.0.0
  • Size 161 lines · 6 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
Ichimoku Kijun Cloud drawn on synthetic candles
How the script draws, shown on synthetic candles generated for testing. It is an illustration of the markers and lines, not real market data or a result.

The rules

HIGHER marker

The cloud is green (Span A above Span B), the close is above the cloud, and the close crosses back above the Kijun-sen after the previous close was at or below it.

LOWER marker

The cloud is red (Span A below Span B), the close is below the cloud, and the close crosses back below the Kijun-sen after the previous close was at or above it.

A marker appears after the next candle opens and is drawn on the candle that completed the setup. It is a chart observation, not an instruction to trade.

How to read it

The shaded area is the cloud: green when Span A is above Span B, red otherwise. The blue line is the Tenkan-sen and the orange line is the Kijun-sen. A green HIGHER triangle under a candle means price is above a green cloud and just closed back above the Kijun-sen; a red LOWER triangle above a candle is the mirror case below a red cloud.

Indicators used

  • Ichimoku Cloud (9, 26, 52, displacement 26)

Same view with built-in indicators: Add IQ Option's Ichimoku Clouds with Tenkan 9, Kijun 26 and Senkou Span B 52.

Default settings

Tenkan period9
Kijun period26
Senkou Span B period52
Cloud displacement26

Every value is an input in the script settings. Platform advice is off by default.

Key points

  1. Ichimoku looks complicated, but this setup uses only the cloud and the Kijun-sen.
  2. A green cloud means Span A is above Span B. We want price above the whole cloud.
  3. The Kijun-sen is the 26-candle midpoint. A pullback below it and a close back above it is our timing event.
  4. All three together are marked HIGHER.
  5. A red cloud, price below it, and a close back below the Kijun-sen are marked LOWER.
  6. The cloud is shifted forward by 26 candles, as on the native indicator. Test it on the Practice balance.

Limitations. The cloud and Kijun-sen are built from long windows, so they react late and need about 78 candles of history. In sideways markets price keeps crossing the Kijun-sen without leaving the cloud, so markers only appear when price is clearly outside it. Test on the Practice balance before risking real funds.

Learn the strategy: read the full guide on IQOptionWiki →

Install it in four steps

  1. Download and inspectDownload one .lua file and open it in a plain-text editor if you want to read it first. If you downloaded the ZIP, extract it.
  2. Open Chart Analysis → ScriptsIn the IQ Option traderoom, choose the Practice balance, open the chart analysis panel, select Scripts and choose Import script.
  3. Save and add to chartSelect the downloaded file, review the imported code, choose Save, then use the + control to add it to the chart.
  4. Change one input at a timeConfirm the default view first. Then adjust periods, levels or colours one setting at a time and note what changes.

Complete source code

The download and this preview resolve to the same reviewed file. SHA-256: d4cd30abb5ac2a2618a59011b1eae505a2a3047f4d53ed78061813f79f9e21da

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Ichimoku Kijun Cloud v1.0.0
--
-- Ichimoku Cloud (9, 26, 52, displacement 26; formulas from the official
-- Quadcode script). The cloud colour gives the trend (Span A above Span B is
-- green), price outside the cloud confirms it, and a close back across the
-- Kijun-sen gives the timing.
--
-- HIGHER: green cloud (Span A above Span B), close above the cloud, and a
--         close back above the Kijun-sen after the previous close was at or
--         below it.
-- LOWER:  red cloud (Span A below Span B), close below the cloud, and a
--         close back below the Kijun-sen after the previous close was at or
--         above it.
--
-- Markers use the previous completed candle: they appear after the next candle
-- opens and are shifted back one bar onto the candle that qualified.
-- Educational chart tool only. It does not place trades, choose an expiry,
-- predict outcomes, or guarantee results. Test on a Practice balance first.

instrument {
    name = "IQOW Ichimoku Kijun Cloud",
    short_name = "IQOW KIJUN",
    overlay = true
}

input_group {
    "1. Ichimoku settings",
    tenkan_period = input (9, "Tenkan period", input.integer, 2, 100),
    kijun_period = input (26, "Kijun period", input.integer, 2, 200),
    span_b_period = input (52, "Senkou Span B period", input.integer, 2, 300),
    displacement = input (26, "Cloud displacement", input.integer, 1, 100)
}

input_group {
    "Display and advice",
    lines_visible = input { default = true, type = input.plot_visibility },
    cloud_visible = input { default = true, type = input.plot_visibility },
    signals_visible = input { default = true, type = input.plot_visibility },
    advice_enabled = input { default = false, name = "Enable platform advice", type = input.boolean }
}

input_group {
    "Colors",
    tenkan_color = input { default = rgba(86, 206, 255, 0.8), type = input.color },
    kijun_color = input { default = "#FF9F43", type = input.color },
    span_a_color = input { default = rgba(37, 225, 84, 0.7), type = input.color },
    span_b_color = input { default = rgba(255, 108, 88, 0.7), type = input.color },
    green_cloud_color = input { default = rgba(37, 225, 84, 0.15), type = input.color },
    red_cloud_color = input { default = rgba(255, 108, 88, 0.15), type = input.color },
    line_width = input { default = 1, type = input.line_width },
    higher_color = input { default = "#25E154", type = input.color },
    lower_color = input { default = "#FF6C58", type = input.color },
    signal_text_color = input { default = "#FFFFFF", type = input.color }
}

-- Ichimoku lines: midpoints of the highest high and lowest low.
tenkan_line = (highest (high, tenkan_period) + lowest (low, tenkan_period)) / 2
kijun_line = (highest (high, kijun_period) + lowest (low, kijun_period)) / 2
senkou_a = (tenkan_line + kijun_line) / 2
senkou_b = (highest (high, span_b_period) + lowest (low, span_b_period)) / 2

-- The cloud drawn at this candle was calculated `displacement` candles ago.
cloud_a = senkou_a [displacement]
cloud_b = senkou_b [displacement]

-- Current-bar scalars for the Lua rule logic.
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local kijun_now = get_value (kijun_line, nil)
local kijun_previous = get_value (kijun_line [1], nil)
local cloud_a_now = get_value (cloud_a, nil)
local cloud_b_now = get_value (cloud_b, nil)

-- The cloud needs the Span B period plus the displacement of history.
local has_history = get_value (close [span_b_period + displacement], nil) ~= nil

local data_is_ready =
    has_history and
    close_now ~= nil and
    close_previous ~= nil and
    kijun_now ~= nil and
    kijun_previous ~= nil and
    cloud_a_now ~= nil and
    cloud_b_now ~= nil

local green_cloud = data_is_ready and cloud_a_now > cloud_b_now
local red_cloud = data_is_ready and cloud_a_now < cloud_b_now

-- Price outside the cloud: above the top edge, or below the bottom edge.
local above_cloud = data_is_ready and close_now > cloud_a_now and close_now > cloud_b_now
local below_cloud = data_is_ready and close_now < cloud_a_now and close_now < cloud_b_now

-- Event: the close crosses back over the Kijun-sen on this candle.
local crosses_above_kijun = data_is_ready and close_previous <= kijun_previous and close_now > kijun_now
local crosses_below_kijun = data_is_ready and close_previous >= kijun_previous and close_now < kijun_now

higher_setup = conditional (green_cloud and above_cloud and crosses_above_kijun)
lower_setup = conditional (red_cloud and below_cloud and crosses_below_kijun)

-- Confirm only a new setup on the previous completed candle.
confirmed_higher = conditional (
    get_value (higher_setup [1], false) and
    not get_value (higher_setup [2], false)
)

confirmed_lower = conditional (
    get_value (lower_setup [1], false) and
    not get_value (lower_setup [2], false)
)

if cloud_visible then
    fill (cloud_a, cloud_b, "Ichimoku cloud", iff (cloud_a > cloud_b, green_cloud_color, red_cloud_color))
end

if lines_visible then
    plot (tenkan_line, "Tenkan-sen", tenkan_color, line_width)
    plot (kijun_line, "Kijun-sen", kijun_color, line_width)
    plot (cloud_a, "Senkou Span A", span_a_color, line_width)
    plot (cloud_b, "Senkou Span B", span_b_color, line_width)
end

if signals_visible then
    plot_shape (
        confirmed_higher,
        "KIJUN HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "KIJUN LOWER",
        shape_style.triangledown,
        shape_size.small,
        lower_color,
        shape_location.abovebar,
        -1,
        "LOWER",
        signal_text_color
    )
end

-- QCS advice is a platform notification state only; it does not place trades.
if advice_enabled and
    get_value (confirmed_higher, false) and
    not get_value (confirmed_lower, false) then
    advise (advice.buy)
elseif advice_enabled and
    get_value (confirmed_lower, false) and
    not get_value (confirmed_higher, false) then
    advise (advice.sell)
else
    advise (advice.neutral)
end

More trend scripts

  • Trend
  • Own panel
  • Intermediate

Trend Intensity Index

Marks the moment the Trend Intensity Index enters its strong zone: above 80 for upward pressure or below 20 for downward pressure, with the close on the matching side of the 60-period SMA. It is a trend-strength entry marker, not a reversal marker.

Indicators: Trend Intensity Index (30, SMA 60)

  • Trend
  • On price
  • Intermediate

VHF EMA Cross

Marks EMA 9 and EMA 21 crosses only while the Vertical Horizontal Filter reports a trending market. The filter removes crosses that happen during sideways price action, where moving-average crosses tend to be unreliable.

Indicators: Vertical Horizontal Filter (28, 0.35) · EMA (9) · EMA (21)

  • Trend
  • Own panel
  • Intermediate

Vortex MACD

Marks a Vortex VI+/VI- cross when the MACD line is on the matching side of its signal line. The Vortex cross shows which direction dominates and the MACD checks that momentum agrees.

Indicators: Vortex Indicator (21) · MACD (12, 26, 9)

Download all 56 scripts as one ZIP · MIT License, provided “as is”, without warranty. IQOptionWiki is independent of the IQ Option platform operator. Nothing here is investment advice or a guarantee of results.

GENERAL RISK WARNING

The financial products offered by the company carry a high level of risk and can result in the loss of all your funds. You should never invest money that you cannot afford to lose.
Kindly note that this article does not provide any investment advice. The information presented regarding past events or potential future developments is solely an opinion and cannot be guaranteed as factual, including the provided examples. We caution readers accordingly.