Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Supertrend + RSI Strategy [Alose]

A Pine Script v5 strategy built on Supertrend (3.0, 10) and RSI (close, 14). It has 4 order rules, 2 entries among them, and trades long only with the default settings; 1 entry is switched off until a setting enables it. Exits wait for a signal; there is no stop loss. Each trade commits 20% of equity and pays 0.01% commission. 8 settings; defaults include ATR Length 10, Factor 3.0 and Source close.

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 Supertrend + RSI Strategy [Alose] repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
How did Supertrend + RSI Strategy [Alose] do on BTCUSDT 1D with default settings?
−6.12%
From 26 Jan 2024 to 21 Oct 2026, over 14 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Supertrend + RSI Strategy [Alose] 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: 14 before, 14 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Supertrend + RSI Strategy [Alose] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Supertrend + RSI Strategy [Alose] run in Zeal Terminal?
Yes
It compiles in 15 ms and runs 1,000 bars in 30 ms, in the browser.

BTCUSDT · 1D · default settings

  • Supertrend up
  • Supertrend down
  • 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 (8)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct7228RSI$939$2,025Equity from $1,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Net profit
−6.12%
−$61.24
Buy and hold
+102.5%
same period
Closed trades
14
7 won · 7 lost
Profitable
50.0%
of closed trades
Profit factor
0.57
gross profit ÷ gross loss
Max drawdown
8.57%
−$85.96

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.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    The short side is off by default line 28

    Its orders only fire after “Short entries” is switched on. The figures on this page cover long trades only.

  • Note

    Uses an argument v6 removed

    when = on line 25, 26, 28, 29. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Supertrend
ATR Length10intdirection _
Factor3.0float · step 0.01direction _
RSI
SourceclosesourceRSI
Length14int · min 1RSI
Strategy
Long entriestrueboolentry Long close Long line 24
Short entriesfalseboolentry Short close Short line 27
Exit LongThe trade will close when the RSI crosses up this point.72int · min 1exitLong
Exit ShortThe trade will close when the RSI crosses below this point.28int · min 1exitShort

What it calculates

  • SupertrendFactor (3.0), ATR Length (10)direction · line 8
  • RSISource (close), Length (14)RSI · line 13

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.

high · low · closehigh · low · closeprice datafactorFactorsetting · 3.0atrPeriodATR Lengthsetting · 10closecloseprice datalenRSILengthsetting · 14RSIoverboughtExit Longsetting · 72RSIoversoldExit Shortsetting · 28directionSupertrend→ directionRSIRSI→ RSIentryLongentryLongconditionexitLongexitLongconditionentryShortentryShortconditionexitShortexitShortconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.close

Order rules

OrderFires whenBy defaultLine
Open Long longentryLongta.change(direction) < 0On “Long entries”25
Close LongexitLongRSI > RSIoverbought or ta.change(direction) > 0On “Long entries”26
Open Short shortentryShortta.change(direction) > 0Off “Short entries”28
Close ShortexitShortRSI < RSIoversold or ta.change(direction) < 0Off “Short entries”29

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.

4/4trades 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−6.1%+102.5%1450%0.578.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−1.5%+5.5%1250%0.531.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−4.0%+9.8%1250%0.7110.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.2%+8.4%1155%1.302.3%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+9.9%+16.7%1267%2.017.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+1.1%+21.5%1242%1.183.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−3.2%+148.3%1450%0.778.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−2.7%+17.1%1233%0.333.1%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Settings heatmap

Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (ATR Length 5, Factor 1.5) made +3.4% before 26 Dec 2025 and +2.3% after it, against −2.1% for the defaults. 39% of the 64 combinations made money in-sample and 31% out-of-sample.

Before 26 Dec 2025 · in-sample
Factor ↓ · ATR Length →567910121417
1.5+3%+2%+2%+3%+3%+3%+1%+0%
1.8−1%+0%+1%+0%+2%+1%+0%−2%
2.1−2%−1%+0%+0%−1%−1%−1%−2%
2.55−5%−4%−5%−5%−5%−4%−4%−4%
3−0%−0%+0%−1%−4%−6%−6%−7%
3.6−2%−1%−1%−1%−1%−2%−3%−2%
4.2+1%−2%+1%+2%−1%+2%+2%+2%
5.1+3%+3%−1%−3%−3%−3%−2%−1%
From 26 Dec 2025 · out-of-sample
Factor ↓ · ATR Length →567910121417
1.5+2%+2%+2%+1%+1%+1%+1%+1%
1.8+2%+2%+1%−1%−1%+0%+0%+0%
2.1+0%+1%+1%−1%−1%−1%−1%−0%
2.55−0%−0%−1%−1%−1%−1%−2%−2%
3−1%−2%−2%−2%−2%−1%−1%−1%
3.6−0%−1%−1%−1%−1%+1%+1%+0%
4.2−2%−2%−2%−0%−0%−0%−0%−1%
5.1−0%−0%−1%−1%−1%−2%−2%−2%

Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market333%−$33.45
Sideways market850%−$20.93
Falling market367%−$6.86

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

How bad could the drawdown be?

12.0%

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

