Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volatility Breakout Strategy

A Pine Script v5 strategy with no technical-analysis calculation. It has 4 order rules, 2 entries among them, and trades long only with the default settings; 1 entry is switched off until a setting enables it. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 3 settings; defaults include K 0.6.

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 Breakout Strategy repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did Volatility Breakout Strategy 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 long position that was still open on the last bar, so there is no result to report. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Does Volatility Breakout Strategy 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: 64 before, 58 after on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does Volatility Breakout Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Volatility Breakout Strategy run in Zeal Terminal?
Yes
It compiles in 22 ms and runs 1,000 bars in 62 ms, in the browser.

BTCUSDT · 1D · default settings

  • Long Entry
  • Long StopLoss
  • 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 (3)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$2,025,150$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. Lines are what the script plots.
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
1.03%
−$10,261.50

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    1 setting has no label

    In the settings dialog k (line 5) 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

    The short side is off by default line 37

    Its orders only fire after “Short Postion Open??” is switched on. The figures on this page cover long trades only.

  • Note

    Uses an argument v6 removed

    when = on line 34, 35, 37, 38. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
K (no label in the script)0.6floatlp sp
Short Postion Open??falseboolentry Short close Short Short Entry Short StopLoss line 36
Trend Following?falseboollongtrend shorttrend

What it calculates

No technical-analysis calculation: the script works on prices and settings directly.

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.

openopenprice datahighhighprice datalowlowprice dataclosecloseprice datakKsetting · 0.6oovaluehhvaluellvalueccvaluelp, splp · sp2 valuesslslvaluesl2sl2valuelongtrend, shorttrendlongtrend · shorttrend2 valuesbgbgvalueexitexitconditionexit2exit2conditionlongcondlongcondconditionshortcondshortcondconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:23Long Entryplotplot:24Long StopLossplotplot:29Short Entryplotplot:30Short StopLossplotbgcolor:43bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open Long longlongcond and strategy.opentrades == 0 and longtrendOn34
Close Longexithour[1]-hour>1 or close < slOn35
Open Short shortshortcond and strategy.opentrades == 0 and shorttrendOff “Short Postion Open??”37
Close Shortexit2hour[1]-hour>1 or close > sl2Off “Short Postion Open??”38

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.

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 data1 request.security call(s), none with lookahead on.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationreads realtime-only state. 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D0.0%+102.5%00%—1.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+4.7%+5.5%6445%1.188.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—38.9%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.6%+8.4%5643%1.0511.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—34.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+23.3%+21.5%5149%1.5712.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—1.9%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+21.4%+17.1%5744%1.667.7%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Similar scripts

No other indicator or strategy here shares enough of its calculations.

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.

  • 4 strategy calls use the when = argument (line 34, 35, 37, 38). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 34: when = longcond and strategy.opentrades == 0 and longtrend → if block
  • Line 35: when = exit → if block
  • Line 37: when = shortcond and strategy.opentrades == 0 and shorttrend → if block
  • Line 38: when = exit2 → if block
⋯shorttrend = trend? lp/sl < sl2/sp : true-strategy.entry("Long", strategy.long,comment = "Long", when = longcond and strategy.opentrades == 0 and longtrend)+if longcond and strategy.opentrades == 0 and longtrend+    strategy.entry("Long", strategy.long,comment = "Long")-strategy.close("Long", comment="Long Exit", when = exit)+if exit+    strategy.close("Long", comment="Long Exit")if shortopen-    strategy.entry("Short", strategy.short,comment = "Short", when = shortcond and strategy.opentrades == 0 and shorttrend)+    if shortcond and strategy.opentrades == 0 and shorttrend+        strategy.entry("Short", strategy.short,comment = "Short")-    strategy.close("Short", comment="Short Exit", when = exit2)+    if exit2+        strategy.close("Short", comment="Short Exit")    ⋯

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: 64 before, 58 after on BTCUSDT 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.

⋯// © Dicargo_Beam-//@version=5+//@version=6strategy("Volatility Breakout Strategy", overlay=true, default_qty_type= strategy.percent_of_equity, default_qty_value=100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 22 msYes 1,000 bars in 62 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/// © Dicargo_Beam//@version=5strategy("Volatility Breakout Strategy", overlay=true, default_qty_type= strategy.percent_of_equity, default_qty_value=100)k = input.float(0.6)f_security(_sym, _res, _src) =>     request.security(_sym, _res, _src[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1]o = f_security(syminfo.tickerid,"D",open)h = f_security(syminfo.tickerid,"D",high)l = f_security(syminfo.tickerid,"D",low)c = f_security(syminfo.tickerid,"D",close)var lp = 0.0var sl = 0.0var sp = 0.0var sl2 = 0.0if hour[1]-hour>1    lp := c+(h-l)*k    sl := (l+lp)/2    sp := c-(h-l)*k    sl2 := (h+sp)/2longcond = lp < highexit = hour[1]-hour>1 or  close < slplot(lp,"Long Entry",color=color.yellow)plot(sl,"Long StopLoss",color=color.red) exit2 = hour[1]-hour>1 or close > sl2shortcond = sp > lowshortopen = input.bool(false,"Short Postion Open??")plot(shortopen? sp : na,"Short Entry",color=color.new(color.yellow,50))plot(shortopen? sl2 : na,"Short StopLoss",color=color.new(color.red,50))trend = input.bool(false,"Trend Following?")longtrend = trend? lp/sl > sl2/sp : trueshorttrend = trend? lp/sl < sl2/sp : truestrategy.entry("Long", strategy.long,comment = "Long", when = longcond and strategy.opentrades == 0 and longtrend)strategy.close("Long", comment="Long Exit", when = exit)if shortopen    strategy.entry("Short", strategy.short,comment = "Short", when = shortcond and strategy.opentrades == 0 and shorttrend)    strategy.close("Short", comment="Short Exit", when = exit2)    var bg = 0if hour[1]-hour>1    bg := bg + 1bgcolor(bg/2== math.floor(bg/2) ? color.new(color.blue,95):na)