Pine Script v5 · Strategy
Volatility Breakout Strategy [Angel Algo]
A Pine Script v5 strategy built on ATR (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. 1 setting; defaults include Length 20.
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 [Angel Algo] repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: the script acts only when barstate.isconfirmed is true, which Zeal Terminal's engine never reports during a live replay (it does not run a bar's closing update in live mode), so the replay cannot test this script.
- How did Volatility Breakout Strategy [Angel Algo] do on BTCUSDT 1D with default settings?
- +3.12%
- From 26 Jan 2024 to 21 Oct 2026, over 18 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Volatility Breakout Strategy [Angel Algo] 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: 18 before, 23 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
- Does Volatility Breakout Strategy [Angel Algo] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Volatility Breakout Strategy [Angel Algo] run in Zeal Terminal?
- Yes
- It compiles in 17 ms and runs 1,000 bars in 36 ms, in the browser.
BTCUSDT · 1D · default settings
- ATR
- Shape
- Shape
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +3.12%
- $31,158.10
- Buy and hold
- +102.5%
- same period
- Closed trades
- 18
- 8 won · 10 lost
- Profitable
- 44.4%
- of closed trades
- Profit factor
- 1.43
- gross profit ÷ gross loss
- Max drawdown
- 3.63%
- −$36,560.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.
-
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 |
|---|---|---|---|
| Length | 20 | int | atr |
What it calculates
- ATRLength (20)
atr · line 7
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 Volatility Breakout Long long | long_condition | On | 31 |
| Open Volatility Breakout Short short | short_condition | On | 33 |
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.
- 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 | +3.1% | +102.5% | 18 | 44% | 1.43 | 3.6% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +1.2% | +5.5% | 21 | 43% | 1.47 | 1.2% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.2% | +9.8% | 29 | 45% | 0.73 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.0% | +8.4% | 23 | 43% | 1.41 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 21 | 33% | 0.58 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 21 | 43% | 1.63 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 21 | 48% | 0.72 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 18 | 33% | 0.80 | 0.0% | 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 | 4 | 50% | $9,861.64 |
| Sideways market | 12 | 42% | $17,216.60 |
| Falling market | 2 | 50% | $4,079.89 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
5.6%
The 95th percentile of the worst drawdown when the same 18 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.2% to 5.6%; the tick is what actually happened, 3.5%. Order luck alone moves it this much.
All 18 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 27 Feb 2024 54,476.50 | 20 Mar 2024 61,937.40 | 22 | $7,460.93 |
| short | 20 Mar 2024 61,937.40 | 4 May 2024 62,882.00 | 45 | −$944.60 |
| long | 4 May 2024 62,882.00 | 25 Jun 2024 60,293.30 | 52 | −$2,588.71 |
| short | 25 Jun 2024 60,293.30 | 16 Jul 2024 64,724.10 | 21 | −$4,430.76 |
| long | 16 Jul 2024 64,724.10 | 6 Aug 2024 54,018.80 | 21 | −$10,705.20 |
| short | 6 Aug 2024 54,018.80 | 9 Aug 2024 61,686.00 | 3 | −$7,667.18 |
| long | 9 Aug 2024 61,686.00 | 28 Aug 2024 59,415.00 | 19 | −$2,271.00 |
| short | 28 Aug 2024 59,415.00 | 15 Oct 2024 66,084.00 | 48 | −$6,669.00 |
| long | 15 Oct 2024 66,084.00 | 19 Dec 2024 100,204.00 | 65 | $34,120.00 |
| short | 19 Dec 2024 100,204.00 | 3 Mar 2025 94,270.00 | 74 | $5,934.02 |
| long | 3 Mar 2025 94,270.00 | 7 Apr 2025 78,430.00 | 35 | −$15,840.00 |
| short | 7 Apr 2025 78,430.00 | 23 Apr 2025 93,443.00 | 16 | −$15,013.00 |
| long | 23 Apr 2025 93,443.00 | 23 Sep 2025 112,651.00 | 153 | $19,208.00 |
| short | 23 Sep 2025 112,651.00 | 29 Sep 2025 112,164.00 | 6 | $487.03 |
| long | 29 Sep 2025 112,164.00 | 11 Oct 2025 112,774.00 | 12 | $610.53 |
| short | 11 Oct 2025 112,774.00 | 14 Jan 2026 95,414.00 | 95 | $17,360.50 |
| long | 14 Jan 2026 95,414.00 | 21 Jan 2026 88,427.70 | 7 | −$6,986.33 |
| short | 21 Jan 2026 88,427.70 | 20 Aug 2026 69,334.80 | 211 | $19,092.90 |
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 Breakout Strategy [Angel Algo] this page | — | v5 strategy | +3.1% | 18 | 3.6% |
| SOJA PIVOT by ParaBellum68 | atr | v4 strategy | +3.3% | 9 | 18.2% |
| Volatility System by EduardoMattje | atr | v5 strategy | +150.2% | 2 | 21.5% |
| ATR Stop Buy Strategy by phobo3s | atr | v4 strategy | No trades on this market | ||
| VBand Strategy by Saravanan_Ragavan | atr | v4 strategy | No trades on this market | ||
| ATR Mean Reversion Strategy V1 by Bcullen175 | atr | v5 strategy | −20.0% | 79 | 59.6% |
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.
- 1 setting uses the untyped input() (line 5). 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.
Same 18 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 5: input() → input.int()
⋯// Inputs-length = input(title="Length", defval=20)+length = input.int(title="Length", defval=20)// Calculate the average true range (ATR)⋯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: 18 before, 23 after on BTCUSDT 1D, 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.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/-//@version=5+//@version=6strategy("Volatility Breakout Strategy [Angel Algo]", overlay = true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 17 ms | Yes 1,000 bars in 36 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///@version=5strategy("Volatility Breakout Strategy [Angel Algo]", overlay = true)// Inputslength = input(title="Length", defval=20)// Calculate the average true range (ATR)atr = ta.atr(length)// Plot the ATR on the chartplot(atr, color=color.blue, linewidth=2, title="ATR")// Calculate the upper and lower breakoutsupper_breakout = high + atrlower_breakout = low - atr// Plot the upper and lower breakouts on the chartul = plot(upper_breakout[1], color = color.new(color.green, 100), linewidth=2, title="Upper Breakout Level")ll = plot(lower_breakout[1], color = color.new(color.red, 100), linewidth=2, title="Lower Breakout Level")// Create the signalslong_entry = ta.crossover(close, upper_breakout[1]) and barstate.isconfirmedshort_entry = ta.crossunder(close, lower_breakout[1]) and barstate.isconfirmedactive_signal_color =ta.barssince(long_entry) < ta.barssince(short_entry) ? color.new(color.green,85) : color.new(color.red,85)// Plot the signals on the chartplotshape(long_entry and ta.barssince(long_entry[1]) > ta.barssince(short_entry[1]), location=location.belowbar, style=shape.triangleup, color=color.green, size=size.normal, text = "Bullish breakout", textcolor = color.green)plotshape(short_entry and ta.barssince(long_entry[1]) < ta.barssince(short_entry[1]), location=location.abovebar, style=shape.triangledown, color=color.red, size=size.normal,text = "Bearish breakout", textcolor = color.red)// Fill the space between the upper and lower levels with the color that indicates the latest signal directionfill(ul,ll, color=active_signal_color) long_condition = long_entry and strategy.position_size <= 0 and barstate.isconfirmedshort_condition = short_entry and strategy.position_size >= 0 and barstate.isconfirmedif long_condition strategy.entry("Volatility Breakout Long", strategy.long)if short_condition strategy.entry("Volatility Breakout Short", strategy.short)