Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Ichimoku Cloud with ADX (By Coinrule)

A Pine Script v5 strategy built on DMI (14, 14). It has 4 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 commits 30% of equity and pays 0.1% commission. 10 settings; defaults include Stop loss 1, Take profit 5 and Tenkan-Sen Bars 9.

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 with ADX (By Coinrule) repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
How did Ichimoku Cloud with ADX (By Coinrule) do on BTCUSDT 1D with default settings?
−16.78%
From 26 Jan 2024 to 21 Oct 2026, over 6 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Ichimoku Cloud with ADX (By Coinrule) run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L39:C85: 'fill' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
Does Ichimoku Cloud with ADX (By Coinrule) use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Ichimoku Cloud with ADX (By Coinrule) run in Zeal Terminal?
Yes
It compiles in 17 ms and runs 1,000 bars in 61 ms, in the browser.

BTCUSDT · 1D · default settings

  • Tenkan-Sen
  • Kijun-Sen
  • Chikou-Span
  • Senkou-Span A
  • Senkou-Span B
  • 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 (10)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$887$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
−16.78%
−$167.81
Buy and hold
+102.5%
same period
Closed trades
6
1 won · 5 lost
Profitable
16.7%
of closed trades
Profit factor
0.27
gross profit ÷ gross loss
Max drawdown
21.88%
−$232.47

One run with the author's default settings, $1,000 starting capital, commission as the script sets it. A long 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

    1 setting does nothing

    “Show Date Range” is declared but never read.

  • Check

    No stop loss

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

  • Note

    2 settings have no label

    In the settings dialog Stop_loss (line 15), Take_profit (line 16) show an empty name. The labels on this page come from the variable names.

  • 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 53, 54, 55, 56. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Show Date Rangetrueboolunused
Stop loss (no label in the script)1intlongStopPrice
Take profit (no label in the script)5intlongTakeProfit
Tenkan-Sen Bars9int · min 1tenkan
Kijun-Sen Bars26int · min 1kijun
Senkou-Span B Bars52int · min 1senkouB
Chikou-Span Offset26int · min 1cs_cross_bull cs_cross_bear Chikou-Span
Senkou-Span Offset26int · min 1Senkou-Span A Senkou-Span B ss_high ss_low
Long Entrytrueboolentry Long close Short
Short Entrytrueboolclose Long entry Short

What it calculates

  • DMI14, 14pos_dm · line 43
  • DMI14, 14neg_dm · line 43
  • DMI14, 14avg_dm · line 43

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.

high · low · closehigh · low · closeprice dataStop_lossStop losssetting · 1Take_profitTake profitsetting · 5ts_barsTenkan-Sen Barssetting · 9ks_barsKijun-Sen Barssetting · 26ssb_barsSenkou-Span B Barssetting · 52ss_offsetSenkou-Span Offsetsetting · 26timetimeprice dataclosecloseprice datacs_offsetChikou-Span Offsetsetting · 26pos_dmDMI→ pos_dmneg_dmDMI→ neg_dmavg_dmDMI→ avg_dmlongStopPricelongStopPricevaluelongTakeProfitlongTakeProfitvaluetenkantenkanvaluekijunkijunvaluesenkouAsenkouAvaluesenkouBsenkouBvaluess_high, ss_lowss_high · ss_low2 valuestimePeriodtimePeriodconditiontk_cross_bull, tk_cross_beartk_cross_bull · tk_cros…2 conditionscs_cross_bull, cs_cross_bearcs_cross_bull · cs_cros…2 conditionsprice_above_kumo, price_below_kumoprice_above_kumo · pric…2 conditionsbullishbullishconditionbearishbearishconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:34Tenkan-Senplotplot:35Kijun-Senplotplot:36Chikou-Spanplotplot:37Senkou-Span Aplotplot:38Senkou-Span Bplotfill:Cloud colorCloud colorfill

Order rules

OrderFires whenBy defaultLine
Open Long longbullish and long_entry and timePeriodOn53
Close Longbearish and not short_entryOn54
Open Short shortbearish and short_entry and timePeriodOn55
Close Shortbullish and not long_entryOn56

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.

4/4trades 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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.

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−16.8%+102.5%617%0.2721.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+4.0%+5.5%540%1.735.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−38.5%+9.8%60%0.0039.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+13.5%+8.4%3100%397.794.3%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−9.6%+16.7%425%0.5017.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.2%+21.5%1100%7.853.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.3%+148.3%250%0.6910.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−11.5%+17.1%40%0.0012.3%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 market1100%$62.41
Sideways market20%−$116.64
Falling market30%−$113.32

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

How bad could the drawdown be?

21.6%

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

0%25%
All 6 trades
SideEntryExitBarsP&L
long11 Apr 2024 70,006.2022 Nov 2025 84,739.70590$62.41
short22 Nov 2025 84,739.7014 Jan 2026 96,951.8053−$46.58
long14 Jan 2026 96,951.808 Feb 2026 70,330.4025−$84.15
short8 Feb 2026 70,330.4015 Apr 2026 74,810.0066−$18.37
long15 Apr 2026 74,810.009 Jun 2026 61,730.0055−$48.37
short9 Jun 2026 61,730.0019 Aug 2026 69,334.8071−$32.49

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Ichimoku Cloud with ADX (By Coinrule) this page—v5 strategy−16.8%621.9%
Ichimoku Cloud and ADX with Trailing Stop Loss (by Coinrule) by Coinruledmiv5 strategy−0.1%518.1%
ADX and DMI by Zeal Terminaldmiv5 indicatorindicator

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 4 strategy calls use the when = argument (line 53, 54, 55, 56). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 5 settings use the untyped input() (line 12, 15, 16, 25, 26). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 12: input() → input.bool()
  • Line 15: input() → input.int()
  • Line 16: input() → input.int()
  • Line 25: input() → input.bool()
  • Line 26: input() → input.bool()
  • Line 53: when = bullish and long_entry and timePeriod → if block
