Pine Script v4 · Strategy
Ichimoku + RSI Crypto trending strategy
A Pine Script v4 strategy built on Change (haClose) and RMA (gain, 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 100% of equity and pays 0.1% commission. 14 settings; defaults include Tenkan-Sen Bars 20, Kijun-Sen Bars 50 and Senkou-Span B Bars 120.
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 + RSI Crypto trending 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 + RSI Crypto trending strategy do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- Can Ichimoku + RSI Crypto trending strategy be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does Ichimoku + RSI Crypto trending strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Ichimoku + RSI Crypto trending strategy run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 68 ms, in the browser.
BTCUSDT · 1D · default settings
- Change
- RMA
- RMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
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
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 73, 74, 75, 76. The upgraded version below moves each call inside an if block.
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 security → request.security, heikinashi → ticker.heikinashi, avg → math.avg, lowest → ta.lowest, highest → ta.highest, change → ta.change, rma → ta.rma, max → math.max, min → math.min, mom → ta.mom.
- 4 strategy calls use the when = argument (line 73, 74, 75, 76). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 9: security → request.security
- Line 9: heikinashi → ticker.heikinashi
- Line 10: security → request.security
- Line 10: heikinashi → ticker.heikinashi
- Line 11: security → request.security
14 more edits
- Line 11: heikinashi → ticker.heikinashi
- Line 12: security → request.security
- Line 12: heikinashi → ticker.heikinashi
- Line 46: avg → math.avg
- Line 46: lowest → ta.lowest
- Line 46: highest → ta.highest
- Line 50: avg → math.avg
- Line 53: change → ta.change
- Line 56: rma → ta.rma
- Line 57: rma → ta.rma
- Line 60: max → math.max
- Line 61: min → math.min
- Line 65: mom → ta.mom
- Line 66: mom → ta.mom
⋯// © exlux99-//@version=4+//@version=5strategy(title="Ichimoku + RSI Crypto trending strategy", overlay=true, initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1 )⋯// === BASE FUNCTIONS ===-haClose = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : close+haClose = UseHAcandles ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) : close-haOpen = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : open+haOpen = UseHAcandles ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) : open-haHigh = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, high) : high+haHigh = UseHAcandles ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) : high-haLow = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, low) : low+haLow = UseHAcandles ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) : low//Inputs⋯////////////////////////////////////////////////////////////////////////////////-middle(len) => avg(lowest(len), highest(len))+middle(len) => math.avg(ta.lowest(len), ta.highest(len))// Ichimoku Components⋯kijun = middle(ks_bars)-senkouA = avg(tenkan, kijun)+senkouA = math.avg(tenkan, kijun)senkouB = middle(ssb_bars)//RSI-change = change(haClose)+change = ta.change(haClose)gain = change >= 0 ? change : 0.0loss = change < 0 ? (-1) * change : 0.0-avgGain = rma(gain, 14)+avgGain = ta.rma(gain, 14)-avgLoss = rma(loss, 14)+avgLoss = ta.rma(loss, 14)rs = avgGain / avgLossrsi = 100 - (100 / (1 + rs))-ss_high = max(senkouA[ss_offset-1], senkouB[ss_offset-1])+ss_high = math.max(senkouA[ss_offset-1], senkouB[ss_offset-1])-ss_low = min(senkouA[ss_offset-1], senkouB[ss_offset-1])+ss_low = math.min(senkouA[ss_offset-1], senkouB[ss_offset-1])// Entry/Exit Signals⋯tk_cross_bear = tenkan < kijun-cs_cross_bull = mom(haClose, cs_offset-1) > 0+cs_cross_bull = ta.mom(haClose, cs_offset-1) > 0-cs_cross_bear = mom(haClose, cs_offset-1) < 0+cs_cross_bear = ta.mom(haClose, cs_offset-1) < 0price_above_kumo = haClose > ss_high⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 5: input() → input.bool()
- Line 14: input() → input.int()
- Line 15: input() → input.int()
- Line 16: input() → input.int()
- Line 17: input() → input.int()
- Line 18: input() → input.int()
12 more edits
- Line 19: input() → input.bool()
- Line 20: input() → input.bool()
- Line 31: input() → input.int()
- Line 32: input() → input.int()
- Line 33: input() → input.int()
- Line 36: input() → input.int()
- Line 37: input() → input.int()
- Line 38: input() → input.int()
- Line 73: when = bullish and long_entry and time_cond → if block
- Line 74: when = bearish and short_entry and time_cond → if block
- Line 75: when = bearish and not short_entry and time_cond → if block
- Line 76: when = bullish and not long_entry and time_cond → if block
⋯strategy(title="Ichimoku + RSI Crypto trending strategy", overlay=true, initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1 )-UseHAcandles = input(true, title="Use Heikin Ashi Candles in Algo Calculations")+UseHAcandles = input.bool(true, title="Use Heikin Ashi Candles in Algo Calculations")//⋯//Inputs-ts_bars = input(20, minval=1, title="Tenkan-Sen Bars")+ts_bars = input.int(20, minval=1, title="Tenkan-Sen Bars")-ks_bars = input(50, minval=1, title="Kijun-Sen Bars")+ks_bars = input.int(50, minval=1, title="Kijun-Sen Bars")-ssb_bars = input(120, minval=1, title="Senkou-Span B Bars")+ssb_bars = input.int(120, minval=1, title="Senkou-Span B Bars")-cs_offset = input(30, minval=1, title="Chikou-Span Offset")+cs_offset = input.int(30, minval=1, title="Chikou-Span Offset")-ss_offset = input(30, minval=1, title="Senkou-Span Offset")+ss_offset = input.int(30, 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")//Volatility⋯// From Date Inputs-fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)+fromDay = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)-fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)+fromMonth = input.int(defval = 1, title = "From Month", minval = 1, maxval = 12)-fromYear = input(defval = 2019, title = "From Year", minval = 1970)+fromYear = input.int(defval = 2019, title = "From Year", minval = 1970) // To Date Inputs-toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)+toDay = input.int(defval = 31, title = "To Day", minval = 1, maxval = 31)-toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)+toMonth = input.int(defval = 12, title = "To Month", minval = 1, maxval = 12)-toYear = input(defval = 2021, title = "To Year", minval = 1970)+toYear = input.int(defval = 2021, title = "To Year", minval = 1970) ⋯bearish = tk_cross_bear and cs_cross_bear and price_below_kumo and rsi_bearish //and highvolatility-strategy.entry("Long", strategy.long, when=bullish and long_entry and time_cond)+if bullish and long_entry and time_cond+ strategy.entry("Long", strategy.long)-strategy.entry("Short", strategy.short, when=bearish and short_entry and time_cond)+if bearish and short_entry and time_cond+ strategy.entry("Short", strategy.short)-strategy.close("Long", when=bearish and not short_entry and time_cond)+if bearish and not short_entry and time_cond+ strategy.close("Long")-strategy.close("Short", when=bullish and not long_entry and time_cond)+if bullish and not long_entry and time_cond+ strategy.close("Short")Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © exlux99-//@version=5+//@version=6strategy(title="Ichimoku + RSI Crypto trending strategy", overlay=true, initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1 )⋯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 |
|---|---|---|---|
| Use Heikin Ashi Candles in Algo Calculations | true | bool | haClose haOpen haHigh haLow |
| Tenkan-Sen Bars | 20 | int · min 1 | tenkan |
| Kijun-Sen Bars | 50 | int · min 1 | kijun |
| Senkou-Span B Bars | 120 | int · min 1 | senkouB |
| Chikou-Span Offset | 30 | int · min 1 | cs_cross_bull cs_cross_bear |
| Senkou-Span Offset | 30 | int · min 1 | ss_high ss_low |
| Long Entry | true | bool | entry Long close Short |
| Short Entry | true | bool | entry Short close Long |
| From Day | 1 | int · min 1 · max 31 | startDate |
| From Month | 1 | int · min 1 · max 12 | startDate |
| From Year | 2019 | int · min 1970 | startDate |
| To Day | 31 | int · min 1 · max 31 | finishDate |
| To Month | 12 | int · min 1 · max 12 | finishDate |
| To Year | 2021 | int · min 1970 | finishDate |
What it calculates
- Change (
change,ta.changein v5)haClosechange · line 53 - RMA (
rma,ta.rmain v5)gain, 14avgGain · line 56 - RMA (
rma,ta.rmain v5)loss, 14avgLoss · line 57
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 time_cond | On | 73 |
| Open Short short | bearish and short_entry and time_cond | On | 74 |
| Close Long | bearish and not short_entry and time_cond | On | 75 |
| Close Short | bullish and not long_entry and time_cond | On | 76 |
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.
- ClearHigher-timeframe data4 security call(s), none with lookahead on.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Higher-timeframe data for request.security(): heikinashi:SYMBOL D (Binance BTCUSDT 1d, as Heikin-Ashi by the engine), heikinashi:BINANCE:BTCUSDT D (Binance BTCUSDT 1d, as Heikin-Ashi by the engine), fetched from Binance's public market data for each market.
Backtests are simulations on historical data and are not investment advice.
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 + RSI Crypto trending strategy this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| DMI Strategy by email_analysts | rma | v5 strategy | +8.5% | 6 | 2.7% |
| Simple and efficient 1h strategy by SoftKill21 | rma | v4 strategy | No trades on this market | ||
| DI Crossing Daily Straregy HulkTrading by TheHulkTrading | rma | v4 strategy | +34.3% | 65 | 18.4% |
| Kimchi Premium Strategy by chanu_lev10k | rma | v5 strategy | No trades on this market | ||
| Infiten Slope Strategy by spiritualhealer117 | rma | v4 strategy | +47.2% | 26 | 35.5% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 12 ms | With a workaround 1,000 bars in 68 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market. Data the page supplies at the chart's own timeframe (another symbol, or Heikin-Ashi) reaches the script one bar later in Zeal Terminal's engine than on TradingView.
“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/// © exlux99//@version=4strategy(title="Ichimoku + RSI Crypto trending strategy", overlay=true, initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1 )UseHAcandles = input(true, title="Use Heikin Ashi Candles in Algo Calculations")//// === /INPUTS ===// === BASE FUNCTIONS ===haClose = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : closehaOpen = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : openhaHigh = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, high) : highhaLow = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, low) : low//Inputsts_bars = input(20, minval=1, title="Tenkan-Sen Bars")ks_bars = input(50, minval=1, title="Kijun-Sen Bars")ssb_bars = input(120, minval=1, title="Senkou-Span B Bars")cs_offset = input(30, minval=1, title="Chikou-Span Offset")ss_offset = input(30, minval=1, title="Senkou-Span Offset")long_entry = input(true, title="Long Entry")short_entry = input(true, title="Short Entry")//Volatility//vollength = input(defval=1, title="VolLength")//voltarget = input(defval=0., type=input.float, step=0.1, title="Volatility Target")//Difference = abs((haClose - haOpen)/((haClose + haOpen)/2) * 100)//MovingAverage = sma(Difference, vollength)//highvolatility = MovingAverage > voltarget////////////////////////////////////////////////////////////////////////////////// BACKTESTING RANGE // From Date InputsfromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)fromYear = input(defval = 2019, title = "From Year", minval = 1970) // To Date InputstoDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)toYear = input(defval = 2021, title = "To Year", minval = 1970) // Calculate start/end date and time conditionstartDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)finishDate = timestamp(toYear, toMonth, toDay, 00, 00)time_cond = time >= startDate and time <= finishDate ////////////////////////////////////////////////////////////////////////////////middle(len) => avg(lowest(len), highest(len))// Ichimoku Componentstenkan = middle(ts_bars)kijun = middle(ks_bars)senkouA = avg(tenkan, kijun)senkouB = middle(ssb_bars)//RSIchange = change(haClose)gain = change >= 0 ? change : 0.0loss = change < 0 ? (-1) * change : 0.0avgGain = rma(gain, 14)avgLoss = rma(loss, 14)rs = avgGain / avgLossrsi = 100 - (100 / (1 + rs))ss_high = max(senkouA[ss_offset-1], senkouB[ss_offset-1])ss_low = min(senkouA[ss_offset-1], senkouB[ss_offset-1])// Entry/Exit Signalstk_cross_bull = tenkan > kijuntk_cross_bear = tenkan < kijuncs_cross_bull = mom(haClose, cs_offset-1) > 0cs_cross_bear = mom(haClose, cs_offset-1) < 0price_above_kumo = haClose > ss_highprice_below_kumo = haClose < ss_lowrsi_bullish = rsi > 50rsi_bearish = rs < 50bullish = tk_cross_bull and cs_cross_bull and price_above_kumo and rsi_bullish //and highvolatilitybearish = tk_cross_bear and cs_cross_bear and price_below_kumo and rsi_bearish //and highvolatilitystrategy.entry("Long", strategy.long, when=bullish and long_entry and time_cond)strategy.entry("Short", strategy.short, when=bearish and short_entry and time_cond)strategy.close("Long", when=bearish and not short_entry and time_cond)strategy.close("Short", when=bullish and not long_entry and time_cond)