Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Super Auto Breakout Day Trade Volatile stocks

A Pine Script v4 strategy built on Stdev (inter, 30), SMA (volume, 130) and EMA (vfi, 5). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 6 settings; defaults include VFI length 130, Coef 0.2 and Max. vol. cutoff 2.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 Super Auto Breakout Day Trade Volatile stocks repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 15 of 15 trades.
How did Super Auto Breakout Day Trade Volatile stocks do on BTCUSDT 1D with default settings?
−6.07%
From 26 Jan 2024 to 21 Oct 2026, over 51 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Super Auto Breakout Day Trade Volatile stocks be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Super Auto Breakout Day Trade Volatile stocks use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Super Auto Breakout Day Trade Volatile stocks run in Zeal Terminal?
Yes
It compiles in 17 ms and runs 1,000 bars in 76 ms, in the browser.

BTCUSDT · 1D · default settings

  • SMA
  • UB
  • LB
  • 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)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$93,928$202,527Equity from $100,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. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Net profit
−6.07%
−$6,071.86
Buy and hold
+102.5%
same period
Closed trades
51
16 won · 35 lost
Profitable
31.4%
of closed trades
Profit factor
0.90
gross profit ÷ gross loss
Max drawdown
29.06%
−$37,423.70

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

  • Likely bug

    sma(source, 20) ignores the settings line 45

    Line 45 hard-codes 20 where line 32 uses “VFI length”. Changing those settings moves one band but not this one.

    sma(source, 20)sma(source, length)
  • Likely bug

    sma(source, 20) ignores the settings line 52

    Line 52 hard-codes 20 where line 32 uses “VFI length”. Changing those settings moves one band but not this one.

    sma(source, 20)sma(source, length)
  • Likely bug

    ema(close, 20) ignores the settings line 40

    Line 40 hard-codes 20 where line 38 uses “Signal Length”. Changing those settings moves one band but not this one.

    ema(close,20)ema(close, signalLength)
  • Likely bug

    ema(close, 50) ignores the settings line 41

    Line 41 hard-codes 50 where line 38 uses “Signal Length”. Changing those settings moves one band but not this one.

    ema(close,50)ema(close, signalLength)
  • Likely bug

    ema(diff, 20) ignores the settings line 43

    Line 43 hard-codes 20 where line 38 uses “Signal Length”. Changing those settings moves one band but not this one.

    ema(diff,20)ema(diff, signalLength)
  • 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

    4 settings have no label

    In the settings dialog coef (line 7), signalLength (line 9), pre (line 11), trade_session (line 12) 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.

  • Note

    Uses iff(), which v5 removed line 34

    iff() on line 34, 36, 36. v5 writes it as the ternary c ? a : b.

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames min → math.min, max → math.max, sma → ta.sma, log → math.log, stdev → ta.stdev, sum → math.sum, ema → ta.ema, barssince → ta.barssince.

v4 → v5

Differs

Trades differ: 51 before, 51 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 11: input(type = input.session) → input.session()
  • Line 12: input(type = input.session) → input.session()
  • Line 23: min → math.min
  • Line 25: max → math.max
  • Line 27: sma → ta.sma
16 more edits
  • Line 29: log → math.log
  • Line 29: log → math.log
  • Line 30: stdev → ta.stdev
  • Line 32: sma → ta.sma
  • Line 34: iff(c, a, b) → (c ? a : b)
  • Line 36: iff(c, a, b) → (c ? a : b)
  • Line 36: iff(c, a, b) → (c ? a : b)
  • Line 37: sum → math.sum
  • Line 38: ema → ta.ema
  • Line 40: ema → ta.ema
  • Line 41: ema → ta.ema
  • Line 43: ema → ta.ema
  • Line 45: sma → ta.sma
  • Line 46: stdev → ta.stdev
  • Line 52: sma → ta.sma
  • Line 58: barssince → ta.barssince
