Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

RSI Cross [xaurr]

A Pine Script v4 strategy built on RSI (close, 5), EMA (rsi, 20) and Crossover (fast, slow). It has 2 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. 6 settings; defaults include Source close, RSI Period 5 and RSI Oversold 30.

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 RSI Cross [xaurr] repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 14 of 14 trades.
How did RSI Cross [xaurr] do on BTCUSDT 1D with default settings?
+24.35%
From 26 Jan 2024 to 21 Oct 2026, over 53 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can RSI Cross [xaurr] 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 RSI Cross [xaurr] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does RSI Cross [xaurr] run in Zeal Terminal?
Yes
It compiles in 9 ms and runs 1,000 bars in 38 ms, in the browser.

BTCUSDT · 1D · default settings

  • RSI Oversold
  • RSI Overbought
  • RSI Line
  • RSI Fast Line
  • RSI Slow Line
  • 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 (6)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctRSI Oversold$121,409$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. 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.
Net profit
+24.35%
$24,354.50
Buy and hold
+102.5%
same period
Closed trades
53
18 won · 35 lost
Profitable
34.0%
of closed trades
Profit factor
1.18
gross profit ÷ gross loss
Max drawdown
35.33%
−$40,170.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.

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 rsi → ta.rsi, ema → ta.ema, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

Verified

Same 53 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: input(type = input.source) → input.source()
  • Line 12: rsi → ta.rsi
  • Line 13: ema → ta.ema
  • Line 14: ema → ta.ema
  • Line 15: crossover → ta.crossover
  • Line 16: crossunder → ta.crossunder
⋯// © xaurr-//@version=4+//@version=5strategy("RSI Cross [xaurr]", shorttitle="RSIC",overlay=false)-src  = input(title="Source", type=input.source, defval=close)+src  = input.source(title="Source", defval=close)//RSI Strategy⋯slowPeriod = input(50,"Smooth Slow Period")-rsi = rsi(src, period)+rsi = ta.rsi(src, period)-fast = ema(rsi,fastPeriod)+fast = ta.ema(rsi,fastPeriod)-slow = ema(rsi,slowPeriod)+slow = ta.ema(rsi,slowPeriod)-long = crossover(fast,slow)+long = ta.crossover(fast,slow)-short = crossunder(fast,slow)+short = ta.crossunder(fast,slow)pos = 0⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 7: input() → input.int()
  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
  • Line 11: input() → input.int()
⋯//RSI Strategy-period = input(5,"RSI Period", minval=1)+period = input.int(5,"RSI Period", minval=1)-overSold = input(30,"RSI Oversold", minval=1)+overSold = input.int(30,"RSI Oversold", minval=1)-overBought = input(70, "RSI Overbought", minval=1)+overBought = input.int(70, "RSI Overbought", minval=1)-fastPeriod = input(20,"Smooth Fast Period")+fastPeriod = input.int(20,"Smooth Fast Period")-slowPeriod = input(50,"Smooth Slow Period")+slowPeriod = input.int(50,"Smooth Slow Period")rsi = ta.rsi(src, period)⋯

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

⋯// © xaurr-//@version=5+//@version=6strategy("RSI Cross [xaurr]", shorttitle="RSIC",overlay=false)⋯

Settings

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

SettingDefaultType and rangeFeeds
Sourceclosesourcersi
RSI Period5int · min 1rsi
RSI Oversold30int · min 1RSI Oversold
RSI Overbought70int · min 1RSI Overbought
Smooth Fast Period20intfast
Smooth Slow Period50intslow

What it calculates

  • RSI (rsi, ta.rsi in v5)Source (close), RSI Period (5)rsi · line 12
  • EMA (ema, ta.ema in v5)rsi, Smooth Fast Period (20)fast · line 13
  • EMA (ema, ta.ema in v5)rsi, Smooth Slow Period (50)slow · line 14
  • Crossover (crossover, ta.crossover in v5)fast, slowlong · line 15
  • Crossunder (crossunder, ta.crossunder in v5)fast, slowshort · 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.

