Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

CCU MFI + RSI + STOCH RSI

A Pine Script v4 strategy built on MFI (source, 14), RSI (source, 14) and SMA or Stoch (3). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade is one contract and pays no commission. 7 settings; defaults include RSI length 14, Mfi lenght 14 and Smooth K 3.

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 CCU MFI + RSI + STOCH RSI repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 1 of 1 trades.
How did CCU MFI + RSI + STOCH RSI do on BTCUSDT 1D with default settings?
+41.75%
From 26 Jan 2024 to 21 Oct 2026, over 6 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can CCU MFI + RSI + STOCH RSI 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 CCU MFI + RSI + STOCH RSI use a stop loss?
Yes
strategy.exit sets a stop on line 33, 37.
Does CCU MFI + RSI + STOCH RSI run in Zeal Terminal?
Yes
It compiles in 11 ms and runs 1,000 bars in 35 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • Plot
  • HLine
  • HLine
  • 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 (7)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$137,297$202,527Equity from $100,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
+41.75%
$41,753.60
Buy and hold
+102.5%
same period
Closed trades
6
3 won · 3 lost
Profitable
50.0%
of closed trades
Profit factor
1.94
gross profit ÷ gross loss
Max drawdown
37.37%
−$37,372.30

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 commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    6 settings have no label

    In the settings dialog rsi_length (line 11), mfi_lenght (line 12), smoothK (line 13), smoothD (line 14), lengthRSI (line 15), lengthStoch (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.

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 mfi → ta.mfi, rsi → ta.rsi, sma → ta.sma, stoch → ta.stoch.

v4 → v5

Verified

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

  • Line 7: //@version=4 → //@version=5
  • Line 24: mfi → ta.mfi
  • Line 25: rsi → ta.rsi
  • Line 26: rsi → ta.rsi
  • Line 27: sma → ta.sma
  • Line 27: stoch → ta.stoch
  • Line 28: sma → ta.sma
⋯// © BTA crypto-//@version=4+//@version=5strategy("Crypto Crew University")⋯//lines-mfi = mfi(source, mfi_lenght)+mfi = ta.mfi(source, mfi_lenght)-rsi = rsi(source, rsi_length)+rsi = ta.rsi(source, rsi_length)-rsi1 = rsi(close, lengthRSI)+rsi1 = ta.rsi(close, lengthRSI)-k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)+k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)-d = sma(k, smoothD)+d = ta.sma(k, smoothD)longSignal = mfi<longThreshhold and rsi<longThreshhold and k<longThreshhold and d<longThreshhold? 1:-1⋯

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 11: input() → input.int()
  • Line 12: input() → input.int()
  • Line 13: input() → input.int()
  • Line 14: input() → input.int()
  • Line 15: input() → input.int()
  • Line 16: input() → input.int()
⋯source = hlc3-rsi_length = input(14, minval=1)+rsi_length = input.int(14, minval=1)-mfi_lenght =  input(14, minval=1)+mfi_lenght =  input.int(14, minval=1)-smoothK = input(3, minval=1)+smoothK = input.int(3, minval=1)-smoothD = input(3, minval=1)+smoothD = input.int(3, minval=1)-lengthRSI = input(14, minval=1)+lengthRSI = input.int(14, minval=1)-lengthStoch = input(14, minval=1)+lengthStoch = input.int(14, minval=1)okay = "Okay"⋯

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: 6 before, 6 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.

⋯// © BTA crypto-//@version=5+//@version=6strategy("Crypto Crew University")⋯

Settings

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

SettingDefaultType and rangeFeeds
RSI length (no label in the script)14int · min 1rsi
Mfi lenght (no label in the script)14int · min 1mfi
Smooth K (no label in the script)3int · min 1k
Smooth D (no label in the script)3int · min 1d
Length RSI (no label in the script)14int · min 1rsi1
Length Stoch (no label in the script)14int · min 1k
OpportunityveryGoodvalue · options [okay, good, veryGood]longThreshhold shortThreshhold

What it calculates

  • MFI (mfi, ta.mfi in v5)source, Mfi lenght (14)mfi · line 24
  • RSI (rsi, ta.rsi in v5)source, RSI length (14)rsi · line 25
  • RSI (rsi, ta.rsi in v5)close, Length RSI (14)rsi1 · line 26
  • SMA / Stoch (sma, ta.sma in v5)stoch(rsi1, rsi1, rsi1, lengthStoch), Smooth K (3)k · line 27
  • SMA (sma, ta.sma in v5)k, Smooth D (3)d · line 28

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.

mfi_lenghtMfi lenghtsetting · 14rsi_lengthRSI lengthsetting · 14closecloseprice datalengthRSILength RSIsetting · 14lengthStochLength Stochsetting · 14smoothKSmooth Ksetting · 3smoothDSmooth Dsetting · 3hlc3hlc3price datatradingOpportunityOpportunitysetting · veryGoodmfiMFI→ mfirsiRSI→ rsirsi1RSI→ rsi1kSMA / Stoch→ kdSMA→ dsourcesourcevaluelongThreshhold, shortThreshholdlongThreshhold · shortT…2 valueslongSignallongSignalvalueshortSignalshortSignalvalueentry:LongOpen Longstrategy.entryexit:Long Stop Lossexit Long Stop Lossstrategy.exitentry:ShortOpen Shortstrategy.entryexit:Short Stop Lossexit Short Stop Lossstrategy.exitplot:38plotplotplot:39plotplotplot:40plotplotplot:41plotplothline:42hlinehlinehline:43hlinehline

Order rules

OrderFires whenBy defaultLine
Open Long longlongSignal > 0On32
Exit Long Stop Loss stoplongSignal > 0On33
Open Short shortshortSignal > 0On36
Exit Short Stop Loss stopshortSignal > 0On37

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.

1/1trades 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 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+41.8%+102.5%650%1.9437.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−28.5%+5.5%20%0.0030.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.2%+9.8%540%1.151.6%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.6%+8.4%425%0.250.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.1%+16.7%650%2.790.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%333%0.490.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.6%+148.3%650%2.320.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%450%1.410.2%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 market333%$7,181.43
Sideways market2100%$51,598.10
Falling market10%−$17,025.90

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

How bad could the drawdown be?

36.2%

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, 19.5% to 36.2%; the tick is what actually happened, 27.5%. Order luck alone moves it this much.

0%42%
All 6 trades
SideEntryExitBarsP&L
short14 Feb 2024 49,699.6028 Feb 2024 59,639.5014−$9,939.92
short13 Nov 2024 87,952.0016 Dec 2024 105,542.0033−$17,590.40
long1 Mar 2025 84,349.9015 Jul 2025 119,841.00136$35,491.20
short15 Jul 2025 119,841.0022 Nov 2025 85,129.40130$34,711.80
long22 Nov 2025 85,129.405 Feb 2026 68,103.5075−$17,025.90
long4 Jun 2026 64,142.8028 Aug 2026 80,249.6085$16,106.80

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
CCU MFI + RSI + STOCH RSI this page—v4 strategy+41.8%637.4%
CCI Level Zone by Naruephatsma rsi stochv5 strategyNo trades on this market
3 Indicator Strategy (StochRSI, MFI & EMA) With Safety Orders by ggekko21rsi sma mfiv5 strategyNo trades on this market
AVWAP Strategy by asfbherorsi stoch smav5 strategydoes not run in Zeal Terminal
SRJ RSI Outperformer Strategy by Sapt_Jashrsi smav5 strategy+0.6%82.4%
RSI SMA Crossover Strategy by reeesrsi smav5 strategy+39.8%4230.8%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 11 msYes 1,000 bars in 35 msNot measured
PineTSNo 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/// Crypto Crew University strategy: // Indicators: MFI, RSI, STOCH RSI// Entry criteria: long when the three are oversold, short otherwise.// Exit criteria: Take profit at Fib levels (not demonstrated here)// © BTA crypto//@version=4strategy("Crypto Crew University")//inputssource = hlc3rsi_length = input(14, minval=1)mfi_lenght =  input(14, minval=1)smoothK = input(3, minval=1)smoothD = input(3, minval=1)lengthRSI = input(14, minval=1)lengthStoch = input(14, minval=1)okay = "Okay"good = "Good"veryGood = "Very good"tradingOpportunity = input(title="Opportunity", defval=veryGood, options=[okay, good, veryGood])longThreshhold = tradingOpportunity==okay? 40 : tradingOpportunity==good ? 30 : tradingOpportunity==veryGood? 20 : 0shortThreshhold = tradingOpportunity==okay? 60 : tradingOpportunity==good ? 70 : tradingOpportunity==veryGood? 80 : 0//linesmfi = mfi(source, mfi_lenght)rsi = rsi(source, rsi_length)rsi1 = rsi(close, lengthRSI)k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)d = sma(k, smoothD)longSignal = mfi<longThreshhold and rsi<longThreshhold and k<longThreshhold and d<longThreshhold? 1:-1shortSignal = mfi>shortThreshhold and rsi>shortThreshhold and k>shortThreshhold and d>shortThreshhold? 1:-1if longSignal > 0    strategy.entry("Long", strategy.long)    strategy.exit(id="Long Stop Loss", stop=strategy.position_avg_price*0.8) //20% stop loss     if shortSignal > 0    strategy.entry("Short", strategy.short)    strategy.exit(id="Short Stop Loss", stop=strategy.position_avg_price*1.2) //20% stop lossplot(k, color=color.blue)plot(d, color=color.red)plot(rsi, color=color.yellow)plot(mfi, color=color.blue)hline(longThreshhold, color=color.gray, linestyle=hline.style_dashed)hline(shortThreshhold, color=color.gray, linestyle=hline.style_dashed)