Pine Script v4 · Strategy
RSI Trend Crypto
A Pine Script v4 strategy built on RSI (close, 14), Crossover (rsi, 35) and Crossunder (rsi, 75). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays 0.2 commission. 4 settings; defaults include RSI Long Cross 35, RSI Close Position 75 and RSI Emergency Close Position 10.
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 Trend Crypto repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did RSI Trend Crypto do on BTCUSDT 1D with default settings?
- +19.58%
- From 26 Jan 2024 to 21 Oct 2026, over 3 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can RSI Trend Crypto be converted to Pine Script v5?
- No
- The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
- Does RSI Trend Crypto use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does RSI Trend Crypto run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 26 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +19.58%
- $19,580.40
- Buy and hold
- +102.5%
- same period
- Closed trades
- 3
- 2 won · 1 lost
- Profitable
- 66.7%
- of closed trades
- Profit factor
- 1.48
- gross profit ÷ gross loss
- Max drawdown
- 44.47%
- −$71,253.60
One run with the author's default settings, $100,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.
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, crossover → ta.crossover, crossunder → ta.crossunder.
v4 → v5
DiffersTrades differ: 3 before, 3 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 11: rsi → ta.rsi
- Line 13: crossover → ta.crossover
- Line 14: crossunder → ta.crossunder
- Line 15: crossunder → ta.crossunder
⋯// © FieryTrading-//@version=4+//@version=5strategy("RSI Trend Crypto", overlay=false, pyramiding=1, commission_value=0.2, default_qty_type=strategy.percent_of_equity, default_qty_value=100)⋯// RSI-rsi = rsi(close, 14)+rsi = ta.rsi(close, 14)// Conditions-long = crossover(rsi, RSIlong)+long = ta.crossover(rsi, RSIlong)-longclose = crossunder(rsi, RSIclose)+longclose = ta.crossunder(rsi, RSIclose)-emergency = crossunder(rsi, Emergencyclose)+emergency = ta.crossunder(rsi, Emergencyclose)// Plots⋯Clean v5
VerifiedSame 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.bool()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
⋯// Input-UseEmergency = input(false, "Use Emergency Exit?")+UseEmergency = input.bool(false, "Use Emergency Exit?")-RSIlong = input(35, "RSI Long Cross")+RSIlong = input.int(35, "RSI Long Cross")-RSIclose = input(75, "RSI Close Position")+RSIclose = input.int(75, "RSI Close Position")-Emergencyclose = input(10, "RSI Emergency Close Position")+Emergencyclose = input.int(10, "RSI Emergency Close Position")// RSI⋯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: 3 before, 3 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.
⋯// © FieryTrading-//@version=5+//@version=6strategy("RSI Trend Crypto", overlay=false, pyramiding=1, commission_value=0.2, default_qty_type=strategy.percent_of_equity, default_qty_value=100)⋯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 Emergency Exit? | false | bool | close Long line 31 |
| RSI Long Cross | 35 | int | long plot |
| RSI Close Position | 75 | int | longclose plot |
| RSI Emergency Close Position | 10 | int | emergency |
What it calculates
- RSI (
rsi,ta.rsiin v5)close, 14rsi · line 11 - Crossover (
crossover,ta.crossoverin v5)rsi, RSI Long Cross (35)long · line 13 - Crossunder (
crossunder,ta.crossunderin v5)rsi, RSI Close Position (75)longclose · line 14 - Crossunder (
crossunder,ta.crossunderin v5)rsi, RSI Emergency Close Position (10)emergency · line 15
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 | long | On | 28 |
| Close Long | longclose | On | 30 |
| Close Long | emergency and UseEmergency==true | On | 32 |
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 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 | +19.6% | +102.5% | 3 | 67% | 1.48 | 44.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.5% | +5.5% | 2 | 50% | 0.91 | 27.6% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −10.0% | +9.8% | 4 | 50% | 0.85 | 62.7% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +20.4% | +8.4% | 4 | 75% | 1.98 | 34.2% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −15.0% | +16.7% | 4 | 50% | 0.83 | 69.5% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +8.6% | +21.5% | 4 | 50% | 1.54 | 31.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +9.4% | +148.3% | 2 | 50% | 1.22 | 44.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +26.4% | +17.1% | 3 | 100% | 105.49 | 16.8% | 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 | 100% | $47,267.30 |
| Sideways market | 2 | 50% | −$27,687.00 |
| 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?
25.4%
The 95th percentile of the worst drawdown when the same 3 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 25.4% to 25.4%; the tick is what actually happened, 25.4%. Order luck alone moves it this much.
All 3 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 3 May 2024 59,060.60 | 15 Nov 2024 87,325.60 | 196 | $47,267.30 |
| long | 3 Mar 2025 94,270.00 | 10 May 2025 102,972.00 | 68 | $12,952.00 |
| long | 6 Nov 2025 103,885.00 | 29 Aug 2026 77,845.90 | 296 | −$40,639.00 |
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 |
|---|---|---|---|---|---|
| RSI Trend Crypto this page | — | v4 strategy | +19.6% | 3 | 44.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% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 12 ms | Yes 1,000 bars in 26 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/// © FieryTrading//@version=4strategy("RSI Trend Crypto", overlay=false, pyramiding=1, commission_value=0.2, default_qty_type=strategy.percent_of_equity, default_qty_value=100)// InputUseEmergency = input(false, "Use Emergency Exit?")RSIlong = input(35, "RSI Long Cross")RSIclose = input(75, "RSI Close Position")Emergencyclose = input(10, "RSI Emergency Close Position")// RSIrsi = rsi(close, 14)// Conditionslong = crossover(rsi, RSIlong)longclose = crossunder(rsi, RSIclose)emergency = crossunder(rsi, Emergencyclose)// Plotsplot(rsi, color=color.white, linewidth=2)plot(RSIlong, color=color.green)plot(RSIclose, color=color.red)// Alert messages // When using a bot remember to use "{{strategy.order.alert_message}}" in your alert// You can edit the alert message freely to suit your needsLongAlert = 'RSI Long Cross: LONG'CloseAlert = 'RSI Close Position'EmergencyAlert = 'RSI Emergency Close'// Strategyif long strategy.entry("Long", strategy.long, alert_message=LongAlert)if longclose strategy.close("Long", alert_message=CloseAlert)if emergency and UseEmergency==true strategy.close("Long", alert_message=EmergencyAlert)