Pine Script v5 · Strategy
Configurable BB+RSI+Aroon strategy backtest for binary options
A Pine Script v5 strategy built on Highestbars (high, Aroonish_length + 1), Lowestbars (low, Aroonish_length + 1) and RSI (close, 4). It has 5 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 4000 in cash and pays no commission. 10 settings; defaults include Aroonish Lenght 4, Aroonish Confirmation Value 50 and RSI Lenght 4.
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 Configurable BB+RSI+Aroon strategy backtest for binary options repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- How did Configurable BB+RSI+Aroon strategy backtest for binary options do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- Does Configurable BB+RSI+Aroon strategy backtest for binary options run in Pine Script v6?
- Not tested
- Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
- Does Configurable BB+RSI+Aroon strategy backtest for binary options use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Configurable BB+RSI+Aroon strategy backtest for binary options run in Zeal Terminal?
- Yes
- It compiles in 32 ms and runs 1,000 bars in 72 ms, in the browser.
BTCUSDT · 1D · default settings
- Ar-B
- Ar-S
- RSI-B
- RSI-S
- Plot
- Plot
- BB-B
- BB-S
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
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.
-
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
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
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 |
|---|---|---|---|
| Aroonish Lenght | 4 | int · min 1 | Aroonish_upper Aroonish_lower |
| Aroonish Confirmation Value | 50 | int · min 0 · max 100 · step 25 | Aroonish_ConfLong Aroonish_ConfShrt |
| RSI Lenght | 4 | int | RSI |
| RSI Oversold Limit | 20 | int | ConditionLong RSI-B |
| RSI Overbought Limit | 80 | int | ConditionShrt RSI-S |
| Bollinger Lenght | 20 | int · min 1 | BB_basis BB_dev |
| Bollinger Std Dev | 2.5 | float · min 0.1 · max 50 · step 0.1 | BB_dev |
| Bars to keep the operation open | 3 | int · min 1 · max 30 | close A22.L close A22.S line 58 line 62 |
| Start DateStart date and time of backtest | timestamp('14 Sep 2022 06:00 +0100') | time | inDateRange |
| End DateEnd date and time of backtest | timestamp('16 Sep 2022 16:00 +0100') | time | inDateRange |
What it calculates
- Highestbarshigh, Aroonish_length + 1
Aroonish_upper · line 11 - Lowestbarslow, Aroonish_length + 1
Aroonish_lower · line 12 - RSIclose, RSI Lenght (4)
RSI · line 24 - SMAclose, Bollinger Lenght (20)
BB_basis · line 32 - Stdevclose, Bollinger Lenght (20)
BB_dev · line 33
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 A22.L long | inDateRange and ConditionLong | On | 57 |
| Close A22.L | inDateRange and ConditionLong[nBars] | On | 59 |
| Open A22.S short | inDateRange and ConditionShrt | On | 61 |
| Close A22.S | inDateRange and ConditionShrt[nBars] | On | 63 |
| Close | not inDateRange | On | 65 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationcalc_on_every_tick = true. Live values can differ from history.
- 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 | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
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 |
|---|---|---|---|---|---|
| Configurable BB+RSI+Aroon strategy backtest for binary options this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| Bollinger Bands And Aroon Scalping (by Coinrule) by Coinrule | sma stdev highestbars lowestbars | v4 strategy | −5.4% | 8 | 10.0% |
| 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 | ||
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.
- 3 settings use the untyped input() (line 21, 22, 23). 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
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 21: input() → input.int()
- Line 22: input() → input.int()
- Line 23: input() → input.int()
⋯// ====================================================================================-RSI_length = input(4, title='RSI Lenght')+RSI_length = input.int(4, title='RSI Lenght')-RSI_overSold = input(20, title='RSI Oversold Limit')+RSI_overSold = input.int(20, title='RSI Oversold Limit')-RSI_overBought = input(80, title='RSI Overbought Limit')+RSI_overBought = input.int(80, title='RSI Overbought Limit')RSI = ta.rsi(close, RSI_length)⋯Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// CBRA for binary options (Configurable Bollinger Bands, RSI and Aroon)-//@version=5+//@version=6// ====================================================================================⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 32 ms | Yes 1,000 bars in 72 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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/// Developed by Marco Jarquin as part of Arkansas 22 Project for Binary Options// CBRA for binary options (Configurable Bollinger Bands, RSI and Aroon)//@version=5// ====================================================================================strategy('A22.CBRA.Strat', overlay=true, initial_capital=10000, currency='USD', calc_on_every_tick=true, default_qty_type=strategy.cash, default_qty_value=4000, commission_type=strategy.commission.cash_per_order, commission_value=0)// Aroonish Parameters// ====================================================================================Aroonish_length = input.int(4, minval=1, title='Aroonish Lenght')Aroonish_ConfVal = input.int(50, minval=0, maxval=100, step=25, title='Aroonish Confirmation Value')Aroonish_upper = 100 * (-ta.highestbars(high, Aroonish_length + 1) + Aroonish_length) / Aroonish_lengthAroonish_lower = 100 * (-ta.lowestbars(low, Aroonish_length + 1) + Aroonish_length) / Aroonish_length// Aroonish confirmations// ====================================================================================Aroonish_ConfLong = Aroonish_lower >= Aroonish_ConfVal and Aroonish_upper < Aroonish_lowerAroonish_ConfShrt = Aroonish_upper >= Aroonish_ConfVal and Aroonish_upper > Aroonish_lowerplotshape(ta.crossover(Aroonish_lower, Aroonish_upper), color=color.new(color.red, 0), style=shape.triangledown, location=location.abovebar, size=size.auto, title='Ar-B')plotshape(ta.crossover(Aroonish_upper, Aroonish_lower), color=color.new(color.green, 0), style=shape.triangleup, location=location.belowbar, size=size.auto, title='Ar-S')// RSI Parameters// ====================================================================================RSI_length = input(4, title='RSI Lenght')RSI_overSold = input(20, title='RSI Oversold Limit')RSI_overBought = input(80, title='RSI Overbought Limit')RSI = ta.rsi(close, RSI_length)plotshape(ta.crossover(RSI, RSI_overSold), color=color.new(color.orange, 0), style=shape.square, location=location.belowbar, size=size.auto, title='RSI-B')plotshape(ta.crossunder(RSI, RSI_overBought), color=color.new(color.orange, 0), style=shape.square, location=location.abovebar, size=size.auto, title='RSI-S')// Bollinger Parameters// ====================================================================================BB_length = input.int(20, minval=1, title='Bollinger Lenght')BB_mult = input.float(2.5, minval=0.1, maxval=50, step=0.1, title='Bollinger Std Dev')// BB_bars = input(3, minval=1, maxval=5, title="Check bars after crossing")BB_basis = ta.sma(close, BB_length)BB_dev = BB_mult * ta.stdev(close, BB_length)BB_upper = BB_basis + BB_devBB_lower = BB_basis - BB_devp1 = plot(BB_upper, color=color.new(color.blue, 0))p2 = plot(BB_lower, color=color.new(color.blue, 0))// Bars to have the operation open// ====================================================================================nBars = input.int(3, minval=1, maxval=30, title='Bars to keep the operation open')// Strategy condition short or long// ====================================================================================ConditionShrt = (ta.crossunder(close, BB_upper) or ta.crossunder(close[1], BB_upper[1])) and Aroonish_ConfShrt and (ta.crossunder(RSI, RSI_overBought) or ta.crossunder(RSI[1], RSI_overBought[1]))ConditionLong = (ta.crossover(close, BB_lower) or ta.crossover(close[1], BB_lower[1])) and Aroonish_ConfLong and (ta.crossover(RSI, RSI_overSold) or ta.crossover(RSI[1], RSI_overSold[1]))plotshape(ta.crossover(close, BB_lower), color=color.new(color.blue, 0), style=shape.circle, location=location.belowbar, size=size.auto, title='BB-B')plotshape(ta.crossunder(close, BB_upper), color=color.new(color.blue, 0), style=shape.circle, location=location.abovebar, size=size.auto, title='BB-S')// Make input options that configure backtest date range// ====================================================================================iSDate = input.time(title='Start Date', defval=timestamp('14 Sep 2022 06:00 +0100'), tooltip='Start date and time of backtest')iFDate = input.time(title='End Date', defval=timestamp('16 Sep 2022 16:00 +0100'), tooltip='End date and time of backtest')// Look if the close time of the current bar falls inside the date range// ====================================================================================inDateRange = time >= iSDate and time < iFDate// Evaluates conditions to enter short or long// ====================================================================================if inDateRange and ConditionLong strategy.entry('A22.L', strategy.long)if inDateRange and ConditionLong[nBars] strategy.close('A22.L', comment='A22.L Exit')if inDateRange and ConditionShrt strategy.entry('A22.S', strategy.short)if inDateRange and ConditionShrt[nBars] strategy.close('A22.S', comment='A22.S Exit')if not inDateRange strategy.close_all()