Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Ichimoku Cloud Strategy v2.0

A Pine Script v4 strategy built on Crossover (conversionLine, baseLine). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 4 settings; defaults include Conversion Line Periods 9, Base Line Periods 26 and Lagging Span 2 Periods 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 Cloud Strategy v2.0 repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 11 of 11 trades.
How did Ichimoku Cloud Strategy v2.0 do on BTCUSDT 1D with default settings?
−28.69%
From 26 Jan 2024 to 21 Oct 2026, over 42 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Ichimoku Cloud Strategy v2.0 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.
Does Ichimoku Cloud Strategy v2.0 use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Ichimoku Cloud Strategy v2.0 run in Zeal Terminal?
Yes
It compiles in 9 ms and runs 1,000 bars in 37 ms, in the browser.

BTCUSDT · 1D · default settings

  • Conversion Line
  • Base Line
  • Lagging Span
  • Lead 1
  • Lead 2
  • 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 (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$68,283$202,527Equity from $100,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
−28.69%
−$28,693.20
Buy and hold
+102.5%
same period
Closed trades
42
13 won · 29 lost
Profitable
31.0%
of closed trades
Profit factor
0.83
gross profit ÷ gross loss
Max drawdown
62.30%
−$62,321.20

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A short position was still open at the last bar. 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.

  • Note

    No slippage

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

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, crossover → ta.crossover.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 11: avg → math.avg
  • Line 11: lowest → ta.lowest
  • Line 11: highest → ta.highest
  • Line 14: avg → math.avg
  • Line 25: crossover → ta.crossover
  • Line 28: crossover → ta.crossover
⋯// © iamskrv-//@version=4+//@version=5strategy("Ichimoku Cloud Strategy v2.0", overlay=true)⋯displacement = input(26, minval=1, title="Displacement")-donchian(len) => avg(lowest(len), highest(len))+donchian(len) => math.avg(ta.lowest(len), ta.highest(len))conversionLine = donchian(conversionPeriods)baseLine = donchian(basePeriods)-leadLine1 = avg(conversionLine, baseLine)+leadLine1 = math.avg(conversionLine, baseLine)leadLine2 = donchian(laggingSpan2Periods)⋯// Strategy-longCondition = crossover(conversionLine,baseLine)+longCondition = ta.crossover(conversionLine,baseLine)if (longCondition)    strategy.entry("Buy", strategy.long)-shortCondition = crossover(baseLine, conversionLine)+shortCondition = ta.crossover(baseLine, conversionLine)if (shortCondition)⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 7: input() → input.int()
  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
⋯// study(title="Ichimoku Cloud", shorttitle="Ichimoku", overlay=true)-conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),+conversionPeriods = input.int(9, minval=1, title="Conversion Line Periods"),-basePeriods = input(26, minval=1, title="Base Line Periods")+basePeriods = input.int(26, minval=1, title="Base Line Periods")-laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),+laggingSpan2Periods = input.int(52, minval=1, title="Lagging Span 2 Periods"),-displacement = input(26, minval=1, title="Displacement")+displacement = input.int(26, minval=1, title="Displacement")donchian(len) => math.avg(ta.lowest(len), ta.highest(len))⋯

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: 42 before, 29 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.

⋯// © iamskrv-//@version=5+//@version=6strategy("Ichimoku Cloud Strategy v2.0", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
Conversion Line Periods9int · min 1conversionLine
Base Line Periods26int · min 1baseLine
Lagging Span 2 Periods52int · min 1leadLine2
Displacement26int · min 1Lead 1 Lead 2 Lagging Span

What it calculates

  • Crossover (crossover, ta.crossover in v5)conversionLine, baseLinelongCondition · line 25
  • Crossover (crossover, ta.crossover in v5)baseLine, conversionLineshortCondition · line 28

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.

conversionPeriodsConversion Line Periodssetting · 9basePeriodsBase Line Periodssetting · 26laggingSpan2PeriodsLagging Span 2 Periodssetting · 52closecloseprice datalongConditionCrossover→ longConditionshortConditionCrossover→ shortConditionconversionLineconversionLinevaluebaseLinebaseLinevalueleadLine1leadLine1valueleadLine2leadLine2valueentry:BuyOpen Buystrategy.entryentry:ShortOpen Shortstrategy.entryplot:16Conversion Lineplotplot:17Base Lineplotplot:18Lagging Spanplotplot:19Lead 1plotplot:21Lead 2plotfill:23Fillfill

Order rules

OrderFires whenBy defaultLine
Open Buy long(longCondition)On27
Open Short short(shortCondition)On30

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

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

11/11trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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−28.7%+102.5%4231%0.8362.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−15.2%+5.5%4734%0.7120.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.5%+9.8%4432%0.933.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.4%+8.4%4637%1.400.3%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.1%+16.7%4443%1.270.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%4732%1.210.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.2%+148.3%4436%1.200.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%5338%1.190.1%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 market1533%−$24,421.50
Sideways market1631%−$9,707.33
Falling market1127%$5,435.60

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

How bad could the drawdown be?

75.8%

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

0%87%
All 42 trades
SideEntryExitBarsP&L
short26 Mar 2024 69,880.0030 Mar 2024 69,850.504$29.47
long30 Mar 2024 69,850.5018 Apr 2024 61,277.4019−$8,573.15
short18 Apr 2024 61,277.4012 May 2024 60,826.0024$451.39
long12 May 2024 60,826.0017 Jun 2024 66,676.9036$5,850.87
short17 Jun 2024 66,676.9017 Jul 2024 65,044.0030$1,632.86
long17 Jul 2024 65,044.008 Aug 2024 55,133.8022−$9,910.24
short8 Aug 2024 55,133.8024 Aug 2024 64,037.2016−$8,903.48
long24 Aug 2024 64,037.205 Sep 2024 57,970.9012−$6,066.34
short5 Sep 2024 57,970.9020 Sep 2024 62,948.0015−$4,977.10
long20 Sep 2024 62,948.0011 Oct 2024 60,326.4021−$2,621.60
short11 Oct 2024 60,326.4020 Oct 2024 68,378.009−$8,051.59
long20 Oct 2024 68,378.0027 Dec 2024 95,791.6068$27,413.60
short27 Dec 2024 95,791.6023 Jan 2025 103,707.0027−$7,915.06
long23 Jan 2025 103,707.004 Feb 2025 101,329.0012−$2,378.15
short4 Feb 2025 101,329.0029 Mar 2025 84,424.4053$16,904.10
long29 Mar 2025 84,424.407 Apr 2025 78,430.009−$5,994.38
short7 Apr 2025 78,430.0019 Apr 2025 84,474.7012−$6,044.70
long19 Apr 2025 84,474.706 Jun 2025 101,509.0048$17,034.00
short6 Jun 2025 101,509.0016 Jun 2025 105,594.0010−$4,085.33
long16 Jun 2025 105,594.0022 Jun 2025 102,120.006−$3,474.00
short22 Jun 2025 102,120.003 Jul 2025 108,850.0011−$6,729.57
long3 Jul 2025 108,850.005 Aug 2025 115,055.0033$6,205.44
short5 Aug 2025 115,055.0013 Aug 2025 120,134.008−$5,079.06
long13 Aug 2025 120,134.0024 Aug 2025 115,438.0011−$4,696.03
short24 Aug 2025 115,438.0013 Sep 2025 116,029.0020−$591.35
long13 Sep 2025 116,029.0028 Sep 2025 109,636.0015−$6,393.56
short28 Sep 2025 109,636.006 Oct 2025 123,482.008−$13,846.50
long6 Oct 2025 123,482.0016 Oct 2025 110,763.0010−$12,719.00
short16 Oct 2025 110,763.0011 Dec 2025 92,015.4056$18,747.90
long11 Dec 2025 92,015.4020 Dec 2025 88,136.909−$3,878.43
short20 Dec 2025 88,136.906 Jan 2026 93,859.7017−$5,722.76
long6 Jan 2026 93,859.7024 Jan 2026 89,600.3018−$4,259.45
short24 Jan 2026 89,600.304 Mar 2026 68,338.0039$21,262.30
long4 Mar 2026 68,338.0028 Mar 2026 66,407.3024−$1,930.73
short28 Mar 2026 66,407.3013 Apr 2026 70,741.6016−$4,334.28
long13 Apr 2026 70,741.6023 May 2026 75,539.5040$4,797.94
short23 May 2026 75,539.5012 Jul 2026 63,819.0050$11,720.50
long12 Jul 2026 63,819.002 Aug 2026 62,823.7021−$995.36
short2 Aug 2026 62,823.7020 Aug 2026 69,334.8018−$6,511.13
long20 Aug 2026 69,334.8017 Sep 2026 76,206.0028$6,871.22
short17 Sep 2026 76,206.0025 Sep 2026 84,410.208−$8,204.24
long25 Sep 2026 84,410.2015 Oct 2026 81,682.0020−$2,728.22

Similar scripts

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

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msYes 1,000 bars in 37 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/// © iamskrv//@version=4strategy("Ichimoku Cloud Strategy v2.0", overlay=true)//@version=4// study(title="Ichimoku Cloud", shorttitle="Ichimoku", overlay=true)conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),basePeriods = input(26, minval=1, title="Base Line Periods")laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),displacement = input(26, minval=1, title="Displacement")donchian(len) => avg(lowest(len), highest(len))conversionLine = donchian(conversionPeriods)baseLine = donchian(basePeriods)leadLine1 = avg(conversionLine, baseLine)leadLine2 = donchian(laggingSpan2Periods)plot(conversionLine, color=#0496ff, title="Conversion Line")plot(baseLine, color=#991515, title="Base Line")plot(close, offset = -displacement + 1, color=#459915, title="Lagging Span")p1 = plot(leadLine1, offset = displacement - 1, color=color.green, title="Lead 1")p2 = plot(leadLine2, offset = displacement - 1, color=color.red,  title="Lead 2")fill(p1, p2, color = leadLine1 > leadLine2 ? color.green : color.red)// StrategylongCondition = crossover(conversionLine,baseLine)if (longCondition)    strategy.entry("Buy", strategy.long)shortCondition = crossover(baseLine, conversionLine)if (shortCondition)    strategy.entry("Short", strategy.short)