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
- 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| presentBollingBand | |||
| Source | hlc3 | source | longSignal1 shortSignal1 rsiValue |
| lengthParam | 50 | int · min 1 | upperBollingerBand lowerBollingerBand |
| Multiplier | 2.7183 | float · min 0.1 · step .1 | upperBollingerBand lowerBollingerBand |
| Use RSI for signals | true | bool | entry Long entry Short line 35 line 38 |
| RSI Period | 10 | int · min 1 | rsiValue |
| SMA Period | 5 | int · min 1 | rsiSmaValue |
| Bought Range Level | 55 | float · min 1 | longSignal2 |
| Sold Range Level | 50 | float · min 1 | shortSignal2 |
| Trade Direction | Both | string · 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), presentBollingBand
longSignal1 · line 26 - CrossunderSource (hlc3), presentBollingBand
shortSignal1 · 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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | (tradeDirection == "Long" or tradeDirection == "Both") and longSignal1 and (useRSI ? longSignal2 : true) | On | 37 |
| Open Short short | (tradeDirection == "Short" or tradeDirection == "Both") and shortSignal1 and (useRSI ? shortSignal2 : true) | On | 40 |
| Close Long | (strategy.position_size > 0 and ta.crossunder(close, presentBollingBand)) | On | 43 |
| Close Short | (strategy.position_size < 0 and ta.crossover(close, presentBollingBand)) | On | 45 |
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.
- 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 | −2.9% | +102.5% | 9 | 44% | 0.71 | 5.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.7% | +5.5% | 8 | 38% | 0.85 | 3.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +8.8% | +9.8% | 6 | 50% | 1.99 | 7.2% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +4.0% | +8.4% | 6 | 33% | 1.89 | 2.9% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −4.3% | +16.7% | 5 | 20% | 0.56 | 6.4% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.1% | +21.5% | 8 | 38% | 0.98 | 4.9% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −4.1% | +148.3% | 7 | 29% | 0.52 | 6.7% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +1.7% | +17.1% | 4 | 25% | 1.89 | 2.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 0 | — | $0.00 |
| Sideways market | 6 | 50% | $167.29 |
| Falling market | 3 | 33% | −$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.
All 9 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 6 Jul 2024 56,628.80 | 16 Oct 2024 67,074.10 | 102 | −$279.68 |
| long | 17 Oct 2024 67,620.00 | 27 Feb 2025 84,250.10 | 133 | $354.95 |
| short | 27 Feb 2025 84,250.10 | 23 Apr 2025 93,443.00 | 55 | −$167.95 |
| long | 24 Apr 2025 93,691.10 | 18 Oct 2025 106,432.00 | 177 | $198.71 |
| short | 18 Oct 2025 106,432.00 | 15 Jan 2026 96,951.80 | 89 | $132.01 |
| long | 15 Jan 2026 96,951.80 | 1 Feb 2026 78,741.10 | 17 | −$290.99 |
| short | 1 Feb 2026 78,741.10 | 18 Apr 2026 77,072.00 | 76 | $28.65 |
| long | 18 Apr 2026 77,072.00 | 3 Jun 2026 66,760.80 | 46 | −$202.81 |
| short | 3 Jun 2026 66,760.80 | 20 Aug 2026 69,334.80 | 78 | −$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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Volatility Capture RSI-Bollinger - Strategy [presentTrading] this page | — | v5 strategy | −2.9% | 9 | 5.3% |
| Bottom catch strategy by footlz | sma stdev rsi | v4 strategy | +3.9% | 3 | 7.1% |
| Madri by Mdemoio | rsi sma stdev | v4 strategy | +25.0% | 4 | 36.4% |
| Bollinger Bands and RSI Short Selling (by Coinrule) by Coinrule | sma stdev rsi | v5 strategy | +7.6% | 3 | 4.3% |
| Shorting when Bollinger Band Above Price with RSI (by Coinrule) by Coinrule | sma stdev rsi | v5 strategy | No trades on this market | ||
| RSI_Boll-TP-SL by BigCoinHunter | sma stdev rsi | v5 strategy | No 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
VerifiedNothing 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
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 23 ms | With a workaround 1,000 bars in 40 ms | Not measured |
| PineTS | Not tested | Not tested | Not 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.