Strategy · Pine Script v5 · On the chart

Ichimoku Kinko Hyo: Tenkan Kumo Strategy

by SynergOps· code credited to Salih Emin (cerebrux)

An Ichimoku-based trading strategy that plots the complete Ichimoku Kinko Hyo system directly on the price chart.

View on GitHub

GitHub stars7on the repository
Pine versionv5runs as is
Lines of code63
Settings7inputs
LicenceMPL-2.0
Last update1 year ago4 Aug 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

63 lines of Pine Script v5 from Ichimoku Kink Hyo - Strategy/3 - Tenkan Kumo Strategy/ichimoku Tenkan Kumo.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

ichimoku Tenkan Kumo.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Salih Emin (cerebrux)

//@version=5
strategy('Ichimoku Kinko Hyo: Tenakan Kumo Strategy', overlay=true, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, initial_capital = 1000)
// Trading periods
start = timestamp(2017, 6, 1, 0, 0) // use data from 2000
end = timestamp(2099, 6, 1, 0, 0) // until 2099
//Inputs
Tenkan_sen = input.int(9, minval=1, title='Tenkan-Sen')
Kijun_sen = input.int(26, minval=1, title='Kijun-Sen')
Senku_spanB = input.int(52, minval=1, title='Senkou-Span B')
Chiku_span_offset = input.int(26, minval=1, title='Chikou-Span Offset')
Kumo_offset = input.int(26, minval=1, title='Kumo Offset')

middle(len) => math.avg(ta.lowest(len), ta.highest(len))

// Ichimoku Components
tenkan = middle(Tenkan_sen)
kijun = middle(Kijun_sen)
senkouA = math.avg(tenkan, kijun)
senkouB = middle(Senku_spanB)

// Plot Ichimoku Kinko Hyo
plot(tenkan, color=color.new(#0496ff, 0), title='Tenkan-Sen')
plot(kijun, color=color.new(#991515, 0), title='Kijun-Sen')
plot(close, offset=-Chiku_span_offset + 1, color=color.new(#459915, 0), title='Chikou-Span')
senkouAplot = plot(senkouA, offset=Kumo_offset - 1, color=color.new(color.green, 0), title='Senkou-Span A')
senkouBplot = plot(senkouB, offset=Kumo_offset - 1, color=color.new(color.red, 0), title='Senkou-Span B')
fill(senkouAplot, senkouBplot, color = senkouA > senkouB ? color.rgb(67, 160, 71, 90) : color.rgb(244, 67, 54, 90), title='Cloud color')

ss_high = math.max(senkouA[Kumo_offset - 1], senkouB[Kumo_offset - 1])
ss_low = math.min(senkouA[Kumo_offset - 1], senkouB[Kumo_offset - 1])

// Entry Signals

// Conditions for Long
long_entry = input(true, title='Long Entry')
tk_cross_bull = tenkan > kijun
tenkan_above_kumo = tenkan > ss_high

// long signal when above conditions allign
bullish = tk_cross_bull and tenkan_above_kumo

// Conditions for Short
short_entry = input(true, title='Short Entry')
tk_cross_bear = tenkan < kijun
tenkan_below_kumo = tenkan < ss_low

// short signal when above conditions allign
bearish = tk_cross_bear and tenkan_below_kumo

//Closing conditions
closeLong = tk_cross_bear
closeShort = tk_cross_bull

// Signals Long
if time >= start and time <= end // trade only on the specified period
    strategy.entry('Long', strategy.long, when=bullish)
    strategy.close('Long', when=closeLong, qty_percent = 100, comment = "close buy entry")
    
    strategy.entry('Short', strategy.short, when=bearish)
    strategy.close('Short', when=closeShort, qty_percent = 100, comment = "close short entry")

Overview

Long signals trigger when Tenkan-Sen is above Kijun-Sen and positioned above the current Kumo cloud, exiting when Tenkan-Sen falls below Kijun-Sen. Short signals trigger when Tenkan-Sen is below Kijun-Sen and below the Kumo cloud, exiting when Tenkan-Sen rises above Kijun-Sen. Settings allow adjusting the lengths and offsets of Ichimoku elements. The strategy has no defined stop loss or take profit rules.

Details

Published by

SynergOps on GitHub

Code credit

Salih Emin (cerebrux), as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Tenkan-Senint9Tenkan_sen
Kijun-Senint26Kijun_sen
Senkou-Span Bint52Senku_spanB
Chikou-Span Offsetint26Chiku_span_offset
Kumo Offsetint26Kumo_offset
Long Entrybooltruelong_entry
Short Entrybooltrueshort_entry
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated today · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout

Omar Edited WF

by Alorse
330 stars

Omar Edited WF is a trading strategy overlay built around Williams Fractals and multiple Exponential Moving Averages. It detects high and low fractal pivot points over configurable lookback periods alongside three adjustable EMA trendlines. Long entries are ma

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of Omar Edited WF
257 stars

This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross

Strategy v5 TrendSupport & resistance Repaints
Updated 6 weeks ago · None stated GitHub repository of 30s - ES 1m Strategy Candle Bar
106 stars

This overlay strategy plots a two-timeframe Ichimoku setup on the price chart, with Tenkan, Kijun, Chikou, and Kumo from a base higher timeframe and an optional highest-timeframe cloud. It allows two entries in the same direction and uses ATR-based trailing st

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of 2Tier Ichimoku Pyramiding [Takazudo]
104 stars

This strategy combines three Exponential Moving Averages with Williams Fractals to execute trend-following or mean-reverting trades. It analyzes price structure using short, medium, and long-term EMAs along with fractal highs and lows. Entries trigger when fra

Strategy v5 TrendMoving averages
Updated 3 years ago · MIT GitHub repository of 3MA and Fractals Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers