Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Double Bollinger Binary Options

A Pine Script v5 strategy built on SMA (close, 20) and Stdev (close, 20). It has 2 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 is one contract and pays no commission. 6 settings; defaults include Length1 20, Source close and StdDev 2.0.

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 Double Bollinger Binary Options repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Double Bollinger 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; it opened a short position that was still open on the last bar, so there is no result to report. On SOLUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Does Double Bollinger Binary Options 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: 1 before, 0 after on SOLUSDT 4h, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Double Bollinger Binary Options use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Double Bollinger Binary Options run in Zeal Terminal?
Yes
It compiles in 9 ms and runs 1,000 bars in 24 ms, in the browser.

BTCUSDT · 1D · default settings

  • SMA
  • Stdev
  • 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 (6)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$977,723$2,025,273Equity from $1,000,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.
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
6.38%
−$63,767.50

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

    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

    2 settings have no label

    In the settings dialog length1 (line 6), length2 (line 14) show 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.

Settings

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

SettingDefaultType and rangeFeeds
Length1 (no label in the script)20int · min 1basis1 dev1
Sourceclosesourcebasis1 dev1
StdDev2.0float · min 0.001 · max 50dev1
Length2 (no label in the script)20int · min 1basis2 dev2
Sourceclosesourcebasis2 dev2
StdDev3.0float · min 0.001 · max 50dev2

What it calculates

  • SMASource (close), Length1 (20)basis1 · line 9
  • StdevSource (close), Length1 (20)dev1 · line 10
  • SMASource (close), Length2 (20)basis2 · line 17
  • StdevSource (close), Length2 (20)dev2 · line 18

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.

closecloseprice datalength1Length1setting · 20mult1StdDevsetting · 2.0length2Length2setting · 20mult2StdDevsetting · 3.0basis1SMA→ basis1dev1Stdev→ dev1basis2SMA→ basis2dev2Stdev→ dev2upper1, lower1upper1 · lower12 valuesupper2, lower2upper2 · lower22 valuesbuybuyconditionsellsellconditionentry:CALLOpen CALLstrategy.entryentry:PUTOpen PUTstrategy.entry

Order rules

OrderFires whenBy defaultLine
Open CALL long(buy)On27
Open PUT short(sell)On29

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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 1D0.0%+102.5%00%—6.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—1.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%10%0.000.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—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.

ScriptSharesTypeNetTradesMax drawdown
Double Bollinger Binary Options this page—v5 strategy0.0%06.4%
Improved Bollinger Swing Strategy Stock Nasdaq by exlux99sma stdevv4 strategy−20.4%722.3%
I11L Long Put-Call Ratio Inversion by I11Lsma stdevv5 strategyNo trades on this market
P-Signal Strategy by Kharevskystdev smav4 strategy−9.7%2934.6%
P-Signal Strategy & Alert by Kharevskystdev smav4 strategy−9.7%2934.6%
Bollinger Stop Strategy by ROBO_Tradingsma stdevv5 strategy−32.0%4161.5%

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.

  • 2 settings use the untyped input() (line 7, 15). 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

VerifiedDownload the v5 script

Same 1 trades and the same P&L on SOLUSDT 4h, 1,000 bars, in Zeal Terminal's engine.

  • Line 7: input() → input.source()
  • Line 15: input() → input.source()
⋯length1 = input.int(20, minval=1)-src1 = input(close, title="Source")+src1 = input.source(close, title="Source")mult1 = input.float(2.0, minval=0.001, maxval=50, title="StdDev")⋯length2 = input.int(20, minval=1)-src2 = input(close, title="Source")+src2 = input.source(close, title="Source")mult2 = input.float(3.0, minval=0.001, maxval=50, title="StdDev")⋯

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: 1 before, 0 after on SOLUSDT 4h, 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.

⋯// © Trade_by_DB-//@version=5+//@version=6strategy("Double Bollinger Binary Options", overlay=true, margin_long=100, margin_short=100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msYes 1,000 bars in 24 msNot measured
PineTSNot testedNot testedNot 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/// © Trade_by_DB//@version=5strategy("Double Bollinger Binary Options", overlay=true, margin_long=100, margin_short=100)// Bollinger bands #1 (20,2)length1 = input.int(20, minval=1)src1 = input(close, title="Source")mult1 = input.float(2.0, minval=0.001, maxval=50, title="StdDev")basis1 = ta.sma(src1, length1)dev1 = mult1 * ta.stdev(src1, length1)upper1 = basis1 + dev1lower1 = basis1 - dev1//Bollinger bands #2length2 = input.int(20, minval=1)src2 = input(close, title="Source")mult2 = input.float(3.0, minval=0.001, maxval=50, title="StdDev")basis2 = ta.sma(src2, length2)dev2 = mult2 * ta.stdev(src2, length2)upper2 = basis2 + dev2lower2 = basis2 - dev2//Buy Conditionbuy = close < lower2 and ta.rsi(close,14) <=20sell = close > upper2 and ta.rsi(close,14) >=80// plotshape(buy, style = shape.arrowup , color = color.green, location = location.belowbar)// plotshape(sell, style = shape.arrowdown , color = color.red, location = location.abovebar)if (buy)    strategy.entry("CALL", strategy.long)if (sell)    strategy.entry("PUT", strategy.short)