Pine Script v4 · Strategy
Suchit RSI CCI
A Pine Script v4 strategy built on CCI (hl2, 14), SMA or RSI (close, 14, 50) and RSI (close, 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 is one contract and pays no commission. It has no settings.
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 Suchit RSI CCI repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 16 of 16 trades.
- How did Suchit RSI CCI do on BTCUSDT 1D with default settings?
- +11.40%
- From 26 Jan 2024 to 21 Oct 2026, over 68 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Suchit RSI CCI 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 Suchit RSI CCI use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Suchit RSI CCI run in Zeal Terminal?
- Yes
- It compiles in 17 ms and runs 1,000 bars in 27 ms, in the browser.
BTCUSDT · 1D · default settings
- SMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +11.40%
- $11,400.80
- Buy and hold
- +102.5%
- same period
- Closed trades
- 68
- 24 won · 44 lost
- Profitable
- 35.3%
- of closed trades
- Profit factor
- 1.07
- gross profit ÷ gross loss
- Max drawdown
- 54.74%
- −$64,430.80
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.
-
Note
Uses an argument v6 removed
when = on line 36, 37, 38, 39. 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 sma → ta.sma, cci → ta.cci, rsi → ta.rsi.
- 4 strategy calls use the when = argument (line 36, 37, 38, 39). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 68 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 5: sma → ta.sma
- Line 9: sma → ta.sma
- Line 14: cci → ta.cci
- Line 16: sma → ta.sma
- Line 16: rsi → ta.rsi
- Line 18: rsi → ta.rsi
⋯// © SuchitRaju-//@version=4+//@version=5strategy("MA RSI CCI")-price_up = if(close > open and close > sma(hl2,14))+price_up = if(close > open and close > ta.sma(hl2,14)) 1⋯ 0-price_down = if(open > close and close < sma(hl2,14))+price_down = if(open > close and close < ta.sma(hl2,14)) 1⋯// -cci_indicator = cci(hl2, 14)+cci_indicator = ta.cci(hl2, 14)// plot(cci_indicator, color=color.blue)-rsi_slow = sma(rsi(close, 14), 50)+rsi_slow = ta.sma(ta.rsi(close, 14), 50)// plot(rsi_slow, color=color.red)-rsi_fast = rsi(close, 14)+rsi_fast = ta.rsi(close, 14)// plot(rsi_fast, color=color.green)⋯Same 68 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 36: when = isCrossover → if block
- Line 37: when = isCrossunder → if block
- Line 38: when = isCrossunder → if block
- Line 39: when = isCrossover → if block
⋯// strategy.close("Short", when = isCrossover and price_up)-strategy.entry("Long", strategy.long, 1, when = isCrossover)+if isCrossover+ strategy.entry("Long", strategy.long, 1)-strategy.entry("Short", strategy.short, 1, when = isCrossunder)+if isCrossunder+ strategy.entry("Short", strategy.short, 1)-strategy.close("Long", when = isCrossunder)+if isCrossunder+ strategy.close("Long")-strategy.close("Short", when = isCrossover)+if isCrossover+ 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: 68 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.
⋯// © SuchitRaju-//@version=5+//@version=6strategy("MA RSI CCI")⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
The script declares no settings.
What it calculates
- CCI (
cci,ta.cciin v5)hl2, 14cci_indicator · line 14 - SMA / RSI (
sma,ta.smain v5)rsi(close, 14), 50rsi_slow · line 16 - RSI (
rsi,ta.rsiin v5)close, 14rsi_fast · line 18
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 | isCrossover | On | 36 |
| Open Short short | isCrossunder | On | 37 |
| Close Long | isCrossunder | On | 38 |
| Close Short | isCrossover | On | 39 |
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 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 | +11.4% | +102.5% | 68 | 35% | 1.07 | 54.7% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +16.0% | +5.5% | 73 | 32% | 1.43 | 11.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.3% | +9.8% | 70 | 33% | 1.03 | 2.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.2% | +8.4% | 75 | 24% | 0.89 | 0.9% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 61 | 43% | 1.10 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 63 | 32% | 1.18 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.2% | +148.3% | 74 | 36% | 0.86 | 0.6% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.1% | +17.1% | 73 | 32% | 1.15 | 0.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 24 | 29% | −$38,939.90 |
| Sideways market | 28 | 54% | $64,080.70 |
| Falling market | 16 | 13% | −$13,740.10 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
59.6%
The 95th percentile of the worst drawdown when the same 68 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 32.5% to 59.6%; the tick is what actually happened, 52.8%. Order luck alone moves it this much.
All 68 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 3 Apr 2024 65,464.00 | 6 May 2024 64,012.00 | 33 | $1,451.99 |
| long | 6 May 2024 64,012.00 | 9 May 2024 61,193.00 | 3 | −$2,818.97 |
| short | 9 May 2024 61,193.00 | 14 May 2024 62,940.10 | 5 | −$1,747.06 |
| long | 14 May 2024 62,940.10 | 12 Jun 2024 67,314.20 | 29 | $4,374.14 |
| short | 12 Jun 2024 67,314.20 | 15 Jul 2024 60,797.90 | 33 | $6,516.32 |
| long | 15 Jul 2024 60,797.90 | 3 Aug 2024 61,498.30 | 19 | $700.43 |
| short | 3 Aug 2024 61,498.30 | 14 Aug 2024 60,587.20 | 11 | $911.18 |
| long | 14 Aug 2024 60,587.20 | 16 Aug 2024 57,541.10 | 2 | −$3,046.11 |
| short | 16 Aug 2024 57,541.10 | 22 Aug 2024 61,156.00 | 6 | −$3,614.98 |
| long | 22 Aug 2024 61,156.00 | 28 Aug 2024 59,415.00 | 6 | −$1,741.03 |
| short | 28 Aug 2024 59,415.00 | 13 Sep 2024 58,132.30 | 16 | $1,282.69 |
| long | 13 Sep 2024 58,132.30 | 2 Oct 2024 60,804.90 | 19 | $2,672.61 |
| short | 2 Oct 2024 60,804.90 | 13 Oct 2024 63,206.20 | 11 | −$2,401.31 |
| long | 13 Oct 2024 63,206.20 | 4 Nov 2024 68,776.00 | 22 | $5,569.76 |
| short | 4 Nov 2024 68,776.00 | 7 Nov 2024 75,572.00 | 3 | −$6,796.00 |
| long | 7 Nov 2024 75,572.00 | 27 Nov 2024 91,965.20 | 20 | $16,393.20 |
| short | 27 Nov 2024 91,965.20 | 30 Nov 2024 97,460.00 | 3 | −$5,494.84 |
| long | 30 Nov 2024 97,460.00 | 4 Dec 2024 95,849.70 | 4 | −$1,610.31 |
| short | 4 Dec 2024 95,849.70 | 9 Dec 2024 101,110.00 | 5 | −$5,259.91 |
| long | 9 Dec 2024 101,110.00 | 11 Dec 2024 96,593.00 | 2 | −$4,516.60 |
| short | 11 Dec 2024 96,593.00 | 17 Dec 2024 106,059.00 | 6 | −$9,465.65 |
| long | 17 Dec 2024 106,059.00 | 20 Dec 2024 97,461.90 | 3 | −$8,596.79 |
| short | 20 Dec 2024 97,461.90 | 7 Jan 2025 102,236.00 | 18 | −$4,773.74 |
| long | 7 Jan 2025 102,236.00 | 9 Jan 2025 95,060.60 | 2 | −$7,174.99 |
| short | 9 Jan 2025 95,060.60 | 16 Jan 2025 100,497.00 | 7 | −$5,436.74 |
| long | 16 Jan 2025 100,497.00 | 28 Jan 2025 102,083.00 | 12 | $1,585.48 |
| short | 28 Jan 2025 102,083.00 | 31 Jan 2025 104,723.00 | 3 | −$2,640.11 |
| long | 31 Jan 2025 104,723.00 | 2 Feb 2025 100,636.00 | 2 | −$4,087.28 |
| short | 2 Feb 2025 100,636.00 | 21 Feb 2025 98,305.00 | 19 | $2,330.65 |
| long | 21 Feb 2025 98,305.00 | 23 Feb 2025 96,551.00 | 2 | −$1,754.00 |
| short | 23 Feb 2025 96,551.00 | 20 Mar 2025 86,845.90 | 25 | $9,705.08 |
| long | 20 Mar 2025 86,845.90 | 30 Mar 2025 82,648.50 | 10 | −$4,197.40 |
| short | 30 Mar 2025 82,648.50 | 3 Apr 2025 82,516.30 | 4 | $132.25 |
| long | 3 Apr 2025 82,516.30 | 7 Apr 2025 78,430.00 | 4 | −$4,086.28 |
| short | 7 Apr 2025 78,430.00 | 13 Apr 2025 85,276.90 | 6 | −$6,846.91 |
| long | 13 Apr 2025 85,276.90 | 30 May 2025 105,590.00 | 47 | $20,312.80 |
| short | 30 May 2025 105,590.00 | 30 Jun 2025 108,357.00 | 31 | −$2,767.18 |
| long | 30 Jun 2025 108,357.00 | 30 Jul 2025 117,951.00 | 30 | $9,593.82 |
| short | 30 Jul 2025 117,951.00 | 11 Aug 2025 119,294.00 | 12 | −$1,343.52 |
| long | 11 Aug 2025 119,294.00 | 19 Aug 2025 116,227.00 | 8 | −$3,067.22 |
| short | 19 Aug 2025 116,227.00 | 11 Sep 2025 113,960.00 | 23 | $2,267.05 |
| long | 11 Sep 2025 113,960.00 | 23 Sep 2025 112,651.00 | 12 | −$1,309.01 |
| short | 23 Sep 2025 112,651.00 | 1 Oct 2025 114,049.00 | 8 | −$1,397.95 |
| long | 1 Oct 2025 114,049.00 | 11 Oct 2025 112,774.00 | 10 | −$1,274.45 |
| short | 11 Oct 2025 112,774.00 | 27 Oct 2025 114,559.00 | 16 | −$1,784.92 |
| long | 27 Oct 2025 114,559.00 | 31 Oct 2025 108,323.00 | 4 | −$6,236.54 |
| short | 31 Oct 2025 108,323.00 | 28 Nov 2025 91,333.90 | 28 | $16,988.90 |
| long | 28 Nov 2025 91,333.90 | 2 Dec 2025 86,286.00 | 4 | −$5,047.93 |
| short | 2 Dec 2025 86,286.00 | 3 Dec 2025 91,277.90 | 1 | −$4,991.87 |
| long | 3 Dec 2025 91,277.90 | 16 Dec 2025 86,432.10 | 13 | −$4,845.80 |
| short | 16 Dec 2025 86,432.10 | 23 Dec 2025 88,620.80 | 7 | −$2,188.71 |
| long | 23 Dec 2025 88,620.80 | 21 Jan 2026 88,427.70 | 29 | −$193.13 |
| short | 21 Jan 2026 88,427.70 | 27 Feb 2026 67,485.20 | 37 | $20,942.50 |
| long | 27 Feb 2026 67,485.20 | 28 Feb 2026 65,872.10 | 1 | −$1,613.10 |
| short | 28 Feb 2026 65,872.10 | 3 Mar 2026 68,830.10 | 3 | −$2,957.97 |
| long | 3 Mar 2026 68,830.10 | 28 Mar 2026 66,407.30 | 25 | −$2,422.78 |
| short | 28 Mar 2026 66,407.30 | 7 Apr 2026 68,853.70 | 10 | −$2,446.38 |
| long | 7 Apr 2026 68,853.70 | 30 Apr 2026 75,780.00 | 23 | $6,926.34 |
| short | 30 Apr 2026 75,780.00 | 2 May 2026 78,231.10 | 2 | −$2,451.13 |
| long | 2 May 2026 78,231.10 | 16 May 2026 79,113.20 | 14 | $882.07 |
| short | 16 May 2026 79,113.20 | 4 Jul 2026 62,583.30 | 49 | $16,529.90 |
| long | 4 Jul 2026 62,583.30 | 1 Aug 2026 62,887.90 | 28 | $304.62 |
| short | 1 Aug 2026 62,887.90 | 6 Aug 2026 64,665.20 | 5 | −$1,777.36 |
| long | 6 Aug 2026 64,665.20 | 12 Aug 2026 63,600.00 | 6 | −$1,065.23 |
| short | 12 Aug 2026 63,600.00 | 19 Aug 2026 64,725.40 | 7 | −$1,125.41 |
| long | 19 Aug 2026 64,725.40 | 10 Sep 2026 78,306.40 | 22 | $13,581.00 |
| short | 10 Sep 2026 78,306.40 | 19 Sep 2026 80,883.90 | 9 | −$2,577.43 |
| long | 19 Sep 2026 80,883.90 | 8 Oct 2026 83,321.80 | 19 | $2,437.95 |
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 |
|---|---|---|---|---|---|
| Suchit RSI CCI this page | — | v4 strategy | +11.4% | 68 | 54.7% |
| Momentum Explosion 2CCI RSI by capam | sma cci rsi | v4 strategy | +24.1% | 6 | 42.3% |
| CCI Level Zone by Naruephat | cci sma rsi | v5 strategy | No trades on this market | ||
| SRJ RSI Outperformer Strategy by Sapt_Jash | rsi sma | v5 strategy | +0.6% | 8 | 2.4% |
| RSI SMA Crossover Strategy by reees | rsi sma | v5 strategy | +39.8% | 42 | 30.8% |
| Short In Downtrend Below MA100 (Coinrule) by Coinrule | sma rsi | v4 strategy | −34.5% | 99 | 45.4% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 17 ms | Yes 1,000 bars in 27 ms | Not measured |
| PineTS | No 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/// © SuchitRaju//@version=4strategy("MA RSI CCI")price_up = if(close > open and close > sma(hl2,14)) 1else 0price_down = if(open > close and close < sma(hl2,14)) 1else 0// cci_indicator = cci(hl2, 14)// plot(cci_indicator, color=color.blue)rsi_slow = sma(rsi(close, 14), 50)// plot(rsi_slow, color=color.red)rsi_fast = rsi(close, 14)// plot(rsi_fast, color=color.green)isCrossover = if(rsi_fast > rsi_slow and cci_indicator > 0) 1else 0// plotshape(isCrossover, style = shape.arrowup, color = color.green, size = size.huge)isCrossunder = if(rsi_fast < rsi_slow and cci_indicator < 0) 1else 0// plotshape(isCrossunder, style = shape.arrowup, color = color.red, size = size.huge)// start = timestamp("GMT-5", 2016,9,1,0,0)// end = timestamp("GMT-5", 2017,9,1,0,0)// strategy.entry("Long", strategy.long, 1, when = isCrossover and price_up)// strategy.entry("Short", strategy.short, 1, when = isCrossunder and price_down)// strategy.close("Long", when = isCrossunder and price_down)// strategy.close("Short", when = isCrossover and price_up)strategy.entry("Long", strategy.long, 1, when = isCrossover)strategy.entry("Short", strategy.short, 1, when = isCrossunder)strategy.close("Long", when = isCrossunder)strategy.close("Short", when = isCrossover)