3 more edits
  • Line 54: when = bearish and not short_entry → if block
  • Line 55: when = bearish and short_entry and timePeriod → if block
  • Line 56: when = bullish and not long_entry → if block
⋯         commission_value=0.1)-showDate = input(defval=true, title='Show Date Range')+showDate = input.bool(defval=true, title='Show Date Range')timePeriod = time >= timestamp(syminfo.timezone, 2022, 1, 1, 0, 0)// Stop Loss and Take Profit for Shorting-Stop_loss = input(1) / 100+Stop_loss = input.int(1) / 100-Take_profit = input(5) / 100+Take_profit = input.int(5) / 100longStopPrice = strategy.position_avg_price * (1 - Stop_loss)⋯ss_offset = input.int(26, minval=1, title='Senkou-Span Offset')-long_entry = input(true, title='Long Entry')+long_entry = input.bool(true, title='Long Entry')-short_entry = input(true, title='Short Entry')+short_entry = input.bool(true, title='Short Entry')middle(len) => math.avg(ta.lowest(len), ta.highest(len))⋯bearish = tk_cross_bear and cs_cross_bear and price_below_kumo and avg_dm > 45 and pos_dm < neg_dm-strategy.entry('Long', strategy.long, when=bullish and long_entry and timePeriod)+if bullish and long_entry and timePeriod+    strategy.entry('Long', strategy.long)-strategy.close('Long', when=bearish and not short_entry)+if bearish and not short_entry+    strategy.close('Long')-strategy.entry('Short', strategy.short, when=bearish and short_entry and timePeriod)+if bearish and short_entry and timePeriod+    strategy.entry('Short', strategy.short)-strategy.close('Short', when=bullish and not long_entry)+if bullish and not long_entry+    strategy.close('Short')

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L39:C85: 'fill' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © Coinrule-//@version=5+//@version=6strategy('Ichimoku Cloud with ADX (By Coinrule)',⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 17 msYes 1,000 bars in 61 msNot measured
PineTSNot testedNot testedNot 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.

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/// © Coinrule//@version=5strategy('Ichimoku Cloud with ADX (By Coinrule)',         overlay=true,         initial_capital=1000,         process_orders_on_close=true,         default_qty_type=strategy.percent_of_equity,         default_qty_value=30,         commission_type=strategy.commission.percent,         commission_value=0.1)showDate = input(defval=true, title='Show Date Range')timePeriod = time >= timestamp(syminfo.timezone, 2022, 1, 1, 0, 0)// Stop Loss and Take Profit for ShortingStop_loss = input(1) / 100Take_profit = input(5) / 100longStopPrice = strategy.position_avg_price * (1 - Stop_loss)longTakeProfit = strategy.position_avg_price * (1 + Take_profit)// Inputsts_bars = input.int(9, minval=1, title='Tenkan-Sen Bars')ks_bars = input.int(26, minval=1, title='Kijun-Sen Bars')ssb_bars = input.int(52, minval=1, title='Senkou-Span B Bars')cs_offset = input.int(26, minval=1, title='Chikou-Span Offset')ss_offset = input.int(26, minval=1, title='Senkou-Span Offset')long_entry = input(true, title='Long Entry')short_entry = input(true, title='Short Entry')middle(len) => math.avg(ta.lowest(len), ta.highest(len))// Ichimoku Componentstenkan = middle(ts_bars)kijun = middle(ks_bars)senkouA = math.avg(tenkan, kijun)senkouB = middle(ssb_bars)// Plot Ichimoku Kinko Hyoplot(tenkan, color=color.new(#0496ff, 0), title='Tenkan-Sen')plot(kijun, color=color.new(#991515, 0), title='Kijun-Sen')plot(close, offset=-cs_offset + 1, color=color.new(#459915, 0), title='Chikou-Span')sa = plot(senkouA, offset=ss_offset - 1, color=color.new(color.green, 0), title='Senkou-Span A')sb = plot(senkouB, offset=ss_offset - 1, color=color.new(color.red, 0), title='Senkou-Span B')fill(sa, sb, color=senkouA > senkouB ? color.green : color.red, title='Cloud color', transp=90)ss_high = math.max(senkouA[ss_offset - 1], senkouB[ss_offset - 1])ss_low = math.min(senkouA[ss_offset - 1], senkouB[ss_offset - 1])// ADX[pos_dm, neg_dm, avg_dm] = ta.dmi(14, 14)// Entry/Exit Signalstk_cross_bull = tenkan > kijuntk_cross_bear = tenkan < kijuncs_cross_bull = ta.mom(close, cs_offset - 1) > 0cs_cross_bear = ta.mom(close, cs_offset - 1) < 0price_above_kumo = close > ss_highprice_below_kumo = close < ss_lowbullish = tk_cross_bull and cs_cross_bull and price_above_kumo and avg_dm < 45 and pos_dm > neg_dmbearish = tk_cross_bear and cs_cross_bear and price_below_kumo and avg_dm > 45 and pos_dm < neg_dmstrategy.entry('Long', strategy.long, when=bullish and long_entry and timePeriod)strategy.close('Long', when=bearish and not short_entry)strategy.entry('Short', strategy.short, when=bearish and short_entry and timePeriod)strategy.close('Short', when=bullish and not long_entry)