Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

I11L - Better Buy Low Volatility or High Volatility-

A Pine Script v5 strategy built on ATR (14) and SMA (atr, atrLength*5). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits use a profit target and no stop loss. Each trade commits 1000000 in cash and pays no commission. 4 settings; defaults include Volatility Target Ratio 1, ATR Length 14 and Sell After NBars Length 5.

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 I11L - Better Buy Low Volatility or High Volatility- repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 28 of 28 trades.
How did I11L - Better Buy Low Volatility or High Volatility- do on BTCUSDT 1D with default settings?
+19.25%
From 26 Jan 2024 to 21 Oct 2026, over 83 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does I11L - Better Buy Low Volatility or High Volatility- 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: 83 before, 2 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 I11L - Better Buy Low Volatility or High Volatility- use a stop loss?
No
Its exits set a profit target but no stop.
Does I11L - Better Buy Low Volatility or High Volatility- run in Zeal Terminal?
Yes
It compiles in 17 ms and runs 1,000 bars in 34 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • 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 (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$1,224,050$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
+19.25%
$192,487.00
Buy and hold
+102.5%
same period
Closed trades
83
43 won · 40 lost
Profitable
51.8%
of closed trades
Profit factor
1.11
gross profit ÷ gross loss
Max drawdown
37.43%
−$414,811.00

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

    strategy.exit is used without a stop, loss or trailing stop.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    4 settings have no label

    In the settings dialog mode (line 5), volatilityTargetRatio (line 6), atrLength (line 7), sellAfterNBarsLength (line 11) 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
Mode (no label in the script)Buy low Volatilitystring · options ["Buy low Volatility","Buy high Volatility"]line 16
Volatility Target Ratio (no label in the script)1 equals the average atr for the security, a lower value means that the volatility is lower1float · min 0 · max 100 · step 0.1isBuy
ATR Length (no label in the script)14intatr avg_atr
Sell After NBars Length (no label in the script)5int · min 0 · step 5isClose

What it calculates

  • ATRATR Length (14)atr · line 8
  • SMAatr, atrLength*5avg_atr · line 9

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 datahigh · low · closehigh · low · closeprice dataatrLengthATR Lengthsetting · 14volatilityTargetRatioVolatility Target Ratiosetting · 1sellAfterNBarsLengthSell After NBars Lengthsetting · 5atrATR→ atravg_atrSMA→ avg_atrratioratiovalueholdingBarsCounterholdingBarsCountervalueisBuyisBuyconditionisCloseisCloseconditionentry:BuyOpen Buystrategy.entryexit:Closeexit Closestrategy.exitplot:26plotplotplot:27plotplot

Order rules

OrderFires whenBy defaultLine
Open Buy long(isBuy)On22
Exit Close limit(isClose)On25

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, and the live replay matched history.

28/28trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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 1D+19.2%+102.5%8352%1.1137.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+12.4%+5.5%9152%1.2216.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+83.8%+9.8%8452%1.3941.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.3%+8.4%9048%1.0223.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+65.7%+16.7%8148%1.2330.8%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+15.9%+21.5%8850%1.1812.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+6.1%+148.3%7951%1.0452.8%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+7.0%+17.1%9146%1.1216.4%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 market2748%$270,400.00
Sideways market3954%−$397,671.00
Falling market1753%$319,758.00

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

How bad could the drawdown be?

52.1%

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

0%60%
All 83 trades
SideEntryExitBarsP&L
long29 Apr 2024 63,118.605 May 2024 63,892.006$12,253.40
long6 May 2024 64,012.0012 May 2024 60,826.006−$49,772.10
long13 May 2024 61,484.0019 May 2024 66,915.206$88,335.20
long20 May 2024 66,274.0026 May 2024 69,290.606$45,516.60
long27 May 2024 68,507.702 Jun 2024 67,766.906−$10,813.70
long3 Jun 2024 67,765.609 Jun 2024 69,310.506$22,796.80
long10 Jun 2024 69,648.1016 Jun 2024 66,228.306−$49,102.50
long17 Jun 2024 66,676.9023 Jun 2024 64,262.006−$36,217.20
long24 Jun 2024 63,210.0030 Jun 2024 60,986.706−$35,173.70
long1 Jul 2024 62,772.007 Jul 2024 58,230.106−$72,355.20
long29 Jul 2024 68,249.904 Aug 2024 60,698.006−$110,651.00
long3 Sep 2024 59,132.109 Sep 2024 54,869.906−$72,078.70
long11 Sep 2024 57,636.0017 Sep 2024 58,214.006$10,028.50
long18 Sep 2024 60,314.0024 Sep 2024 63,340.006$50,170.80
long25 Sep 2024 64,262.701 Oct 2024 63,327.606−$14,551.20
long2 Oct 2024 60,804.908 Oct 2024 62,224.006$23,338.10
long9 Oct 2024 62,160.5015 Oct 2024 66,084.006$63,118.90
long16 Oct 2024 67,074.1022 Oct 2024 67,377.506$4,522.76
long23 Oct 2024 67,426.0029 Oct 2024 69,962.206$37,614.60
long30 Oct 2024 72,736.405 Nov 2024 67,850.006−$67,179.60
long6 Nov 2024 69,372.0012 Nov 2024 88,648.006$277,864.00
long5 Jan 2025 98,220.5011 Jan 2025 94,726.106−$35,577.10
long12 Jan 2025 94,600.0018 Jan 2025 104,077.006$100,185.00
long19 Jan 2025 104,556.0025 Jan 2025 104,871.006$3,005.85
long31 Jan 2025 104,723.006 Feb 2025 96,612.406−$77,447.20
long13 Feb 2025 97,870.0019 Feb 2025 95,671.706−$22,461.00
long20 Feb 2025 96,644.4026 Feb 2025 88,680.406−$82,404.90
long24 Mar 2025 86,082.5030 Mar 2025 82,648.506−$39,891.50
long31 Mar 2025 82,390.006 Apr 2025 83,538.006$13,933.60
long17 Apr 2025 84,030.4023 Apr 2025 93,443.006$112,014.00
long24 Apr 2025 93,691.1030 Apr 2025 94,256.806$6,038.46
long1 May 2025 94,172.007 May 2025 96,834.006$28,267.60
long8 May 2025 97,030.5014 May 2025 104,104.006$72,896.90
long15 May 2025 103,508.0021 May 2025 106,850.006$32,289.10
long22 May 2025 109,644.0028 May 2025 108,938.006−$6,437.38
long29 May 2025 107,782.004 Jun 2025 105,377.006−$22,312.50
long5 Jun 2025 104,697.0011 Jun 2025 110,274.006$53,273.10
long12 Jun 2025 108,645.0018 Jun 2025 104,551.006−$37,682.00
long19 Jun 2025 104,887.0025 Jun 2025 106,083.006$11,404.80
long26 Jun 2025 107,341.002 Jul 2025 105,681.006−$15,459.70
long3 Jul 2025 108,850.009 Jul 2025 108,923.006$674.33
long10 Jul 2025 111,234.0016 Jul 2025 117,758.006$58,651.90
long17 Jul 2025 118,630.0023 Jul 2025 119,954.006$11,160.60
long24 Jul 2025 118,756.0030 Jul 2025 117,951.006−$6,780.63
long31 Jul 2025 117,840.006 Aug 2025 114,130.006−$31,487.90
long7 Aug 2025 114,992.0013 Aug 2025 120,134.006$44,714.50
long14 Aug 2025 123,306.0020 Aug 2025 112,873.006−$84,614.30
long21 Aug 2025 114,271.0027 Aug 2025 111,763.006−$21,947.90
long8 Sep 2025 111,137.0014 Sep 2025 115,918.006$43,018.30
long15 Sep 2025 115,268.0021 Sep 2025 115,686.006$3,623.03
long22 Sep 2025 115,232.0028 Sep 2025 109,636.006−$48,566.60
long29 Sep 2025 112,164.005 Oct 2025 122,391.006$91,179.40
long6 Oct 2025 123,482.0012 Oct 2025 110,644.006−$103,966.00
long14 Dec 2025 90,240.0020 Dec 2025 88,136.906−$23,305.10
long21 Dec 2025 88,360.9027 Dec 2025 87,369.606−$11,219.30
long28 Dec 2025 87,877.003 Jan 2026 89,995.106$24,103.50
long4 Jan 2026 90,628.0010 Jan 2026 90,641.306$146.42
long11 Jan 2026 90,504.7017 Jan 2026 95,550.906$55,756.70
long18 Jan 2026 95,147.8024 Jan 2026 89,600.306−$58,304.20
long25 Jan 2026 89,225.3031 Jan 2026 84,260.506−$55,643.80
long16 Mar 2026 72,815.3022 Mar 2026 68,918.106−$53,520.80
long23 Mar 2026 67,859.0029 Mar 2026 66,377.006−$21,838.80
long30 Mar 2026 66,010.905 Apr 2026 67,300.406$19,534.50
long6 Apr 2026 69,034.2012 Apr 2026 73,043.206$58,072.40
long13 Apr 2026 70,741.6019 Apr 2026 75,691.806$69,976.40
long20 Apr 2026 73,801.8026 Apr 2026 77,625.006$51,803.60
long27 Apr 2026 78,657.603 May 2026 78,686.906$372.50
long4 May 2026 78,568.6010 May 2026 80,678.406$26,853.40
long11 May 2026 82,210.1017 May 2026 78,148.106−$49,410.20
long18 May 2026 77,457.7024 May 2026 76,752.006−$9,110.27
long25 May 2026 77,065.0031 May 2026 73,884.406−$41,271.40
long1 Jun 2026 73,674.407 Jun 2026 60,884.606−$173,599.00
long12 Jul 2026 63,819.0018 Jul 2026 63,931.706$1,765.31
long19 Jul 2026 64,834.2025 Jul 2026 64,140.006−$10,707.50
long26 Jul 2026 64,375.001 Aug 2026 62,887.906−$23,101.00
long2 Aug 2026 62,823.708 Aug 2026 64,923.206$33,419.70
long9 Aug 2026 64,962.6015 Aug 2026 63,043.606−$29,540.70
long16 Aug 2026 63,086.0022 Aug 2026 78,338.006$241,765.00
long23 Aug 2026 77,074.9029 Aug 2026 77,845.906$10,002.50
long14 Sep 2026 76,842.0020 Sep 2026 81,250.006$57,364.20
long28 Sep 2026 84,472.004 Oct 2026 84,753.606$3,333.18
long5 Oct 2026 86,530.0011 Oct 2026 82,988.406−$40,929.60
long12 Oct 2026 83,773.1018 Oct 2026 81,491.006−$27,241.20

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
I11L - Better Buy Low Volatility or High Volatility- this page—v5 strategy+19.2%8337.4%
Vortex Cross w-MA Confirmation by DraftVentureatr smav5 strategy+2.4%524.7%
Configurable Multi MA Crossover Voting System by levieuxsma atrv5 strategy+28.5%539.4%
Swing Trend Strategy by Inkedlausma atrv5 strategy+11.2%516.2%
SSL Backtester With ATR SL TP and Money Management by JBTrippinsma atrv4 strategy+8.5%553.9%
Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias by sevencampbellsma atrv5 strategy−1.4%2141.8%

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?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 83 before, 2 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.

⋯// © I11L-//@version=5+//@version=6strategy("I11L - Better Buy Low Volatility or High Volatility?", overlay=false, pyramiding=1, default_qty_value=1000000, initial_capital=1000000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 17 msYes 1,000 bars in 34 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/// © I11L//@version=5strategy("I11L - Better Buy Low Volatility or High Volatility?", overlay=false, pyramiding=1, default_qty_value=1000000, initial_capital=1000000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false)mode = input.string("Buy low Volatility",options = ["Buy low Volatility","Buy high Volatility"])volatilityTargetRatio = input.float(1,minval = 0, maxval = 100,step=0.1, tooltip="1 equals the average atr for the security, a lower value means that the volatility is lower")atrLength = input.int(14)atr = ta.atr(atrLength) / closeavg_atr = ta.sma(atr,atrLength*5)ratio = atr / avg_atrsellAfterNBarsLength = input.int(5, step=5, minval=0)var holdingBarsCounter = 0if(strategy.opentrades > 0)    holdingBarsCounter := holdingBarsCounter + 1isBuy = falseif(mode == "Buy low Volatility")    isBuy := ratio < volatilityTargetRatioelse    isBuy := ratio > volatilityTargetRatioisClose = holdingBarsCounter > sellAfterNBarsLengthif(isBuy)    strategy.entry("Buy",strategy.long)if(isClose)    holdingBarsCounter := 0    strategy.exit("Close",limit=close)plot(ratio, color=isBuy[1] ? color.green : isClose[1] ? color.red : color.white)plot(1, color=color.white)