⋯// © beststockalert-//@version=4+//@version=5strategy(title="Auto Breakout", shorttitle = "Autotrade BB-BO",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)⋯// session -pre = input( type=input.session, defval="0400-0930")+pre = input.session( defval="0400-0930")-trade_session = input( type=input.session, defval="0940-1700")+trade_session = input.session( defval="0940-1700")use_trade_session = true⋯float preLow = na-preLow := preSession ? preNew ? low : min(preLow[1], low) : preLow[1]+preLow := preSession ? preNew ? low : math.min(preLow[1], low) : preLow[1]float preHigh = na-preHigh := preSession ? preNew ? high : max(preHigh[1], high) : preHigh[1]+preHigh := preSession ? preNew ? high : math.max(preHigh[1], high) : preHigh[1]//   vfi 9lazybear -ma(x,y) => 0 ? sma(x,y) : x+ma(x,y) => 0 ? ta.sma(x,y) : xtypical=hlc3-inter = log( typical ) - log( typical[1] )+inter = math.log( typical ) - math.log( typical[1] )-vinter = stdev(inter, 30 )+vinter = ta.stdev(inter, 30 )cutoff = coef * vinter * close-vave = sma( volume, length )[1]+vave = ta.sma( volume, length )[1]vmax = vave * vcoef-vc = iff(volume < vmax, volume, vmax) //min( volume, vmax )+vc = (volume < vmax ? volume : vmax) //min( volume, vmax )mf = typical - typical[1]-vcp = iff( mf > cutoff, vc, iff ( mf < -cutoff, -vc, 0 ) )+vcp = ( mf > cutoff ? vc : ( mf < -cutoff ? -vc : 0 ) )-vfi = ma(sum( vcp , length )/vave, 3)+vfi = ma(math.sum( vcp , length )/vave, 3)-vfima=ema( vfi, signalLength )+vfima=ta.ema( vfi, signalLength )//ema diff-ema20 = ema(close,20)+ema20 = ta.ema(close,20)-ema50 = ema(close,50)+ema50 = ta.ema(close,50)diff = (ema20-ema50)*100/ema20-ediff = ema(diff,20)+ediff = ta.ema(diff,20)//-basis = sma(source, 20)+basis = ta.sma(source, 20)-dev = 1.5 * stdev(source, 20)+dev = 1.5 * ta.stdev(source, 20)upper = basis *1.014⋯    lower = basis - 0.5-sma20 = sma(source, 20)+sma20 = ta.sma(source, 20)/// bar color⋯///-if (isinsession  and ( close[3]>upper and close>sma20 and vfi[3]>0 and vfi>0 and vfi>vfi[5] and barssince(sell)>5 ) or close>open*1.04)+if (isinsession  and ( close[3]>upper and close>sma20 and vfi[3]>0 and vfi>0 and vfi>vfi[5] and ta.barssince(sell)>5 ) or close>open*1.04)    strategy.entry("Long", strategy.long)⋯

Clean v5

Verified

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

  • Line 6: input() → input.int()
  • Line 7: input() → input.float()
  • Line 8: input() → input.float()
  • Line 9: input() → input.int()
⋯source = close-length = input(130, title="VFI length")+length = input.int(130, title="VFI length")-coef = input(0.2)+coef = input.float(0.2)-vcoef = input(2.5, title="Max. vol. cutoff")+vcoef = input.float(2.5, title="Max. vol. cutoff")-signalLength=input(5)+signalLength=input.int(5)// session ⋯

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L27:C11: cannot use 'int' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © beststockalert-//@version=5+//@version=6strategy(title="Auto Breakout", shorttitle = "Autotrade BB-BO",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
VFI length130intvave vfi
Coef (no label in the script)0.2floatcutoff
Max. vol. cutoff2.5floatvmax
Signal Length (no label in the script)5intvfima
Pre (no label in the script)0400-0930sessionpreNew preSession
Trade session (no label in the script)0940-1700sessionisinsession

What it calculates

  • Stdev (stdev, ta.stdev in v5)inter, 30vinter · line 30
  • SMA (sma, ta.sma in v5)volume, VFI length (130)vave · line 32
  • EMA (ema, ta.ema in v5)vfi, Signal Length (5)vfima · line 38
  • EMA (ema, ta.ema in v5)close, 20ema20 · line 40
  • EMA (ema, ta.ema in v5)close, 50ema50 · line 41
  • EMA (ema, ta.ema in v5)diff, 20ediff · line 43
  • SMA (sma, ta.sma in v5)source, 20basis · line 45
  • Stdev (stdev, ta.stdev in v5)source, 20dev · line 46
  • SMA (sma, ta.sma in v5)source, 20sma20 · line 52

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.

volumevolumeprice datalengthVFI lengthsetting · 130signalLengthSignal Lengthsetting · 5closecloseprice datatrade_sessionTrade sessionsetting · 0940-1700prePresetting · 0400-0930lowlowprice datahighhighprice datahlc3hlc3price datacoefCoefsetting · 0.2vcoefMax. vol. cutoffsetting · 2.5openopenprice datavinterStdev→ vintervaveSMA→ vavevfimaEMA→ vfimaema20EMA→ ema20ema50EMA→ ema50ediffEMA→ ediffbasisSMA→ basisdevStdev→ devsma20SMA→ sma20sourcesourcevalueisinsessionisinsessionvaluettvaluepreNew, preSessionpreNew · preSession2 valuespreLowpreLowvaluepreHighpreHighvaluetypicaltypicalvalueinter, mfinter · mf2 valuescutoffcutoffvaluevmaxvmaxvaluevfivfivaluediffdiffvalueupper, lowerupper · lower2 valuessellsellconditionvcvcconditionvcpvcpconditionbarColourColourbarColourentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closebarcolor:56barcolorbarcolorplot:62SMAplotplot:63UBplotplot:64LBplot

