Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volatility Capture RSI-Bollinger - Strategy [presentTrading]

A Pine Script v5 strategy built on SMA or Stdev (high, 50), Crossover (hlc3, presentBollingBand) and Crossunder (hlc3, presentBollingBand). It has 4 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 commits 15% of equity and pays 0.1% commission. 9 settings; defaults include Source hlc3, lengthParam 50 and Multiplier 2.7183.

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 Volatility Capture RSI-Bollinger - Strategy [presentTrading] 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 Volatility Capture RSI-Bollinger - Strategy [presentTrading] do on BTCUSDT 1D with default settings?
−2.87%
From 26 Jan 2024 to 21 Oct 2026, over 9 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Volatility Capture RSI-Bollinger - Strategy [presentTrading] run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L7:C25: the argument 'default_qty_type' is specified more than once. The v6 version is shown for reference and is not offered as a download.
Does Volatility Capture RSI-Bollinger - Strategy [presentTrading] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Volatility Capture RSI-Bollinger - Strategy [presentTrading] run in Zeal Terminal?
Yes
It compiles in 23 ms and runs 1,000 bars in 40 ms, in the browser.

BTCUSDT · 1D · default settings

  • presentBollingBand
  • 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 (9)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$9,713$20,253Equity from $10,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
−2.87%
−$286.55
Buy and hold
+102.5%
same period
Closed trades
9
4 won · 5 lost
Profitable
44.4%
of closed trades
Profit factor
0.71
gross profit ÷ gross loss
Max drawdown
5.25%
−$537.68

One run with the author's default settings, $10,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.

  • Likely bug

    ta.crossover(close, presentBollingBand) ignores the settings line 44

    Line 44 hard-codes close where line 26 uses “Source”. Changing those settings moves one band but not this one.

    ta.crossover(close, presentBollingBand)ta.crossover(priceSource, presentBollingBand)
  • Likely bug

    ta.crossunder(close, presentBollingBand) ignores the settings line 42

    Line 42 hard-codes close where line 27 uses “Source”. Changing those settings moves one band but not this one.

    ta.crossunder(close, presentBollingBand)ta.crossunder(priceSource, presentBollingBand)
  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

Settings

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

SettingDefaultType and rangeFeeds
presentBollingBand
Sourcehlc3sourcelongSignal1 shortSignal1 rsiValue
lengthParam50int · min 1upperBollingerBand lowerBollingerBand
Multiplier2.7183float · min 0.1 · step .1upperBollingerBand lowerBollingerBand
Use RSI for signalstrueboolentry Long entry Short line 35 line 38
RSI Period10int · min 1rsiValue
SMA Period5int · min 1rsiSmaValue
Bought Range Level55float · min 1longSignal2
Sold Range Level50float · min 1shortSignal2
Trade DirectionBothstring · options ["Long", "Short", "Both"]entry Long entry Short line 35 line 38

What it calculates

  • SMA / Stdevhigh, lengthParam (50)upperBollingerBand · line 21
  • SMA / Stdevlow, lengthParam (50)lowerBollingerBand · line 22
  • CrossoverSource (hlc3), presentBollingBandlongSignal1 · line 26
  • CrossunderSource (hlc3), presentBollingBandshortSignal1 · line 27
  • RSISource (hlc3), RSI Period (10)rsiValue · line 29
  • SMArsiValue, SMA Period (5)rsiSmaValue · line 30

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.

highhighprice datalengthParamlengthParamsetting · 50multiplierMultipliersetting · 2.7183lowlowprice datahlc3hlc3price datarsiPeriodRSI Periodsetting · 10smaPeriodSMA Periodsetting · 5closecloseprice databoughtRangeBought Range Levelsetting · 55soldRangeSold Range Levelsetting · 50tradeDirectionTrade Directionsetting · BothupperBollingerBandSMA / Stdev→ upperBollingerBandlowerBollingerBandSMA / Stdev→ lowerBollingerBandlongSignal1Crossover→ longSignal1shortSignal1Crossunder→ shortSignal1rsiValueRSI→ rsiValuersiSmaValueSMA→ rsiSmaValuebarIndexbarIndexvaluepresentBollingBandpresentBollingBandvaluelongSignal2longSignal2conditionshortSignal2shortSignal2conditionentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entryclose:LongClose Longstrategy.closeclose:ShortClose Shortstrategy.closeplot:47presentBollingBandplot

Order rules

OrderFires whenBy defaultLine
Open Long long(tradeDirection == "Long" or tradeDirection == "Both") and longSignal1 and (useRSI ? longSignal2 : true)On37
Open Short short(tradeDirection == "Short" or tradeDirection == "Both") and shortSignal1 and (useRSI ? shortSignal2 : true)On40
Close Long(strategy.position_size > 0 and ta.crossunder(close, presentBollingBand))On43
Close Short(strategy.position_size < 0 and ta.crossover(close, presentBollingBand))On45

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−2.9%+102.5%944%0.715.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.7%+5.5%838%0.853.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+8.8%+9.8%650%1.997.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+4.0%+8.4%633%1.892.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−4.3%+16.7%520%0.566.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.1%+21.5%838%0.984.9%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−4.1%+148.3%729%0.526.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+1.7%+17.1%425%1.892.7%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 market650%$167.29
Falling market333%−$453.84

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

How bad could the drawdown be?

9.3%

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

