Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Ichimoku Kinko Hyo Strategy

A Pine Script v4 strategy with no technical-analysis calculation. It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 6 settings; defaults include Tenkan-Sen Length 9, Kijun-Sen 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 Kinko Hyo Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Ichimoku Kinko Hyo Strategy do on BTCUSDT 1D with default settings?
−12.02%
From 26 Jan 2024 to 21 Oct 2026, over 3 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Ichimoku Kinko Hyo Strategy be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
What alerts does Ichimoku Kinko Hyo Strategy have?
2
Buy Signal; Sell Signal.
Does Ichimoku Kinko Hyo Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Tenkan
  • Chikou
  • SSA
  • SSB
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (6)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$880$2,025Equity from $1,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
−12.02%
−$120.17
Buy and hold
+102.5%
same period
Closed trades
3
1 won · 2 lost
Profitable
33.3%
of closed trades
Profit factor
0.78
gross profit ÷ gross loss
Max drawdown
34.06%
−$410.41

One run with the author's default settings, $1,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 97, 98. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 51

    transp = on line 51. v5 folds the transparency into the colour with color.new(c, transp).

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames avg → math.avg, lowest → ta.lowest, highest → ta.highest, min → math.min, max → math.max.
  • 2 strategy calls use the when = argument (line 97, 98). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 39: avg → math.avg
  • Line 39: lowest → ta.lowest
  • Line 39: highest → ta.highest
  • Line 45: avg → math.avg
  • Line 51: transp = 90 → color.new(ssa > ssb ? _lime : _fuchsia, 90)
4 more edits
  • Line 65: min → math.min
  • Line 66: max → math.max
  • Line 68: min → math.min
  • Line 69: max → math.max
⋯// © mdeous-//@version=4+//@version=5strategy(⋯color _aqua = color.aqua-f_donchian(_len) => avg(lowest(_len), highest(_len))+f_donchian(_len) => math.avg(ta.lowest(_len), ta.highest(_len))//⋯float kijun = f_donchian(KIJUN_LEN)-float ssa = avg(tenkan, kijun)+float ssa = math.avg(tenkan, kijun)float ssb = f_donchian(SSB_LEN)⋯_ssb = plot(SHOW_INDICATOR ? ssb : na, title="SSB", offset=OFFSET-1, color=_red)-fill(_ssa, _ssb, color=ssa > ssb ? _lime : _fuchsia, transp=90)+fill(_ssa, _ssb, color=color.new(ssa > ssb ? _lime : _fuchsia, 90))//⋯// Identify short-term trend with Tenkan-bool _above_tenkan = min(open, close) > tenkan+bool _above_tenkan = math.min(open, close) > tenkan-bool _below_tenkan = max(open, close) < tenkan+bool _below_tenkan = math.max(open, close) < tenkan// Check price position compared to Kumo-bool _above_kumo = min(open, close) > ssa+bool _above_kumo = math.min(open, close) > ssa-bool _below_kumo = max(open, close) < ssb+bool _below_kumo = math.max(open, close) < ssb// Check if Kumo is bullish or bearish⋯

Clean v5

VerifiedDownload the v5 script

Same 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 20: input() → input.int()
  • Line 21: input() → input.int()
  • Line 22: input() → input.int()
  • Line 23: input() → input.int()
  • Line 25: input() → input.int()
  • Line 29: input() → input.bool()
  • Line 97: when = go_long → if block
  • Line 98: when = exit_long → if block
