Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Ichimoku Cloud and Bollinger Bands (by Coinrule)

A Pine Script v5 strategy built on SMA (close, 20) and Stdev (close, 20). 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. 12 settings; defaults include Tenkan-Sen Bars 9, Kijun-Sen Bars 26 and Senkou-Span B Bars 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 and Bollinger Bands (by Coinrule) 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 Cloud and Bollinger Bands (by Coinrule) do on BTCUSDT 1D with default settings?
−28.58%
From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Ichimoku Cloud and Bollinger Bands (by Coinrule) 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: 2 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.
Does Ichimoku Cloud and Bollinger Bands (by Coinrule) use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Ichimoku Cloud and Bollinger Bands (by Coinrule) run in Zeal Terminal?
Yes
It compiles in 23 ms and runs 1,000 bars in 64 ms, in the browser.

BTCUSDT · 1D · default settings

  • Tenkan-Sen
  • Kijun-Sen
  • Chikou-Span
  • Senkou-Span A
  • Senkou-Span B
  • Basis
  • Upper
  • Lower
  • 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 (12)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$754$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
−28.58%
−$285.84
Buy and hold
+102.5%
same period
Closed trades
2
0 won · 2 lost
Profitable
0.0%
of closed trades
Profit factor
0.00
gross profit ÷ gross loss
Max drawdown
29.81%
−$298.09

One run with the author's default settings, $1,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

    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

    1 setting has no label

    In the settings dialog length (line 47) shows 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 61, 62, 63, 64. 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
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
Length (no label in the script)20int · min 1basis dev
Sourceclosesourcebasis dev
StdDev2.0float · min 0.001 · max 50dev
Offset0int · min -500 · max 500Upper Lower Basis

What it calculates

  • SMASource (close), Length (20)basis · line 50
  • StdevSource (close), Length (20)dev · line 51

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.

closecloseprice datalengthLengthsetting · 20multStdDevsetting · 2.0ts_barsTenkan-Sen Barssetting · 9ks_barsKijun-Sen Barssetting · 26ssb_barsSenkou-Span B Barssetting · 52ss_offsetSenkou-Span Offsetsetting · 26timetimeprice datacs_offsetChikou-Span Offsetsetting · 26basisSMA→ basisdevStdev→ devtenkantenkanvaluekijunkijunvaluesenkouAsenkouAvaluesenkouBsenkouBvaluess_high, ss_lowss_high · ss_low2 valuesupper, lowerupper · lower2 valuestimePeriodtimePeriodconditionnotInTradenotInTradeconditiontk_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:31Tenkan-Senplotplot:32Kijun-Senplotplot:33Chikou-Spanplotplot:34Senkou-Span Aplotplot:35Senkou-Span Bplotfill:Cloud colorCloud colorfillplot:55Basisplotplot:56Upperplotplot:57Lowerplotfill:BackgroundBackgroundfill

Order rules

OrderFires whenBy defaultLine
Open Long longbullish and long_entry and timePeriodOn61
Close Longbearish and not short_entryOn62
Open Short shortbearish and short_entry and timePeriodOn63
Close Shortbullish and not long_entryOn64

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.

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 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−28.6%+102.5%20%0.0029.8%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.0%+5.5%00%0.004.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−5.0%+9.8%425%0.4825.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+2.4%+8.4%250%12.2515.3%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+22.8%+16.7%367%22.1428.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+10.6%+21.5%633%2.887.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−12.1%+148.3%10%0.0048.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.0%+17.1%00%0.008.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 market10%−$23.12
Sideways market10%−$262.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?

28.6%

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

0%33%
All 2 trades
SideEntryExitBarsP&L
short25 Jun 2024 61,806.0031 Jul 2025 115,764.00401−$262.51
long31 Jul 2025 115,764.005 Nov 2025 103,885.0097−$23.12

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 and Bollinger Bands (by Coinrule) this page—v5 strategy−28.6%229.8%
Double Bollinger Binary Options by Trade_by_DBsma stdevv5 strategyNo trades on this market
Improved Bollinger Swing Strategy Stock Nasdaq by exlux99sma stdevv4 strategy−20.4%722.3%
I11L Long Put-Call Ratio Inversion by I11Lsma stdevv5 strategyNo trades on this market
P-Signal Strategy by Kharevskystdev smav4 strategy−9.7%2934.6%
P-Signal Strategy & Alert by Kharevskystdev smav4 strategy−9.7%2934.6%

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 61, 62, 63, 64). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 4 settings use the untyped input() (line 12, 22, 23, 48). 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 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 12: input() → input.bool()
  • Line 22: input() → input.bool()
  • Line 23: input() → input.bool()
  • Line 48: input() → input.source()
  • Line 61: when = bullish and long_entry and timePeriod → if block
  • Line 62: when = bearish and not short_entry → if block
  • Line 63: when = bearish and short_entry and timePeriod → if block
  • Line 64: 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)⋯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))⋯length = input.int(20, minval=1)-src = input(close, title="Source")+src = input.source(close, title="Source")mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")⋯bearish = tk_cross_bear and cs_cross_bear and price_below_kumo and ta.crossover(close, lower)-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')//Works well on BTC 30m/1h (11.29%), ETH 2h (29.05%), MATIC 2h/30m (37.12%), AVAX 1h/2h (49.2%), SOL 45m (45.43%)

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: 2 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.

⋯// © Coinrule-//@version=5+//@version=6strategy("Ichimoku Cloud and Bollinger Bands",⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 23 msYes 1,000 bars in 64 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 and Bollinger Bands",         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)notInTrade = strategy.position_size <= 0//Ichimoku Cloud//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))// Components of Ichimoku Cloudtenkan = middle(ts_bars)kijun = middle(ks_bars)senkouA = math.avg(tenkan, kijun)senkouB = middle(ssb_bars)// Plot Ichimoku Cloudplot(tenkan, color=#0496ff, title="Tenkan-Sen")plot(kijun, color=#991515, title="Kijun-Sen")plot(close, offset=-cs_offset+1, color=#459915, title="Chikou-Span")sa=plot(senkouA, offset=ss_offset-1, color=color.green, title="Senkou-Span A")sb=plot(senkouB, offset=ss_offset-1, color=color.red, title="Senkou-Span B")fill(sa, sb, color = senkouA > senkouB ? color.green : color.red, title="Cloud color")ss_high = math.max(senkouA[ss_offset-1], senkouB[ss_offset-1])ss_low = math.min(senkouA[ss_offset-1], senkouB[ss_offset-1])// Entry/Exit Conditionstk_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_low//Bollinger Bands Indicatorlength = input.int(20, minval=1)src = input(close, title="Source")mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")basis = ta.sma(src, length)dev = mult * ta.stdev(src, length)upper = basis + devlower = basis - devoffset = input.int(0, "Offset", minval = -500, maxval = 500)plot(basis, "Basis", color=#FF6D00, offset = offset)p1 = plot(upper, "Upper", color=#2962FF, offset = offset)p2 = plot(lower, "Lower", color=#2962FF, offset = offset)fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95))bullish = tk_cross_bull and cs_cross_bull and price_above_kumo and ta.crossover(lower, close)bearish = tk_cross_bear and cs_cross_bear and price_below_kumo and ta.crossover(close, lower)strategy.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)//Works well on BTC 30m/1h (11.29%), ETH 2h (29.05%), MATIC 2h/30m (37.12%), AVAX 1h/2h (49.2%), SOL 45m (45.43%)