Order rules

OrderFires whenBy defaultLine
Open Long long(isinsession and ( close[3]>upper and close>sma20 and vfi[3]>0 and vfi>0 and vfi>vfi[5] and barssince(sell)>5 ) or close>open*1.04)On59
Close Long(sell )On61

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.

15/15trades 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−6.1%+102.5%5131%0.9029.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+7.0%+5.5%1323%2.643.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−40.3%+9.8%8330%0.6559.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.5%+8.4%1613%1.175.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+32.0%+16.7%11737%1.1041.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.3%+21.5%1421%0.986.8%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−18.1%+148.3%5122%0.7431.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+4.3%+17.1%1127%3.162.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 barsTradesWonP&L
Rising market2433%$85.26
Sideways market1735%$1,793.51
Falling market1020%−$7,950.63

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

How bad could the drawdown be?

32.7%

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

0%38%
All 51 trades
SideEntryExitBarsP&L
long27 Jan 2024 41,823.5010 Feb 2024 47,132.8014$12,694.50
long15 Feb 2024 51,795.2018 Feb 2024 51,642.603−$331.87
long27 Feb 2024 54,476.5029 Feb 2024 62,432.102$16,409.20
long5 Mar 2024 68,245.706 Mar 2024 63,724.001−$8,531.93
long12 Mar 2024 72,078.1013 Mar 2024 71,452.001−$1,044.45
long18 Mar 2024 68,393.5019 Mar 2024 67,610.001−$1,365.42
long21 Mar 2024 67,840.5022 Mar 2024 65,501.301−$4,062.93
long25 Mar 2024 67,210.003 Apr 2024 65,464.009−$2,955.49
long4 May 2024 62,882.007 May 2024 63,165.203$499.01
long16 May 2024 66,206.5017 May 2024 65,235.201−$1,633.01
long21 May 2024 71,446.6022 May 2024 70,148.301−$1,992.99
long16 Jul 2024 64,724.1018 Jul 2024 64,088.002−$1,058.26
long20 Jul 2024 66,660.0024 Jul 2024 65,936.004−$1,158.09
long9 Aug 2024 61,686.0010 Aug 2024 60,838.001−$1,449.89
long24 Aug 2024 64,037.2027 Aug 2024 62,834.003−$1,954.47
long14 Sep 2024 60,498.0015 Sep 2024 59,993.001−$851.92
long15 Oct 2024 66,084.0016 Oct 2024 67,074.101$1,516.46
long7 Nov 2024 75,572.008 Nov 2024 75,857.901$388.64
long11 Nov 2024 80,370.0012 Nov 2024 88,648.001$10,620.90
long16 Nov 2024 91,032.1017 Nov 2024 90,588.001−$554.87
long22 Nov 2024 98,317.1024 Nov 2024 97,672.402−$742.20
long28 Nov 2024 95,863.1029 Nov 2024 95,644.001−$257.01
long12 Dec 2024 101,125.0013 Dec 2024 100,004.001−$1,243.27
long16 Jan 2025 100,497.0017 Jan 2025 99,987.301−$563.05
long18 Jan 2025 104,077.0020 Jan 2025 101,332.002−$2,912.12
long3 Mar 2025 94,270.004 Mar 2025 86,221.201−$9,175.46
long12 Mar 2025 82,933.0013 Mar 2025 83,680.101$885.48
long20 Mar 2025 86,845.9021 Mar 2025 84,223.401−$2,994.87
long10 Apr 2025 82,615.2011 Apr 2025 79,607.301−$3,501.82
long12 Apr 2025 83,423.8013 Apr 2025 85,276.901$2,058.66
long23 Apr 2025 93,443.0024 Apr 2025 93,691.101$251.52
long9 May 2025 103,262.0010 May 2025 102,972.001−$266.42
long10 Jun 2025 110,263.0011 Jun 2025 110,274.001$9.77
long24 Jun 2025 105,334.0025 Jun 2025 106,083.001$673.67
long11 Jul 2025 116,010.0030 Jul 2025 117,951.0019$1,596.05
long3 Dec 2025 91,277.904 Dec 2025 93,429.901$2,287.03
long14 Jan 2026 95,414.0015 Jan 2026 96,951.801$1,600.24
long7 Feb 2026 70,580.308 Feb 2026 69,289.401−$1,845.23
long26 Feb 2026 67,988.0027 Feb 2026 67,485.201−$732.54
long3 Mar 2026 68,830.104 Mar 2026 68,338.001−$702.81
long5 Mar 2026 72,666.806 Mar 2026 70,891.001−$2,385.25
long24 Mar 2026 70,906.4025 Mar 2026 70,556.701−$469.64
long8 Apr 2026 71,924.209 Apr 2026 71,069.901−$1,125.45
long14 Apr 2026 74,418.0015 Apr 2026 74,131.601−$360.39
long8 Jun 2026 63,332.009 Jun 2026 63,086.001−$362.30
long15 Jul 2026 65,044.0016 Jul 2026 64,756.301−$410.95
long20 Aug 2026 69,334.8021 Aug 2026 73,027.001$4,925.56
long22 Aug 2026 78,338.0023 Aug 2026 77,074.901−$1,570.76
long4 Sep 2026 81,270.405 Sep 2026 79,660.801−$1,898.35
long19 Sep 2026 80,883.9020 Sep 2026 81,250.001$425.28
long22 Sep 2026 86,620.0023 Sep 2026 86,208.601−$448.28

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
Super Auto Breakout Day Trade Volatile stocks this page—v4 strategy−6.1%5129.1%
Volume Weighted Bollinger Bands Strategy by Ankit_1618ema sma stdevv4 strategy+10.0%1527.5%
BB21_MA200_Strategy by mohaneeema sma stdevv4 strategyNo trades on this market
Super Breakout day trading by beststockalertstdev sma emav4 strategyNo trades on this market
VFI strategy [based on VFI indicator published by UTS] by mohaneesma stdev emav4 strategy+181.4%8154.2%
McClellan Oscillator Strategy by sparrow_hawk_737ema sma stdevv3 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 17 msWith a workaround 1,000 bars in 76 msNot measured
PineTSNo v5 and v6 only—Not measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“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. PineTS runs Pine Script v5 and v6 only.

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/// © beststockalert//@version=4strategy(title="Auto Breakout", shorttitle = "Autotrade BB-BO",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)source = closelength = input(130, title="VFI length")coef = input(0.2)vcoef = input(2.5, title="Max. vol. cutoff")signalLength=input(5)// session pre = input( type=input.session, defval="0400-0930")trade_session = input( type=input.session, defval="0940-1700")use_trade_session = trueisinsession = use_trade_session ? not na(time('1', trade_session)) : trueis_newbar(sess) =>    t = time("D", sess)    not na(t) and (na(t[1]) or t > t[1])is_session(sess) =>    not na(time(timeframe.period, sess))preNew = is_newbar(pre)preSession = is_session(pre)float preLow = napreLow := preSession ? preNew ? low : min(preLow[1], low) : preLow[1]float preHigh = napreHigh := preSession ? preNew ? high : max(preHigh[1], high) : preHigh[1]//   vfi 9lazybear ma(x,y) => 0 ? sma(x,y) : xtypical=hlc3inter = log( typical ) - log( typical[1] )vinter = stdev(inter, 30 )cutoff = coef * vinter * closevave = sma( volume, length )[1]vmax = vave * vcoefvc = iff(volume < vmax, volume, vmax) //min( volume, vmax )mf = typical - typical[1]vcp = iff( mf > cutoff, vc, iff ( mf < -cutoff, -vc, 0 ) )vfi = ma(sum( vcp , length )/vave, 3)vfima=ema( vfi, signalLength )//ema diffema20 = ema(close,20)ema50 = ema(close,50)diff = (ema20-ema50)*100/ema20ediff = ema(diff,20)//basis = sma(source, 20)dev = 1.5 * stdev(source, 20)upper = basis *1.014lower = basis *.985if close >19.9    upper = basis + 0.65    lower = basis - 0.5sma20 = sma(source, 20)/// bar colorbarColour = (open>=upper) ? color.green : (close>=upper) ? color.green : (close>basis) ? color.green : (open<lower) ? color.purple : color.bluesell = close < lower or close> strategy.position_avg_price*1.1 or close <strategy.position_avg_price-0.4 or vfi<-3 or vfima<-3 or close<open*.94barcolor(color=barColour)///if (isinsession  and ( close[3]>upper and close>sma20 and vfi[3]>0 and vfi>0 and vfi>vfi[5] and barssince(sell)>5 ) or close>open*1.04)    strategy.entry("Long", strategy.long)if (sell  )    strategy.close("Long")plot(basis, color=color.red,title= "SMA")p1 = plot(upper, color=color.blue,title= "UB")p2 = plot(lower, color=color.blue,title= "LB")