closecloseprice dataperiodRSI Periodsetting · 5fastPeriodSmooth Fast Periodsetting · 20slowPeriodSmooth Slow Periodsetting · 50overSoldRSI Oversoldsetting · 30overBoughtRSI Overboughtsetting · 70rsiRSI→ rsifastEMA→ fastslowEMA→ slowlongCrossover→ longshortCrossunder→ shortposposvalueentry:longOpen longstrategy.entryentry:shortOpen shortstrategy.entryplot:19RSI Oversoldplotplot:20RSI Overboughtplotplot:21RSI Lineplotplot:22RSI Fast Lineplotplot:23RSI Slow Lineplotbgcolor:24bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open long longpos == 1On26
Open short shortpos == -1On28

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.

14/14trades 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+24.4%+102.5%5334%1.1835.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+16.6%+5.5%5030%1.459.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+1.5%+9.8%5536%1.232.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.4%+8.4%5030%1.280.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%6033%1.040.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%5627%0.850.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.4%+148.3%5927%0.761.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.2%+17.1%4835%1.720.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 barsTradesWonP&L
Rising market1724%−$16,517.70
Sideways market2446%$35,270.40
Falling market1225%$5,601.88

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

How bad could the drawdown be?

48.7%

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

0%56%
All 53 trades
SideEntryExitBarsP&L
long18 May 2024 67,024.003 Jun 2024 67,765.6016$741.62
short3 Jun 2024 67,765.604 Jun 2024 68,809.901−$1,044.27
long4 Jun 2024 68,809.9012 Jun 2024 67,314.208−$1,495.66
short12 Jun 2024 67,314.2015 Jul 2024 60,797.9033$6,516.32
long15 Jul 2024 60,797.904 Aug 2024 60,698.0020−$99.92
short4 Aug 2024 60,698.0022 Aug 2024 61,156.0018−$458.04
long22 Aug 2024 61,156.001 Sep 2024 58,974.0010−$2,182.03
short1 Sep 2024 58,974.0014 Sep 2024 60,498.0013−$1,523.99
long14 Sep 2024 60,498.005 Oct 2024 62,086.0021$1,588.01
short5 Oct 2024 62,086.0015 Oct 2024 66,084.0010−$3,998.00
long15 Oct 2024 66,084.005 Nov 2024 67,850.0021$1,766.01
short5 Nov 2024 67,850.007 Nov 2024 75,572.002−$7,721.98
long7 Nov 2024 75,572.002 Dec 2024 97,185.2025$21,613.20
short2 Dec 2024 97,185.2018 Dec 2024 106,134.0016−$8,948.57
long18 Dec 2024 106,134.0019 Dec 2024 100,204.001−$5,929.73
short19 Dec 2024 100,204.0018 Jan 2025 104,077.0030−$3,873.46
long18 Jan 2025 104,077.0029 Jan 2025 101,336.0011−$2,741.95
short29 Jan 2025 101,336.0031 Jan 2025 104,723.002−$3,387.42
long31 Jan 2025 104,723.001 Feb 2025 102,430.001−$2,293.38
short1 Feb 2025 102,430.0020 Mar 2025 86,845.9047$15,583.60
long20 Mar 2025 86,845.907 Apr 2025 78,430.0018−$8,415.93
short7 Apr 2025 78,430.0013 Apr 2025 85,276.906−$6,846.91
long13 Apr 2025 85,276.9030 May 2025 105,590.0047$20,312.80
short30 May 2025 105,590.0030 Jun 2025 108,357.0031−$2,767.18
long30 Jun 2025 108,357.002 Jul 2025 105,681.002−$2,675.80
short2 Jul 2025 105,681.003 Jul 2025 108,850.001−$3,168.46
long3 Jul 2025 108,850.0029 Jul 2025 118,062.0026$9,212.73
short29 Jul 2025 118,062.0014 Aug 2025 123,306.0016−$5,244.12
long14 Aug 2025 123,306.0016 Aug 2025 117,342.002−$5,964.40
short16 Aug 2025 117,342.0011 Sep 2025 113,960.0026$3,382.04
long11 Sep 2025 113,960.0025 Sep 2025 113,307.0014−$652.99
short25 Sep 2025 113,307.003 Oct 2025 120,529.008−$7,222.34
long3 Oct 2025 120,529.0014 Oct 2025 115,166.0011−$5,363.35
short14 Oct 2025 115,166.0029 Oct 2025 112,898.0015$2,267.56
long29 Oct 2025 112,898.0030 Oct 2025 110,021.001−$2,877.14
short30 Oct 2025 110,021.003 Dec 2025 91,277.9034$18,743.40
long3 Dec 2025 91,277.9018 Dec 2025 86,243.2015−$5,034.65
short18 Dec 2025 86,243.2021 Dec 2025 88,360.903−$2,117.68
long21 Dec 2025 88,360.9023 Jan 2026 89,559.7033$1,198.77
short23 Jan 2026 89,559.701 Mar 2026 66,973.3037$22,586.40
long1 Mar 2026 66,973.3029 Mar 2026 66,377.0028−$596.22
short29 Mar 2026 66,377.007 Apr 2026 68,853.709−$2,476.62
long7 Apr 2026 68,853.7017 May 2026 78,148.1040$9,294.39
short17 May 2026 78,148.1023 Jun 2026 64,020.0037$14,128.00
long23 Jun 2026 64,020.0024 Jun 2026 62,734.601−$1,285.44
short24 Jun 2026 62,734.604 Jul 2026 62,583.3010$151.31
long4 Jul 2026 62,583.302 Aug 2026 62,823.7029$240.39
short2 Aug 2026 62,823.706 Aug 2026 64,665.204−$1,841.59
long6 Aug 2026 64,665.2013 Aug 2026 63,480.007−$1,185.25
short13 Aug 2026 63,480.0020 Aug 2026 69,334.807−$5,854.79
long20 Aug 2026 69,334.8011 Sep 2026 76,568.7022$7,233.95
short11 Sep 2026 76,568.7022 Sep 2026 86,620.0011−$10,051.30
long22 Sep 2026 86,620.009 Oct 2026 81,754.5017−$4,865.55

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
RSI Cross [xaurr] this page—v4 strategy+24.4%5335.3%
Bitpanda Coinrule Template by joshuajcoop01rsi emav5 strategy−2.8%44.6%
RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrulersi emav5 strategy−2.8%44.6%
RSI of VWAP by mohaneersi emav4 strategyNo trades on this market
EMA SCALPEUR + RSi - SHORT by YukalMoonrsi emav5 strategyNo trades on this market
BTC Sentiment analysis RSI 2xEMA by exlux99rsi emav4 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msWith a workaround 1,000 bars in 38 msNot measured
PineTSNo 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.

“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/// © xaurr//@version=4strategy("RSI Cross [xaurr]", shorttitle="RSIC",overlay=false)src  = input(title="Source", type=input.source, defval=close)//RSI Strategyperiod = input(5,"RSI Period", minval=1)overSold = input(30,"RSI Oversold", minval=1)overBought = input(70, "RSI Overbought", minval=1)fastPeriod = input(20,"Smooth Fast Period")slowPeriod = input(50,"Smooth Slow Period")rsi = rsi(src, period)fast = ema(rsi,fastPeriod)slow = ema(rsi,slowPeriod)long = crossover(fast,slow)short = crossunder(fast,slow)pos = 0pos:= long ?1:short ?-1 : nz(pos[1])plot(overSold,"RSI Oversold",color=color.green)plot(overBought, "RSI Overbought",color=color.red)plot(rsi, linewidth = 1, color = color.blue, title="RSI Line")plot(fast, linewidth = 2, color = color.green, title="RSI Fast Line")plot(slow, linewidth = 2, color = color.red, title="RSI Slow Line")bgcolor(pos == 1 ? color.green : pos == -1 ? color.red : na)if pos == 1    strategy.entry("long",strategy.long)if pos == -1    strategy.entry("short",strategy.short)