Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Bottom catch strategy

A Pine Script v4 strategy built on SMA (v, 20), Stdev (v, 20) and RSI (close, 20). It has 2 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 is one contract and pays no commission. 5 settings; defaults include Volume SMA Length 20, Mult 2 and RSI Length 20.

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 Bottom catch strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
How did Bottom catch strategy do on BTCUSDT 1D with default settings?
+3.90%
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 Bottom catch strategy 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 Bottom catch strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Bottom catch strategy run in Zeal Terminal?
Yes
It compiles in 9 ms and runs 1,000 bars in 25 ms, in the browser.

BTCUSDT · 1D · default settings

  • SMA
  • Stdev
  • 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 (5)
50,000100,000AprJulOct2025AprJulOct2026AprJulOct30RSI$103,898$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 16) so the engine trades the way the script says.
Net profit
+3.90%
$3,898.47
Buy and hold
+102.5%
same period
Closed trades
3
2 won · 1 lost
Profitable
66.7%
of closed trades
Profit factor
2.23
gross profit ÷ gross loss
Max drawdown
7.13%
−$7,629.93

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

    No commission

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

  • Note

    1 setting has no label

    In the settings dialog mult (line 6) shows 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.

  • Note

    Uses an argument v6 removed

    when = on line 16. The upgraded version below moves each call inside an if block.

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 sma → ta.sma, stdev → ta.stdev, rsi → ta.rsi.
  • 1 strategy call uses the when = argument (line 16). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 11: sma → ta.sma
  • Line 12: stdev → ta.stdev
  • Line 14: rsi → ta.rsi
  • Line 16: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © footlz-//@version=4+//@version=5strategy("Bottom catch strategy", overlay=true)⋯v = volume-basis = sma(v, v_len)+basis = ta.sma(v, v_len)-dev = mult * stdev(v, v_len)+dev = mult * ta.stdev(v, v_len)upper_volume = basis + dev-rsi = rsi(close, rsi_len)+rsi = ta.rsi(close, rsi_len)long = v > upper_volume and rsi < oversold-strategy.entry("Long", true, when=long)+strategy.entry("Long", strategy.long, when=long)passed_time = 0.0⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 5: input() → input.int()
  • Line 6: input() → input.int()
  • Line 7: input() → input.int()
  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 16: when = long → if block
⋯strategy("Bottom catch strategy", overlay=true)-v_len = input(20, title="Volume SMA Length")+v_len = input.int(20, title="Volume SMA Length")-mult = input(2)+mult = input.int(2)-rsi_len = input(20, title="RSI Length")+rsi_len = input.int(20, title="RSI Length")-oversold = input(30, title="Oversold")+oversold = input.int(30, title="Oversold")-close_time = input(10, title="Close After")+close_time = input.int(10, title="Close After")v = volume⋯long = v > upper_volume and rsi < oversold-strategy.entry("Long", strategy.long, when=long)+if long+    strategy.entry("Long", strategy.long)passed_time = 0.0⋯

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, 2 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.

⋯// © footlz-//@version=5+//@version=6strategy("Bottom catch strategy", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
Volume SMA Length20intbasis dev
Mult (no label in the script)2intdev
RSI Length20intrsi
Oversold30intlong
Close After10intclose_all line 24

What it calculates

  • SMA (sma, ta.sma in v5)v, Volume SMA Length (20)basis · line 11
  • Stdev (stdev, ta.stdev in v5)v, Volume SMA Length (20)dev · line 12
  • RSI (rsi, ta.rsi in v5)close, RSI Length (20)rsi · line 14

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.

v_lenVolume SMA Lengthsetting · 20multMultsetting · 2closecloseprice datarsi_lenRSI Lengthsetting · 20volumevolumeprice dataoversoldOversoldsetting · 30close_timeClose Aftersetting · 10basisSMA→ basisdevStdev→ devrsiRSI→ rsivvvalueupper_volumeupper_volumevaluepassed_timepassed_timevaluelonglongconditionv_colorColourv_colorentry:LongOpen Longstrategy.entryclose_all:close_all strategy.close_all

Order rules

OrderFires whenBy defaultLine
Open Long longlongv > upper_volume and rsi < oversoldOn16
Close passed_time >= close_timeOn25

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.

2/2trades 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+3.9%+102.5%367%2.237.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−6.5%+5.5%540%0.249.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.4%+9.8%333%0.290.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%667%0.980.3%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%250%2.930.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%333%0.130.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.1%+148.3%10%0.000.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%2100%—0.0%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 market0—$0.00
Sideways market10%−$3,180.84
Falling market2100%$7,079.31

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

How bad could the drawdown be?

3.0%

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

0%3%
All 3 trades
SideEntryExitBarsP&L
long22 Nov 2025 85,129.402 Dec 2025 86,286.0010$1,156.59
long6 Feb 2026 62,909.9016 Feb 2026 68,832.6010$5,922.72
long3 Jun 2026 66,760.8013 Jun 2026 63,580.0010−$3,180.84

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
Bottom catch strategy this page—v4 strategy+3.9%37.1%
Madri by Mdemoiorsi sma stdevv4 strategy+25.0%436.4%
Bollinger Bands and RSI Short Selling (by Coinrule) by Coinrulesma stdev rsiv5 strategy+7.6%34.3%
Shorting when Bollinger Band Above Price with RSI (by Coinrule) by Coinrulesma stdev rsiv5 strategyNo trades on this market
RSI_Boll-TP-SL by BigCoinHuntersma stdev rsiv5 strategyNo trades on this market
FMC by oliverbadaouisma rsi stdevv4 strategy+139.5%44111.9%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msWith a workaround 1,000 bars in 25 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 16) so the engine trades the way the script says.

“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/// © footlz//@version=4strategy("Bottom catch strategy", overlay=true)v_len = input(20, title="Volume SMA Length")mult = input(2)rsi_len = input(20, title="RSI Length")oversold = input(30, title="Oversold")close_time = input(10, title="Close After")v = volumebasis = sma(v, v_len)dev = mult * stdev(v, v_len)upper_volume = basis + devrsi = rsi(close, rsi_len)long = v > upper_volume and rsi < oversoldstrategy.entry("Long", true, when=long)passed_time = 0.0if strategy.position_size != 0    passed_time := 1else    passed_time := 0if strategy.position_size != 0 and strategy.position_size[1] != 0    passed_time := passed_time[1] + 1if passed_time >= close_time    strategy.close_all()// If want to enable plot, change overlay=false.v_color = close >= close[1] ? color.new(#3eb370, 0) : color.new(#e9546b, 0)// plot(v, title="volume", color=v_color, style=plot.style_columns)// plot(upper_volume, title="Threshold", color=color.aqua)