⋯// Ichimoku-int TENKAN_LEN = input(title="Tenkan-Sen Length", defval=9, minval=1, step=1)+int TENKAN_LEN = input.int(title="Tenkan-Sen Length", defval=9, minval=1, step=1)-int KIJUN_LEN = input(title="Kijun-Sen Length", defval=26, minval=1, step=1)+int KIJUN_LEN = input.int(title="Kijun-Sen Length", defval=26, minval=1, step=1)-int SSB_LEN = input(title="Senkou Span B Length", defval=52, minval=1, step=1)+int SSB_LEN = input.int(title="Senkou Span B Length", defval=52, minval=1, step=1)-int OFFSET = input(title="Offset For Chikou Span / Kumo", defval=26, minval=1, step=1)+int OFFSET = input.int(title="Offset For Chikou Span / Kumo", defval=26, minval=1, step=1)// Strategy-int COOLDOWN = input(title="Orders Cooldown Period", defval=5, minval=0, step=1)+int COOLDOWN = input.int(title="Orders Cooldown Period", defval=5, minval=0, step=1)// bool USE_CHIKOU = input(title="Use Imperfect Chikou Position Detection", defval=false)⋯// Display-bool SHOW_INDICATOR = input(title="Show Ichimoku Kinko Hyo Indicator", defval=true)+bool SHOW_INDICATOR = input.bool(title="Show Ichimoku Kinko Hyo Indicator", defval=true)//⋯//-strategy.entry("buy", strategy.long, when=go_long)+if go_long+    strategy.entry("buy", strategy.long)-strategy.close_all(when=exit_long)+if exit_long+    strategy.close_all()//⋯

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 3 before, 2 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © mdeous-//@version=5+//@version=6strategy(⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Tenkan-Sen Length9int · min 1 · step 1tenkan
Kijun-Sen Length26int · min 1 · step 1kijun
Senkou Span B Length52int · min 1 · step 1ssb
Offset For Chikou Span / Kumo26int · min 1 · step 1SSA SSB _chikou_val _last_val Chikou
Orders Cooldown Period5int · min 0 · step 1go_long line 88
Show Ichimoku Kinko Hyo IndicatortrueboolSSA SSB Tenkan Chikou

What it calculates

No technical-analysis calculation: the script works on prices and settings directly.

Signal flow

How price data and settings reach the orders. 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.

TENKAN_LENTenkan-Sen Lengthsetting · 9KIJUN_LENKijun-Sen Lengthsetting · 26SSB_LENSenkou Span B Lengthsetting · 52closecloseprice dataOFFSETOffset For Chikou Span …setting · 26COOLDOWNOrders Cooldown Periodsetting · 5openopenprice datatenkantenkanvaluekijunkijunvaluessassavaluessbssbvalue_chikou_val, _last_val_chikou_val · _last_val2 valuesabove_chikou, below_chikouabove_chikou · below_ch…2 valuesgo_longgo_longvalueexit_longexit_longcondition_above_tenkan, _below_tenkan_above_tenkan · _below_…2 conditions_above_kumo, buy1_above_kumo · buy12 conditions_below_kumo, sell1_below_kumo · sell12 conditionsbullish_kumo, bearish_kumo, buy2, sell2bullish_kumo · bearish_…4 conditionsbullish_trendbullish_trendconditionbearish_trendbearish_trendcondition_red, _blue, _lime, _fuchsia, _silver, _aquaColour_red · _blue +4entry:buyOpen buystrategy.entryclose_all:close_all strategy.close_allplot:47Tenkanplotplot:48Chikouplotplot:49SSAplotplot:50SSBplotfill:51Fillfillalertcondition:102Buy Signalalertconditionalertcondition:107Sell Signalalertcondition

Order rules

OrderFires whenBy defaultLine
Open buy longgo_longOn97
Close exit_longabove_chikou and (bearish_trend and (sell1 or sell2))On98

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
Buy Signalalertcondition{{exchange}}:{{ticker}}: A buy signal for {{strategy.position_size}} units has been detected (last close: {{close}}).102
Sell Signalalertcondition{{exchange}}:{{ticker}}: A sell signal for {{strategy.position_size}} units has been detected (last close: {{close}}).107

Does it repaint?

No

No repainting patterns in the source.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

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 row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−12.0%+102.5%333%0.7834.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+21.9%+5.5%540%3.336.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+24.8%+9.8%333%1.4844.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+59.3%+8.4%3100%—2.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−31.8%+16.7%540%0.2960.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+46.3%+21.5%667%7.965.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+16.0%+148.3%250%3.1823.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.9%+17.1%633%0.9111.5%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market10%−$213.68
Sideways market250%$93.51
Falling market0—$0.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

42.6%

The 95th percentile of the worst drawdown when the same 3 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 27.0% to 42.6%; the tick is what actually happened, 27.0%. Order luck alone moves it this much.

0%49%
All 3 trades
SideEntryExitBarsP&L
long21 May 2024 71,446.606 Sep 2024 56,180.00108−$213.68
long20 Sep 2024 62,948.0010 Feb 2025 96,462.80143$418.65
long4 Oct 2025 122,232.0028 Jan 2026 89,250.00116−$325.14

Similar scripts