0%14%
All 14 trades
SideEntryExitBarsP&L
long10 Feb 2024 47,132.8011 Feb 2024 47,751.101$2.58
long21 May 2024 71,446.6022 Jun 2024 64,143.6032−$20.53
long16 Jul 2024 64,724.104 Aug 2024 60,698.0019−$12.25
long24 Aug 2024 64,037.206 Sep 2024 56,180.0013−$23.83
long20 Sep 2024 62,948.0030 Oct 2024 72,736.4040$29.38
long18 Jan 2025 104,077.0025 Feb 2025 91,552.9038−$23.51
long3 Mar 2025 94,270.0011 Mar 2025 78,595.908−$31.68
long23 Apr 2025 93,443.009 May 2025 103,262.0016$19.30
long10 Jul 2025 111,234.0012 Jul 2025 117,528.002$10.59
long2 Oct 2025 118,595.007 Oct 2025 124,659.005$9.67
long14 Jan 2026 95,414.0021 Jan 2026 88,427.707−$14.09
long5 Mar 2026 72,666.8030 Mar 2026 66,010.9025−$17.36
long14 Apr 2026 74,418.0023 May 2026 75,539.5039$2.76
long22 Jul 2026 66,556.1020 Aug 2026 69,334.8029$7.74

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
Supertrend + RSI Strategy [Alose] this page—v5 strategy−6.1%148.6%
JS-TechTrading- Supertrend-Strategy_Basic version by JS_TechTradingsupertrend rsiv5 strategy+0.1%20.0%
Kitchen [ilovealgotrading] by lovealgotradingsupertrend rsiv5 strategyNo trades on this market
Golden Swing Strategy - Souradeep Dey by rajm14rsi supertrendv5 strategy−0.0%110.0%
3x Supertrend and Stoch RSI by M3RZIsupertrend rsiv4 strategy−128.7%24207.6%
Simple SuperTrend Strategy for BTCUSD 4H by StrategiesForEveryonersi supertrendv5 strategy+1.1%7219.5%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 4 strategy calls use the when = argument (line 25, 26, 28, 29). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 2 settings use the untyped input() (line 6, 11). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 6: input() → input.int()
  • Line 11: input() → input.source()
  • Line 25: when = entryLong → if block
  • Line 26: when = exitLong → if block
  • Line 28: when = entryShort → if block
  • Line 29: when = exitShort → if block
⋯stGroup = 'Supertrend'-atrPeriod = input(10, "ATR Length", group=stGroup)+atrPeriod = input.int(10, "ATR Length", group=stGroup)factor = input.float(3.0, "Factor", step = 0.01, group=stGroup)⋯rsiGroup = 'RSI'-src = input(title='Source', defval=close, group=rsiGroup)+src = input.source(title='Source', defval=close, group=rsiGroup)lenRSI = input.int(14, title='Length', minval=1, group=rsiGroup)⋯if showLong-    strategy.entry("Long", strategy.long, when=entryLong)+    if entryLong+        strategy.entry("Long", strategy.long)-    strategy.close("Long", when=exitLong)+    if exitLong+        strategy.close("Long")if showShort-    strategy.entry("Short", strategy.short, when=entryShort)+    if entryShort+        strategy.entry("Short", strategy.short)-    strategy.close("Short", when=exitShort)+    if exitShort+        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: 14 before, 14 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.

⋯// © alorse-//@version=5+//@version=6strategy("Supertrend + RSI Strategy [Alose]", overlay=true, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=20, commission_type=strategy.commission.percent, commission_value=0.01)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 15 msYes 1,000 bars in 30 msNot measured
PineTSNot testedNot testedNot 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.

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/// © alorse//@version=5strategy("Supertrend + RSI Strategy [Alose]", overlay=true, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=20, commission_type=strategy.commission.percent, commission_value=0.01)stGroup = 'Supertrend'atrPeriod = input(10, "ATR Length", group=stGroup)factor = input.float(3.0, "Factor", step = 0.01, group=stGroup)[_, direction] = ta.supertrend(factor, atrPeriod)// RSIrsiGroup = 'RSI'src = input(title='Source', defval=close, group=rsiGroup)lenRSI = input.int(14, title='Length', minval=1, group=rsiGroup)RSI = ta.rsi(src, lenRSI)// Strategy ConditionsstratGroup = 'Strategy'showLong = input.bool(true, title='Long entries', group=stratGroup)showShort = input.bool(false, title='Short entries', group=stratGroup)RSIoverbought = input.int(72, title='Exit Long', minval=1, group=stratGroup, tooltip='The trade will close when the RSI crosses up this point.')RSIoversold = input.int(28, title='Exit Short', minval=1, group=stratGroup, tooltip='The trade will close when the RSI crosses below this point.')entryLong = ta.change(direction) < 0exitLong = RSI > RSIoverbought or ta.change(direction) > 0entryShort = ta.change(direction) > 0exitShort = RSI < RSIoversold or ta.change(direction) < 0if showLong    strategy.entry("Long", strategy.long, when=entryLong)    strategy.close("Long", when=exitLong)if showShort    strategy.entry("Short", strategy.short, when=entryShort)    strategy.close("Short", when=exitShort)