Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

3x Supertrend and Stoch RSI

A Pine Script v4 strategy built on Supertrend (1, 10), RSI (close, 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 and a profit target. Each trade is one contract and pays no commission. 27 settings; defaults include Fast Supertrend ATR Length 10, Fast Supertrend ATR Multiplier 1 and Medium Supertrend ATR Length 11.

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 3x Supertrend and Stoch RSI repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 5 of 5 trades.
How did 3x Supertrend and Stoch RSI do on BTCUSDT 1D with default settings?
−128.66%
From 26 Jan 2024 to 21 Oct 2026, over 24 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can 3x Supertrend and 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.
What alerts does 3x Supertrend and Stoch RSI have?
6
alertLongCondition; alertShortCondition; alertLongProfit; alertLongLoss; and more.
Does 3x Supertrend and Stoch RSI use a stop loss?
Yes
strategy.exit sets a stop on line 79, 91.

BTCUSDT · 1D · default settings

  • Long Signal
  • Short Signal
  • Take profit
  • Middle Line
  • Stop Loss
  • Fast Supertrend
  • Medium Supertrend
  • Slow Supertrend
  • EMA
  • 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 (27)
Lose (short)Lose (Long)Win (Long)Win (Long)Win (Long)Lose (Long)Win (short)Lose (short)Win (Long)Win (Long)Lose (Long)Lose (Long)Win (Long)Win (Long)Lose (Long)Win (short)Win (short)Win (short)Win (short)Lose (short)Lose (short)Lose (Long)Win (short)Win (Long)Lose (Long)40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$-11,528$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. Lines, boxes and labels are the script's own drawings, the most recent ones its limits keep.
Net profit
−128.66%
−$128,664.00
Buy and hold
+102.5%
same period
Closed trades
24
14 won · 10 lost
Profitable
58.3%
of closed trades
Profit factor
0.85
gross profit ÷ gross loss
Max drawdown
207.63%
−$264,988.00

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long 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

    2 settings do nothing

    “Stop Loss Strategy”, “Take Profit Strategy” are declared but never read.

  • 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 supertrend → ta.supertrend, rsi → ta.rsi, sma → ta.sma, stoch → ta.stoch, ema → ta.ema, atr → ta.atr, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

VerifiedDownload the v5 script

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

  • Line 3: //@version=4 → //@version=5
  • Line 6: input(type = input.integer) → input.int()
  • Line 7: input(type = input.float) → input.float()
  • Line 8: input(type = input.integer) → input.int()
  • Line 9: input(type = input.float) → input.float()
  • Line 10: input(type = input.integer) → input.int()
36 more edits
  • Line 11: input(type = input.float) → input.float()
  • Line 12: input(type = input.integer) → input.int()
  • Line 13: input(type = input.integer) → input.int()
  • Line 14: input(type = input.integer) → input.int()
  • Line 15: input(type = input.integer) → input.int()
  • Line 16: input(type = input.source) → input.source()
  • Line 17: input(type = input.bool) → input.bool()
  • Line 18: input(type = input.integer) → input.int()
  • Line 19: input(type = input.integer) → input.int()
  • Line 20: input(type = input.integer) → input.int()
  • Line 21: input(type = input.string) → input.string()
  • Line 22: input(type = input.integer) → input.int()
  • Line 23: input(type = input.float) → input.float()
  • Line 24: input(type = input.string) → input.string()
  • Line 25: input(type = input.integer) → input.int()
  • Line 26: input(type = input.float) → input.float()
  • Line 27: input(type = input.string) → input.string()
  • Line 28: input(type = input.string) → input.string()
  • Line 29: input(type = input.string) → input.string()
  • Line 30: input(type = input.string) → input.string()
  • Line 31: input(type = input.string) → input.string()
  • Line 32: input(type = input.string) → input.string()
  • Line 34: supertrend → ta.supertrend
  • Line 35: supertrend → ta.supertrend
  • Line 36: supertrend → ta.supertrend
  • Line 41: rsi → ta.rsi
  • Line 42: sma → ta.sma
  • Line 42: stoch → ta.stoch
  • Line 43: sma → ta.sma
  • Line 45: ema → ta.ema
  • Line 56: atr → ta.atr
  • Line 57: atr → ta.atr
  • Line 65: crossover → ta.crossover
  • Line 66: crossunder → ta.crossunder
  • Line 68: crossover → ta.crossover
  • Line 69: crossunder → ta.crossunder
⋯// © M3RZI-//@version=4+//@version=5strategy("3x Supertrend and Stoch RSI", overlay = true, max_bars_back = 1000)//INPUTS-STATRLENGTH1 = input(10, title = "Fast Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")+STATRLENGTH1 = input.int(10, title = "Fast Supertrend ATR Length", group = "SUPERTREND SETTINGS")-STATRMULT1 = input(1, title = "Fast Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")+STATRMULT1 = input.float(1, title = "Fast Supertrend ATR Multiplier", group = "SUPERTREND SETTINGS")-STATRLENGTH2 = input(11, title = "Medium Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")+STATRLENGTH2 = input.int(11, title = "Medium Supertrend ATR Length", group = "SUPERTREND SETTINGS")-STATRMULT2 = input(2, title = "Medium Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")+STATRMULT2 = input.float(2, title = "Medium Supertrend ATR Multiplier", group = "SUPERTREND SETTINGS")-STATRLENGTH3 = input(12, title = "Slow Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")+STATRLENGTH3 = input.int(12, title = "Slow Supertrend ATR Length", group = "SUPERTREND SETTINGS")-STATRMULT3 = input(3, title = "Slow Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")+STATRMULT3 = input.float(3, title = "Slow Supertrend ATR Multiplier", group = "SUPERTREND SETTINGS")-stochK = input(3, title = "K (Stochastic Fast)", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+stochK = input.int(3, title = "K (Stochastic Fast)", group = "STOCHASTIC RSI SETTINGS")-stochD = input(3, title = "D (Signal Line)", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+stochD = input.int(3, title = "D (Signal Line)", group = "STOCHASTIC RSI SETTINGS")-rsiLength = input(14, title = "RSI Length", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+rsiLength = input.int(14, title = "RSI Length", group = "STOCHASTIC RSI SETTINGS")-stochLength = input(14, title = "Stochastic Length", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+stochLength = input.int(14, title = "Stochastic Length", group = "STOCHASTIC RSI SETTINGS")-rsiSource = input(close, title = "RSI Source", type = input.source, group = "STOCHASTIC RSI SETTINGS")+rsiSource = input.source(close, title = "RSI Source", group = "STOCHASTIC RSI SETTINGS")-stochRestrictions = input(false, title = "Restrict crosses to overbought/oversold territory", type = input.bool, group = "STOCHASTIC RSI SETTINGS")+stochRestrictions = input.bool(false, title = "Restrict crosses to overbought/oversold territory", group = "STOCHASTIC RSI SETTINGS")-overboughtLine = input(80, title = "Stochastic  RSI Upper Band", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+overboughtLine = input.int(80, title = "Stochastic  RSI Upper Band", group = "STOCHASTIC RSI SETTINGS")-oversoldLine = input(20, title = "Stochastic RSI Lower Band", type = input.integer, group = "STOCHASTIC RSI SETTINGS")+oversoldLine = input.int(20, title = "Stochastic RSI Lower Band", group = "STOCHASTIC RSI SETTINGS")-EMALength  = input(200, title = "EMA Length", type = input.integer, group = "EMA SETTINGS")+EMALength  = input.int(200, title = "EMA Length", group = "EMA SETTINGS")-SLStrategy = input("ATR Based", title = "Stop Loss Strategy", options = ["ATR Based"],type = input.string, group = "POSITION EXIT SETTINGS")+SLStrategy = input.string("ATR Based", title = "Stop Loss Strategy", options = ["ATR Based"], group = "POSITION EXIT SETTINGS")-SLATRLength = input(14, title = "Stop Loss ATR Length", type = input.integer, group = "POSITION EXIT SETTINGS")+SLATRLength = input.int(14, title = "Stop Loss ATR Length", group = "POSITION EXIT SETTINGS")-SLATRMult = input(2.7, title = "Stop Loss ATR Multiplier", type = input.float, group = "POSITION EXIT SETTINGS")+SLATRMult = input.float(2.7, title = "Stop Loss ATR Multiplier", group = "POSITION EXIT SETTINGS")-TPStrategy = input("ATR Based", title = "Take Profit Strategy", options = ["ATR Based"],type = input.string, group = "POSITION EXIT SETTINGS")+TPStrategy = input.string("ATR Based", title = "Take Profit Strategy", options = ["ATR Based"], group = "POSITION EXIT SETTINGS")-TPATRLength = input(14, title = "Take Profit ATR Length", type = input.integer, group = "POSITION EXIT SETTINGS")+TPATRLength = input.int(14, title = "Take Profit ATR Length", group = "POSITION EXIT SETTINGS")-TPATRMult = input(1.6, title = "Take Profit ATR Multiplier", type = input.float, group = "POSITION EXIT SETTINGS")+TPATRMult = input.float(1.6, title = "Take Profit ATR Multiplier", group = "POSITION EXIT SETTINGS")-alertLongCondition = input("", title = "Long Signal", type = input.string, group = "ALERT SETTINGS") +alertLongCondition = input.string("", title = "Long Signal", group = "ALERT SETTINGS") -alertShortCondition = input("", title = "Short Signal", type = input.string, group = "ALERT SETTINGS")+alertShortCondition = input.string("", title = "Short Signal", group = "ALERT SETTINGS")-alertLongProfit = input("", title = "Long Take Profit", type = input.string, group = "ALERT SETTINGS")  +alertLongProfit = input.string("", title = "Long Take Profit", group = "ALERT SETTINGS")  -alertLongLoss = input("", title = "Long Stop Loss", type = input.string, group = "ALERT SETTINGS") +alertLongLoss = input.string("", title = "Long Stop Loss", group = "ALERT SETTINGS") -alertShortProfit = input("", title = "Short Take Profit", type = input.string, group = "ALERT SETTINGS") +alertShortProfit = input.string("", title = "Short Take Profit", group = "ALERT SETTINGS") -alertShortLoss = input("", title = "Short Stop loss", type = input.string, group = "ALERT SETTINGS") +alertShortLoss = input.string("", title = "Short Stop loss", group = "ALERT SETTINGS") //SUPERTRENDS-[superTrend1,dir1] = supertrend(STATRMULT1,STATRLENGTH1)+[superTrend1,dir1] = ta.supertrend(STATRMULT1,STATRLENGTH1)-[superTrend2,dir2] = supertrend(STATRMULT2,STATRLENGTH2)+[superTrend2,dir2] = ta.supertrend(STATRMULT2,STATRLENGTH2)-[superTrend3,dir3] = supertrend(STATRMULT3,STATRLENGTH3)+[superTrend3,dir3] = ta.supertrend(STATRMULT3,STATRLENGTH3)directionST1 = dir1 == 1 and dir1[1] == 1 ? false : dir1 == -1 and dir1[1] == -1 ? true : na⋯//STOCH RSI-rsi = rsi(rsiSource, rsiLength)+rsi = ta.rsi(rsiSource, rsiLength)-k = sma(stoch(rsi, rsi, rsi, stochLength), stochK)+k = ta.sma(ta.stoch(rsi, rsi, rsi, stochLength), stochK)-d = sma(k, stochD)+d = ta.sma(k, stochD)//EMA-ema = ema(close,EMALength)+ema = ta.ema(close,EMALength)//CONDITIONS LONG AND SHORT⋯var initial = 0-stopSize = atr(SLATRLength) * SLATRMult+stopSize = ta.atr(SLATRLength) * SLATRMult-profitSize = atr(TPATRLength) * TPATRMult+profitSize = ta.atr(TPATRLength) * TPATRMultlongStop = close - stopSize⋯if  stochRestrictions-    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and crossover(k,d) and k < oversoldLine and not long and not drawing+    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and ta.crossover(k,d) and k < oversoldLine and not long and not drawing-    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and crossunder(k,d) and k > overboughtLine and not short and not drawing+    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and ta.crossunder(k,d) and k > overboughtLine and not short and not drawingelse-    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and crossover(k,d) and not long and not drawing+    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and ta.crossover(k,d) and not long and not drawing-    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and crossunder(k,d) and not short and not drawing+    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and ta.crossunder(k,d) and not short and not drawingif longCondition⋯

Clean v5

Verified

Nothing to change.

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

⋯// © M3RZI-//@version=5+//@version=6strategy("3x Supertrend and Stoch RSI", overlay = true, max_bars_back = 1000)⋯

Settings

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

SettingDefaultType and rangeFeeds
SUPERTREND SETTINGS
Fast Supertrend ATR Length10int (written input.integer)superTrend1 dir1
Fast Supertrend ATR Multiplier1floatsuperTrend1 dir1
Medium Supertrend ATR Length11int (written input.integer)superTrend2 dir2
Medium Supertrend ATR Multiplier2floatsuperTrend2 dir2
Slow Supertrend ATR Length12int (written input.integer)superTrend3 dir3
Slow Supertrend ATR Multiplier3floatsuperTrend3 dir3
STOCHASTIC RSI SETTINGS
K (Stochastic Fast)3int (written input.integer)k
D (Signal Line)3int (written input.integer)d
RSI Length14int (written input.integer)rsi
Stochastic Length14int (written input.integer)k
RSI Sourceclosesourcersi
Restrict crosses to overbought/oversold territoryfalseboolline 64
Stochastic RSI Upper Band80int (written input.integer)shortCondition
Stochastic RSI Lower Band20int (written input.integer)longCondition
EMA SETTINGS
EMA Length200int (written input.integer)ema
POSITION EXIT SETTINGS
Stop Loss StrategyATR Basedstring · options ["ATR Based"]unused
Stop Loss ATR Length14int (written input.integer)stopSize
Stop Loss ATR Multiplier2.7floatstopSize
Take Profit StrategyATR Basedstring · options ["ATR Based"]unused
Take Profit ATR Length14int (written input.integer)profitSize
Take Profit ATR Multiplier1.6floatprofitSize
ALERT SETTINGS
Long Signalstringalert
Short Signalstringalert
Long Take Profitstringalert
Long Stop Lossstringalert
Short Take Profitstringalert
Short Stop lossstringalert

What it calculates

  • Supertrend (supertrend, ta.supertrend in v5)Fast Supertrend ATR Multiplier (1), Fast Supertrend ATR Length (10)superTrend1 · line 34
  • Supertrend (supertrend, ta.supertrend in v5)Fast Supertrend ATR Multiplier (1), Fast Supertrend ATR Length (10)dir1 · line 34
  • Supertrend (supertrend, ta.supertrend in v5)Medium Supertrend ATR Multiplier (2), Medium Supertrend ATR Length (11)superTrend2 · line 35
  • Supertrend (supertrend, ta.supertrend in v5)Medium Supertrend ATR Multiplier (2), Medium Supertrend ATR Length (11)dir2 · line 35
  • Supertrend (supertrend, ta.supertrend in v5)Slow Supertrend ATR Multiplier (3), Slow Supertrend ATR Length (12)superTrend3 · line 36
  • Supertrend (supertrend, ta.supertrend in v5)Slow Supertrend ATR Multiplier (3), Slow Supertrend ATR Length (12)dir3 · line 36
  • RSI (rsi, ta.rsi in v5)RSI Source (close), RSI Length (14)rsi · line 41
  • SMA / Stoch (sma, ta.sma in v5)stoch(rsi, rsi, rsi, stochLength), K (Stochastic Fast) (3)k · line 42
  • SMA (sma, ta.sma in v5)k, D (Signal Line) (3)d · line 43
  • EMA (ema, ta.ema in v5)close, EMA Length (200)ema · line 45
  • ATR (atr, ta.atr in v5)Stop Loss ATR Length (14)stopSize · line 56
  • ATR (atr, ta.atr in v5)Take Profit ATR Length (14)profitSize · line 57

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.

The script has 71 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open Long longlongConditionOn78
Exit Long exit stop and limitlongConditionOn79
Open Short shortshortConditionOn90
Exit Short exit stop and limitshortConditionOn91

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
(no title)alertalertLongCondition80
(no title)alertalertShortCondition92
(no title)alertalertLongProfit99
(no title)alertalertLongLoss102
(no title)alertalertShortProfit108
(no title)alertalertShortLoss111

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

5/5trades 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−128.7%+102.5%2458%0.85207.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−113.6%+5.5%2442%0.54111.2%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+5.4%+9.8%2763%1.1411.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.7%+8.4%2167%1.272.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.4%+16.7%2157%0.871.5%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.1%+21.5%2568%1.230.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−6.0%+148.3%2650%0.507.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+1.4%+17.1%2378%2.630.4%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 (K (Stochastic Fast) 4, D (Signal Line) 2) made +238.8% before 26 Dec 2025 and −129.4% after it, against −189.5% for the defaults. 31% of the 16 combinations made money in-sample and 25% out-of-sample.

Before 26 Dec 2025 · in-sample
D (Signal Line) ↓ · K (Stochastic Fast) →2345
2−333%−15%+239%+103%
3−227%+61%−27%−183%
4−104%−131%−11%−223%
5+39%−115%−134%+155%
From 26 Dec 2025 · out-of-sample
D (Signal Line) ↓ · K (Stochastic Fast) →2345
2−21%−156%−129%−10%
3−68%−190%−17%+14%
4−46%−153%−14%+55%
5−90%−98%+7%+21%

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 market1050%−$141,358.00
Sideways market875%$147,847.00
Falling market650%−$135,153.00

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

How bad could the drawdown be?

6,901.9%

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

0%7,937%
All 24 trades
SideEntryExitBarsP&L
short6 Sep 2024 56,180.0019 Sep 2024 63,049.2013−$68,691.90
long28 Sep 2024 65,769.903 Oct 2024 59,855.505−$59,144.80
long21 Oct 2024 69,032.0029 Oct 2024 72,108.608$30,766.30
long22 Nov 2024 98,317.105 Dec 2024 104,014.0013$56,965.00
long13 Dec 2024 100,004.0016 Dec 2024 106,777.003$67,728.20
long23 Jan 2025 103,707.003 Feb 2025 91,583.9011−$121,228.00
short23 Mar 2025 83,840.606 Apr 2025 77,651.9014$61,886.60
short16 Apr 2025 83,644.0023 Apr 2025 94,155.507−$105,115.00
long2 May 2025 96,489.908 May 2025 101,153.006$46,630.20
long19 May 2025 106,454.0021 May 2025 110,790.002$43,357.40
long28 May 2025 108,938.005 Jun 2025 100,821.008−$81,168.10
long17 Jun 2025 106,795.0022 Jun 2025 99,054.205−$77,403.40
long4 Jul 2025 109,585.0010 Jul 2025 113,886.006$43,008.20
long28 Jul 2025 119,416.0014 Aug 2025 123,875.0017$44,594.10
long18 Sep 2025 116,448.0025 Sep 2025 109,876.007−$65,716.90
short4 Nov 2025 106,583.004 Nov 2025 100,755.000$58,278.80
short14 Nov 2025 99,692.0016 Nov 2025 93,061.002$66,310.70
short1 Dec 2025 90,360.001 Dec 2025 84,632.700$57,273.00
short6 Dec 2025 89,330.0030 Jan 2026 83,075.7055$62,543.70
short6 Feb 2026 62,909.9017 Apr 2026 77,657.2070−$147,474.00
long11 May 2026 82,210.1018 May 2026 76,716.107−$54,940.20
short28 May 2026 74,449.301 Jun 2026 71,270.404$31,789.50
long5 Sep 2026 79,660.8021 Sep 2026 83,697.6016$40,368.00
long5 Oct 2026 86,530.008 Oct 2026 80,601.803−$59,281.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
3x Supertrend and Stoch RSI this page—v4 strategy−128.7%24207.6%
3 x EMA + Stochastic RSI + ATR by tomimarsonema rsi sma atrv4 strategy−42.3%1844.8%
Atrend by OTS by prim722ema rsi sma atrv4 strategy+12.1%7634.4%
EMA crossover (daily TF) by tradeswithashishema sma rsi atrv5 strategy+11.0%1211.6%
Stochastic Moving Average by LucasVivienstoch sma ema atrv5 strategy+2.8%74.4%
Delta-RSI Strategy (with filters) by tbiktagrsi ema atr smav4 strategy−28.8%7183.8%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 50 msYes 1,000 bars in 132 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/// © M3RZI//@version=4strategy("3x Supertrend and Stoch RSI", overlay = true, max_bars_back = 1000)//INPUTSSTATRLENGTH1 = input(10, title = "Fast Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")STATRMULT1 = input(1, title = "Fast Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")STATRLENGTH2 = input(11, title = "Medium Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")STATRMULT2 = input(2, title = "Medium Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")STATRLENGTH3 = input(12, title = "Slow Supertrend ATR Length", type = input.integer, group = "SUPERTREND SETTINGS")STATRMULT3 = input(3, title = "Slow Supertrend ATR Multiplier", type = input.float, group = "SUPERTREND SETTINGS")stochK = input(3, title = "K (Stochastic Fast)", type = input.integer, group = "STOCHASTIC RSI SETTINGS")stochD = input(3, title = "D (Signal Line)", type = input.integer, group = "STOCHASTIC RSI SETTINGS")rsiLength = input(14, title = "RSI Length", type = input.integer, group = "STOCHASTIC RSI SETTINGS")stochLength = input(14, title = "Stochastic Length", type = input.integer, group = "STOCHASTIC RSI SETTINGS")rsiSource = input(close, title = "RSI Source", type = input.source, group = "STOCHASTIC RSI SETTINGS")stochRestrictions = input(false, title = "Restrict crosses to overbought/oversold territory", type = input.bool, group = "STOCHASTIC RSI SETTINGS")overboughtLine = input(80, title = "Stochastic  RSI Upper Band", type = input.integer, group = "STOCHASTIC RSI SETTINGS")oversoldLine = input(20, title = "Stochastic RSI Lower Band", type = input.integer, group = "STOCHASTIC RSI SETTINGS")EMALength  = input(200, title = "EMA Length", type = input.integer, group = "EMA SETTINGS")SLStrategy = input("ATR Based", title = "Stop Loss Strategy", options = ["ATR Based"],type = input.string, group = "POSITION EXIT SETTINGS")SLATRLength = input(14, title = "Stop Loss ATR Length", type = input.integer, group = "POSITION EXIT SETTINGS")SLATRMult = input(2.7, title = "Stop Loss ATR Multiplier", type = input.float, group = "POSITION EXIT SETTINGS")TPStrategy = input("ATR Based", title = "Take Profit Strategy", options = ["ATR Based"],type = input.string, group = "POSITION EXIT SETTINGS")TPATRLength = input(14, title = "Take Profit ATR Length", type = input.integer, group = "POSITION EXIT SETTINGS")TPATRMult = input(1.6, title = "Take Profit ATR Multiplier", type = input.float, group = "POSITION EXIT SETTINGS")alertLongCondition = input("", title = "Long Signal", type = input.string, group = "ALERT SETTINGS") alertShortCondition = input("", title = "Short Signal", type = input.string, group = "ALERT SETTINGS")alertLongProfit = input("", title = "Long Take Profit", type = input.string, group = "ALERT SETTINGS")  alertLongLoss = input("", title = "Long Stop Loss", type = input.string, group = "ALERT SETTINGS") alertShortProfit = input("", title = "Short Take Profit", type = input.string, group = "ALERT SETTINGS") alertShortLoss = input("", title = "Short Stop loss", type = input.string, group = "ALERT SETTINGS") //SUPERTRENDS[superTrend1,dir1] = supertrend(STATRMULT1,STATRLENGTH1)[superTrend2,dir2] = supertrend(STATRMULT2,STATRLENGTH2)[superTrend3,dir3] = supertrend(STATRMULT3,STATRLENGTH3)directionST1 = dir1 == 1 and dir1[1] == 1 ? false : dir1 == -1 and dir1[1] == -1 ? true : nadirectionST2 = dir2 == 1 and dir2[1] == 1 ? false : dir2 == -1 and dir2[1] == -1 ? true : nadirectionST3 = dir3 == 1 and dir3[1] == 1 ? false : dir3 == -1 and dir3[1] == -1 ? true : na//STOCH RSIrsi = rsi(rsiSource, rsiLength)k = sma(stoch(rsi, rsi, rsi, stochLength), stochK)d = sma(k, stochD)//EMAema = ema(close,EMALength)//CONDITIONS LONG AND SHORTvar long = falsevar longCondition = falsevar short = falsevar shortCondition = falsevar drawing = falsevar TP = 0.0var SL = 0.0var middle = 0.0var initial = 0stopSize = atr(SLATRLength) * SLATRMultprofitSize = atr(TPATRLength) * TPATRMultlongStop = close - stopSizelongProfit = close + profitSizecurrent = closeshortStop = close + stopSizeshortProfit = close - profitSizebarInitial = bar_indexif  stochRestrictions    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and crossover(k,d) and k < oversoldLine and not long and not drawing    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and crossunder(k,d) and k > overboughtLine and not short and not drawingelse    longCondition := close > ema and ((directionST1 == true and directionST2 == true)  or (directionST2 == true and directionST3 == true)) and crossover(k,d) and not long and not drawing    shortCondition := close < ema and ((directionST1 == false and directionST2 == false)  or (directionST2 == false and directionST3 == false)) and crossunder(k,d) and not short and not drawingif longCondition    long := true    short := false    drawing := true    TP := longProfit    middle := current    SL := longStop    initial := barInitial    strategy.entry("Long", strategy.long, 10)    strategy.exit("Long exit","Long", limit = TP, stop = SL)    alert(alertLongCondition,alert.freq_once_per_bar_close)    //label.new(bar_index,low,text = "Long\nTP:"+tostring(TP)+"\nSL:"+tostring(SL)+"\nAbierto:"+tostring(current), yloc = yloc.belowbar, textcolor = color.white, color = color.green, size = size.small,  style = label.style_label_up)if shortCondition    short := true    long := false    drawing := true    TP := shortProfit    middle := current    SL := shortStop    initial := barInitial    strategy.entry("Short", strategy.short, 10)    strategy.exit("Short exit","Short",limit = TP , stop = SL)    alert(alertShortCondition,alert.freq_once_per_bar_close)    //label.new(bar_index,high,text = "Short\nTP:"+tostring(TP)+"\nSL:"+tostring(SL)+"\nAbierto:"+tostring(current), yloc = yloc.abovebar, textcolor = color.white, color = color.red, size = size.small,  style = label.style_label_down)if long and (high[1] >= TP or low[1] <= SL)    drawing := false    long := false    if high[1] >= TP        label.new(bar_index[int((bar_index - initial)/2)],TP, text = "Win (Long)", textcolor = color.white, color = color.green, size = size.small, style = label.style_label_down)        alert(alertLongProfit,alert.freq_once_per_bar_close)    else        label.new(bar_index[int((bar_index - initial)/2)],SL, text = "Lose (Long)", textcolor = color.white, color = color.red, size = size.small, style = label.style_label_up)        alert(alertLongLoss,alert.freq_once_per_bar_close)if short and (low[1] <= TP or high[1] >= SL)    drawing :=  false    short := false    if low[1] <= TP        label.new(bar_index[int((bar_index - initial)/2)],TP, text = "Win (short)", textcolor = color.white, color = color.green, size = size.small, style = label.style_label_up)        alert(alertShortProfit,alert.freq_once_per_bar_close)    else        label.new(bar_index[int((bar_index - initial)/2)],SL, text = "Lose (short)", textcolor = color.white, color = color.red, size = size.small, style = label.style_label_down)        alert(alertShortLoss,alert.freq_once_per_bar_close)//DRAWINGplotshape(longCondition, title = "Long Signal", location=location.belowbar, style=shape.labelup, color=color.green, textcolor=color.white, size=size.small, text="Long")plotshape(shortCondition, title = "Short Signal", location=location.abovebar, style=shape.labeldown, color=color.red, textcolor=color.white, size=size.small, text="Short")profitLine = plot(drawing and drawing[1] ? TP : na, title = "Take profit", color = color.green, style = plot.style_linebr)currentLine =plot(drawing and drawing[1]  ? middle : na, title = "Middle Line", color = color.white, style = plot.style_linebr)lossLine = plot(drawing and drawing[1]  ? SL : na, title = "Stop Loss", color = color.red, style = plot.style_linebr)fill(currentLine,profitLine, title = "Profit Background" ,color = color.new(color.green,75))fill(currentLine,lossLine, title = "Loss Background" ,color = color.new(color.red,75))plot(superTrend1, title = "Fast Supertrend", color = dir1 == 1 and dir1[1] == 1 ? color.red : dir1 == -1 and dir1[1] == -1 ? color.green : na)plot(superTrend2, title = "Medium Supertrend", color = dir2 == 1 and dir2[1] == 1 ? color.red : dir2 == -1 and dir2[1] == -1 ? color.green : na)plot(superTrend3, title = "Slow Supertrend", color = dir3 == 1 and dir3[1] == 1 ? color.red : dir3 == -1 and dir3[1] == -1 ? color.green : na)plot(ema, title = "EMA",color = color.yellow)//plot(k, color = color.blue)//plot(d, color = color.orange)//h1 = hline(80)//h2 = hline(20)//fill(h1,h2, color = color.new(color.purple,60))