Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volatility System

A Pine Script v5 strategy built on ATR (14) and Change (close, 1). 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 commits 100% of equity and pays no commission. 2 settings; defaults include Average length 14 and Multiplier 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 Volatility System repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Volatility System do on BTCUSDT 1D with default settings?
+150.22%
From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Volatility System run in Pine Script v6?
Yes
Same 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
Does Volatility System use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Volatility System run in Zeal Terminal?
Yes
It compiles in 11 ms and runs 1,000 bars in 30 ms, in the browser.

BTCUSDT · 1D · default settings

  • ATR
  • Absolute close change
  • 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 (2)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctATR$61,131$40,505Equity from $20,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
+150.22%
$30,042.90
Buy and hold
+102.5%
same period
Closed trades
2
2 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
21.51%
−$4,302.95

One run with the author's default settings, $20,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

    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
Average length14intatr
Multiplier2.0float · step 0.1atr

What it calculates

  • ATRAverage length (14)atr · line 10
  • Changeclose, 1closingChange · line 11

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.

high · low · closehigh · low · closeprice dataaverageLengthAverage lengthsetting · 14multiplierMultipliersetting · 2.0closecloseprice dataatrATR→ atrclosingChangeChange→ closingChangeresresconditionentry:strategy.direction.longOpen strategy.direction…strategy.entryentry:strategy.direction.shortOpen strategy.direction…strategy.entryplot:22ATRplotplot:23Absolute close changeplot

Order rules

OrderFires whenBy defaultLine
Open strategy.direction.long long(longCondition)On18
Open strategy.direction.short short(shortCondition)On20

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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.

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 1D+150.2%+102.5%2100%—21.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−12.3%+5.5%1040%0.6427.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−23.2%+9.8%650%0.6865.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+23.9%+8.4%1050%1.6724.2%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+13.9%+16.7%450%1.3950.8%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+72.6%+21.5%475%13.4812.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+67.1%+148.3%475%2.0861.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−20.0%+17.1%1030%0.3929.6%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 barsTradesWonP&L
Rising market1100%$16,127.10
Sideways market1100%$13,915.80
Falling market0—$0.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

0.0%

The 95th percentile of the worst drawdown when the same 2 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.0% to 0.0%; the tick is what actually happened, 0.0%. Order luck alone moves it this much.

0%1%
All 2 trades
SideEntryExitBarsP&L
long28 Feb 2024 62,432.1010 Oct 2025 112,775.00590$16,127.10
short10 Oct 2025 112,775.0019 Aug 2026 69,334.80313$13,915.80

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
Volatility System this page—v5 strategy+150.2%221.5%
SOJA PIVOT by ParaBellum68atrv4 strategy+3.3%918.2%
ATR Stop Buy Strategy by phobo3satrv4 strategyNo trades on this market
VBand Strategy by Saravanan_Ragavanatrv4 strategyNo trades on this market
Volatility Breakout Strategy [Angel Algo] by AngelAlgoatrv5 strategy+3.1%183.6%
ATR Mean Reversion Strategy V1 by Bcullen175atrv5 strategy−20.0%7959.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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

Does it run in Pine Script v6?

Yes

Same 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

⋯// © EduardoMattje-//@version=5+//@version=6strategy("Volatility System", overlay=false, margin_long=0, margin_short=0, default_qty_type=strategy.percent_of_equity, ⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 11 msYes 1,000 bars in 30 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/// © EduardoMattje//@version=5strategy("Volatility System", overlay=false, margin_long=0, margin_short=0, default_qty_type=strategy.percent_of_equity,  default_qty_value=100, process_orders_on_close=true, initial_capital=20000)// Inputsvar averageLength = input.int(14, "Average length", 2)var multiplier = input.float(2.0, "Multiplier", 0.0, step=0.1)// Calculationsatr = ta.atr(averageLength) * multiplierclosingChange = ta.change(close, 1)atrPenetration(int signal) =>    res = closingChange * signal > atr[1]longCondition = atrPenetration(1)shortCondition = atrPenetration(-1)// Order callsif (longCondition)    strategy.entry(strategy.direction.long, strategy.long)if (shortCondition)    strategy.entry(strategy.direction.short, strategy.short)// Visualsplot(atr, "ATR", color.white, 2)plot(math.abs(closingChange), "Absolute close change", color.red)