No other indicator or strategy here shares enough of its calculations.

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 21 msYes 1,000 bars in 55 msNot measured
PineTSNo v5 and v6 only—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. PineTS runs Pine Script v5 and v6 only.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © mdeous//@version=4strategy(     title="Ichimoku Kinko Hyo Strategy",      shorttitle="Ichimoku Strategy",      overlay=true,     pyramiding=0,     default_qty_type=strategy.percent_of_equity,     default_qty_value=100,     initial_capital=1000,     currency="USD",     commission_type=strategy.commission.percent,     commission_value=0.0     )//// SETTINGS//// Ichimokuint TENKAN_LEN = input(title="Tenkan-Sen Length", defval=9, minval=1, step=1)int KIJUN_LEN = input(title="Kijun-Sen Length", defval=26, minval=1, step=1)int SSB_LEN = input(title="Senkou Span B Length", defval=52, minval=1, step=1)int OFFSET = input(title="Offset For Chikou Span / Kumo", defval=26, minval=1, step=1)// Strategyint COOLDOWN = input(title="Orders Cooldown Period", defval=5, minval=0, step=1)// bool USE_CHIKOU = input(title="Use Imperfect Chikou Position Detection", defval=false)bool USE_CHIKOU = false// Displaybool SHOW_INDICATOR = input(title="Show Ichimoku Kinko Hyo Indicator", defval=true)//// HELPERS//color _red = color.redcolor _blue = color.bluecolor _lime = color.limecolor _fuchsia = color.fuchsiacolor _silver = color.silvercolor _aqua = color.aquaf_donchian(_len) => avg(lowest(_len), highest(_len))//// ICHIMOKU INDICATOR//float tenkan = f_donchian(TENKAN_LEN)float kijun = f_donchian(KIJUN_LEN)float ssa = avg(tenkan, kijun)float ssb = f_donchian(SSB_LEN)plot(SHOW_INDICATOR ? tenkan : na, title="Tenkan", color=_silver)plot(SHOW_INDICATOR ? close : na, title="Chikou", offset=-OFFSET+1, color=_aqua)_ssa = plot(SHOW_INDICATOR ? ssa : na, title="SSA", offset=OFFSET-1, color=_lime)_ssb = plot(SHOW_INDICATOR ? ssb : na, title="SSB", offset=OFFSET-1, color=_red)fill(_ssa, _ssb, color=ssa > ssb ? _lime : _fuchsia, transp=90)//// STRATEGY//// Check if price is "above or below" Chikou (i.e. historic price line):// This detection is highly imperfect, as it can only know what was Chikou's// position 2*offset candles in the past, therefore if Chikou crossed the price// line in the last 2*offset periods it won't be detected.// Use of this detection is disabled by default.float _chikou_val = close[OFFSET*2+1]float _last_val = close[OFFSET+1]bool above_chikou = USE_CHIKOU ? _last_val > _chikou_val : truebool below_chikou = USE_CHIKOU ? _last_val < _chikou_val : true// Identify short-term trend with Tenkanbool _above_tenkan = min(open, close) > tenkanbool _below_tenkan = max(open, close) < tenkan// Check price position compared to Kumobool _above_kumo = min(open, close) > ssabool _below_kumo = max(open, close) < ssb// Check if Kumo is bullish or bearishbool bullish_kumo = ssa > ssbbool bearish_kumo = ssa < ssb// Correlate indicators to confirm the trendbool bullish_trend = _above_tenkan and _above_kumo and bullish_kumobool bearish_trend = _below_tenkan and _below_kumo and bearish_kumo// Build signalsbool buy1 = (close > open) and ((close > ssa) and (open < ssa)) // green candle crossing over SSAbool buy2 = bullish_kumo and bearish_kumo[1] // bullish Kumo twistbool sell1 = (close < open) and ((close < ssb) and (open > ssb)) // red candle crossing under SSBbool sell2 = bearish_kumo and bullish_kumo[1] // bearish Kumo twistbool go_long = below_chikou and (bullish_trend and (buy1 or buy2))bool exit_long = above_chikou and (bearish_trend and (sell1 or sell2))//// COOLDOWN//f_cooldown() =>    _cd_needed = false    for i = 1 to COOLDOWN by 1        if go_long[i]            _cd_needed := true            break    _cd_neededgo_long := COOLDOWN == 0 ? go_long : (f_cooldown() ? false : go_long)//// ORDERS//strategy.entry("buy", strategy.long, when=go_long)strategy.close_all(when=exit_long)//// ALERTS//alertcondition(     condition=go_long,     title="Buy Signal",     message="{{exchange}}:{{ticker}}: A buy signal for {{strategy.position_size}} units has been detected (last close: {{close}})."     )alertcondition(     condition=exit_long,     title="Sell Signal",     message="{{exchange}}:{{ticker}}: A sell signal for {{strategy.position_size}} units has been detected (last close: {{close}})."     )