0%11%
All 9 trades
SideEntryExitBarsP&L
short6 Jul 2024 56,628.8016 Oct 2024 67,074.10102−$279.68
long17 Oct 2024 67,620.0027 Feb 2025 84,250.10133$354.95
short27 Feb 2025 84,250.1023 Apr 2025 93,443.0055−$167.95
long24 Apr 2025 93,691.1018 Oct 2025 106,432.00177$198.71
short18 Oct 2025 106,432.0015 Jan 2026 96,951.8089$132.01
long15 Jan 2026 96,951.801 Feb 2026 78,741.1017−$290.99
short1 Feb 2026 78,741.1018 Apr 2026 77,072.0076$28.65
long18 Apr 2026 77,072.003 Jun 2026 66,760.8046−$202.81
short3 Jun 2026 66,760.8020 Aug 2026 69,334.8078−$59.46

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
Volatility Capture RSI-Bollinger - Strategy [presentTrading] this page—v5 strategy−2.9%95.3%
Bottom catch strategy by footlzsma stdev rsiv4 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

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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L7:C25: the argument 'default_qty_type' is specified more than once. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © PresentTrading-//@version=5+//@version=6// Define the strategy settings⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 23 msWith a workaround 1,000 bars in 40 msNot measured
PineTSNot testedNot testedNot 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.

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/// © PresentTrading//@version=5// Define the strategy settingsstrategy('Volatility Capture RSI-Bollinger - Strategy [presentTrading]', overlay=true, precision=3, default_qty_type=strategy.cash,  commission_value= 0.1, commission_type=strategy.commission.percent, slippage=1,   currency=currency.USD, default_qty_type = strategy.percent_of_equity, default_qty_value = 15, initial_capital= 10000)// Define the input parameters for the indicatorpriceSource  = input.source(title='Source', defval=hlc3, group='presentBollingBand') // The price source to uselengthParam   = input.int(50, 'lengthParam', minval=1, group='presentBollingBand') // The length of the moving averagemultiplier = input.float(2.7183, 'Multiplier', minval=0.1, step=.1, group='presentBollingBand') // The multiplier for the ATRuseRSI = input.bool(true, 'Use RSI for signals', group='presentBollingBand') // Boolean input to decide whether to use RSI for signalsrsiPeriod = input.int(10, 'RSI Period', minval=1, group='presentBollingBand') // The period for the RSI calculationsmaPeriod = input.int(5, 'SMA Period', minval=1, group='presentBollingBand') // The period for the SMA calculationboughtRange = input.float(55, 'Bought Range Level', minval=1, group='presentBollingBand') // The level for the bought rangesoldRange = input.float(50, 'Sold Range Level', minval=1, group='presentBollingBand') // The level for the sold range// Add a parameter for choosing Long or ShorttradeDirection = input.string("Both", "Trade Direction", options=["Long", "Short", "Both"], group='presentBollingBand') // Dropdown input for trade direction// Calculate the bollingerBandbarIndex = bar_index // The current bar indexupperBollingerBand = ta.sma(high, lengthParam) + ta.stdev(high, lengthParam) * multiplier // Calculate the upper Bollinger BandlowerBollingerBand = ta.sma(low, lengthParam) - ta.stdev(low, lengthParam) * multiplier // Calculate the lower Bollinger Bandvar float presentBollingBand = na // Initialize the presentBollingBand variablecrossCount = 0 // Initialize the crossCount variable// Calculate the buy and sell signalslongSignal1 = ta.crossover(priceSource, presentBollingBand) // Calculate the long signalshortSignal1 = ta.crossunder(priceSource, presentBollingBand) // Calculate the short signal// Calculate the RSIrsiValue = ta.rsi(priceSource, rsiPeriod) // Calculate the RSI valuersiSmaValue = ta.sma(rsiValue, smaPeriod) // Calculate the SMA of the RSI value// Calculate the buy and sell signalslongSignal2 = rsiSmaValue > boughtRange // Calculate the long signal based on the RSI SMAshortSignal2 = rsiSmaValue < soldRange // Calculate the short signal based on the RSI SMApresentBollingBand := na(lowerBollingerBand) or na(upperBollingerBand)?0.0 : close>presentBollingBand?math.max(presentBollingBand,lowerBollingerBand) : close<presentBollingBand?math.min(presentBollingBand,upperBollingerBand) : 0.0if (tradeDirection == "Long" or tradeDirection == "Both") and longSignal1 and (useRSI ? longSignal2 : true) // Use RSI for signals if useRSI is true    presentBollingBand := lowerBollingerBand // If the trade direction is "Long" or "Both", and the long signal is true, and either useRSI is false or the long signal based on RSI is true, then assign the lowerBollingerBand to the presentBollingBand.    strategy.entry("Long", strategy.long) // Enter a long position.if (tradeDirection == "Short" or tradeDirection == "Both") and shortSignal1 and (useRSI ? shortSignal2 : true) // Use RSI for signals if useRSI is true    presentBollingBand := upperBollingerBand // If the trade direction is "Short" or "Both", and the short signal is true, and either useRSI is false or the short signal based on RSI is true, then assign the upperBollingerBand to the presentBollingBand.    strategy.entry("Short", strategy.short) // Enter a short position.// Exit conditionif (strategy.position_size > 0 and ta.crossunder(close, presentBollingBand)) // If the strategy has a long position and the close price crosses under the presentBollingBand, then close the long position.    strategy.close("Long")if (strategy.position_size < 0 and ta.crossover(close, presentBollingBand)) // If the strategy has a short position and the close price crosses over the presentBollingBand, then close the short position.    strategy.close("Short")//~~ Plotplot(presentBollingBand,"presentBollingBand", color=color.blue) // Plot the presentBollingBand on the chart.