Pine Script v5 · Strategy
Ichimoku Cloud with RSI (By Coinrule)
A Pine Script v5 strategy built on RSI (close, lengthRSI). 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. 8 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 with RSI (By Coinrule) repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
- How did Ichimoku Cloud with RSI (By Coinrule) do on BTCUSDT 1D with default settings?
- −1.84%
- From 26 Jan 2024 to 21 Oct 2026, over 10 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Ichimoku Cloud with RSI (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: 10 before, 10 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 with RSI (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 RSI (By Coinrule) run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 51 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
- Net profit
- −1.84%
- −$18.44
- Buy and hold
- +102.5%
- same period
- Closed trades
- 10
- 3 won · 7 lost
- Profitable
- 30.0%
- of closed trades
- Profit factor
- 0.94
- gross profit ÷ gross loss
- Max drawdown
- 16.47%
- −$188.04
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
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 49, 50, 51, 52. 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Show Date Range | true | bool | unused |
| Tenkan-Sen Bars | 9 | int · min 1 | tenkan |
| Kijun-Sen Bars | 26 | int · min 1 | kijun |
| Senkou-Span B Bars | 52 | int · min 1 | senkouB |
| Chikou-Span Offset | 26 | int · min 1 | cs_cross_bull cs_cross_bear Chikou-Span |
| Senkou-Span Offset | 26 | int · min 1 | Senkou-Span A Senkou-Span B ss_high ss_low |
| Long Entry | true | bool | entry Long close Short |
| Short Entry | true | bool | close Long entry Short |
What it calculates
- RSIclose, lengthRSI
RSI · line 16
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | bullish and long_entry and RSI < 50 and timePeriod | On | 49 |
| Close Long | bearish and not short_entry | On | 50 |
| Open Short short | bearish and short_entry and RSI > 50 and timePeriod | On | 51 |
| Close Short | bullish and not long_entry | On | 52 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −1.8% | +102.5% | 10 | 30% | 0.94 | 16.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −4.6% | +5.5% | 8 | 38% | 0.56 | 10.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +23.7% | +9.8% | 7 | 57% | 3.51 | 13.9% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −7.6% | +8.4% | 8 | 25% | 0.50 | 15.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +9.5% | +16.7% | 9 | 44% | 1.67 | 15.8% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +6.6% | +21.5% | 8 | 38% | 1.79 | 6.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +8.1% | +148.3% | 8 | 63% | 1.43 | 13.9% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −2.4% | +17.1% | 13 | 15% | 0.76 | 5.7% | 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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 1 | 0% | −$5.53 |
| Sideways market | 9 | 33% | −$12.62 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
24.2%
The 95th percentile of the worst drawdown when the same 10 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 11.4% to 24.2%; the tick is what actually happened, 14.0%. Order luck alone moves it this much.
All 10 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 11 Jun 2024 67,314.20 | 14 Jul 2024 60,797.90 | 33 | −$29.58 |
| short | 14 Jul 2024 60,797.90 | 31 Jul 2024 64,628.00 | 17 | −$18.93 |
| long | 31 Jul 2024 64,628.00 | 21 Aug 2024 61,156.00 | 21 | −$15.88 |
| short | 21 Aug 2024 61,156.00 | 1 Oct 2024 60,805.80 | 41 | $1.05 |
| long | 1 Oct 2024 60,805.80 | 20 Feb 2025 98,305.00 | 142 | $172.44 |
| short | 20 Feb 2025 98,305.00 | 31 Jul 2025 115,764.00 | 161 | −$59.78 |
| long | 31 Jul 2025 115,764.00 | 10 Sep 2025 113,960.00 | 41 | −$5.53 |
| short | 10 Sep 2025 113,960.00 | 16 May 2026 78,148.10 | 248 | $97.81 |
| long | 16 May 2026 78,148.10 | 7 Jul 2026 63,364.00 | 52 | −$65.36 |
| short | 7 Jul 2026 63,364.00 | 8 Oct 2026 81,754.40 | 93 | −$94.38 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Ichimoku Cloud with RSI (By Coinrule) this page | — | v5 strategy | −1.8% | 10 | 16.5% |
| Triple RSI strategy by Trade_by_DB | rsi | v5 strategy | +3.2% | 2 | 3.3% |
| Hobbiecode - RSI + Close previous day by hobbiecode | rsi | v5 strategy | +1.2% | 63 | 4.2% |
| dirt cheap yet elegant RSI Strategy by SparkyFlary | rsi | v4 strategy | −11.4% | 8 | 20.5% |
| RSI Classic Strategy (by Coinrule) by Coinrule | rsi | v4 strategy | +7.5% | 6 | 7.2% |
| RSITrendStrategy by email_analysts | rsi | v4 strategy | +69.2% | 22 | 38.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 49, 50, 51, 52). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 3 settings use the untyped input() (line 12, 23, 24). 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.
Same 10 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 12: input() → input.bool()
- Line 23: input() → input.bool()
- Line 24: input() → input.bool()
- Line 49: when = bullish and long_entry and RSI < 50 and timePeriod → if block
- Line 50: when = bearish and not short_entry → if block
- Line 51: when = bearish and short_entry and RSI > 50 and timePeriod → if block
- Line 52: 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, 6, 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))⋯bearish = tk_cross_bear and cs_cross_bear and price_below_kumo-strategy.entry("Long", strategy.long, when=bullish and long_entry and RSI < 50 and timePeriod)+if bullish and long_entry and RSI < 50 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 RSI > 50 and timePeriod)+if bearish and short_entry and RSI > 50 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 runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 10 before, 10 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 with RSI (By Coinrule)",⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | Yes 1,000 bars in 51 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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 RSI (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, 6, 1, 0, 0)// RSI inputs and calculationslengthRSI = 14RSI = ta.rsi(close, lengthRSI)//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_lowbullish = tk_cross_bull and cs_cross_bull and price_above_kumobearish = tk_cross_bear and cs_cross_bear and price_below_kumostrategy.entry("Long", strategy.long, when=bullish and long_entry and RSI < 50 and timePeriod)strategy.close("Long", when=bearish and not short_entry)strategy.entry("Short", strategy.short, when=bearish and short_entry and RSI > 50 and timePeriod)strategy.close("Short", when=bullish and not long_entry)