Pine Script v4 · Strategy
Super Breakout day trading
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 Breakout day trading repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Super Breakout day trading 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, so there is no result to report. Its code limits trading to a session window, which can leave these candles out. It closed no trades on the other markets either. A backtest, not investment advice.
- Can Super Breakout day trading be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does Super Breakout day trading use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Super Breakout day trading run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 49 ms, in the browser.
BTCUSDT · 1D · default settings
- Stdev
- SMA
- EMA
- EMA
- EMA
- EMA
- SMA
- Stdev
- Stdev
- EMA
- SMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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
- 0.00%
- $0.00
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, 5) ignores the settings line 51
Line 51 hard-codes 5 where line 32 uses “VFI length”. Changing those settings moves one band but not this one.
sma(source,5)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) -
Likely bug
ema(source, 20) ignores the settings line 50
Line 50 hard-codes 20 where line 38 uses “Signal Length”. Changing those settings moves one band but not this one.
ema(source, 20)ema(source, 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, crossunder → ta.crossunder, sar → ta.sar, barssince → ta.barssince, crossover → ta.crossover.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- 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
21 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 47: stdev → ta.stdev
- Line 50: ema → ta.ema
- Line 51: sma → ta.sma
- Line 55: crossunder → ta.crossunder
- Line 55: sar → ta.sar
- Line 57: barssince → ta.barssince
- Line 57: crossover → ta.crossover
⋯// © beststockalert-//@version=4+//@version=5strategy(title="Super Breakout VFI", shorttitle = "Super BB-BO",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)⋯// session -pre = input( type=input.session, defval="0400-0935")+pre = input.session( defval="0400-0935")-trade_session = input( type=input.session, defval="0945-1700")+trade_session = input.session( defval="0945-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)-dev2 = 2 * stdev(source, 20)+dev2 = 2 * ta.stdev(source, 20)upper = basis + devlower = basis - dev-ema9 = ema(source, 20)+ema9 = ta.ema(source, 20)-ma5 = sma(source,5)+ma5 = ta.sma(source,5)/// bar color⋯barcolor(color=barColour)-sell = crossunder(source, lower) or vfi>19 or vfima>19 or (low< sar(0.025,0.02,0.2) and close<ma5)+sell = ta.crossunder(source, lower) or vfi>19 or vfima>19 or (low< ta.sar(0.025,0.02,0.2) and close<ma5)///-if (isinsession and source[2]>preHigh and (barssince(sell)>5 or (close>basis and close<dev2)) and ((crossover(source, upper) or (close[3]>upper and close>ema9 and (vfi >0 or vfima>0 ) and (vfi<14 or vfima<14)) ) and close <close[4]*1.16 and close <close[3]*1.14 ))+if (isinsession and source[2]>preHigh and (ta.barssince(sell)>5 or (close>basis and close<dev2)) and ((ta.crossover(source, upper) or (close[3]>upper and close>ema9 and (vfi >0 or vfima>0 ) and (vfi<14 or vfima<14)) ) and close <close[4]*1.16 and close <close[3]*1.14 )) strategy.entry("Long", strategy.long)⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- 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="Super Breakout VFI", shorttitle = "Super 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| VFI length | 130 | int | vave vfi |
| Coef (no label in the script) | 0.2 | float | cutoff |
| Max. vol. cutoff | 2.5 | float | vmax |
| Signal Length (no label in the script) | 5 | int | vfima |
| Pre (no label in the script) | 0400-0935 | session | preNew preSession |
| Trade session (no label in the script) | 0945-1700 | session | isinsession |
What it calculates
- Stdev (
stdev,ta.stdevin v5)inter, 30vinter · line 30 - SMA (
sma,ta.smain v5)volume, VFI length (130)vave · line 32 - EMA (
ema,ta.emain v5)vfi, Signal Length (5)vfima · line 38 - EMA (
ema,ta.emain v5)close, 20ema20 · line 40 - EMA (
ema,ta.emain v5)close, 50ema50 · line 41 - EMA (
ema,ta.emain v5)diff, 20ediff · line 43 - SMA (
sma,ta.smain v5)source, 20basis · line 45 - Stdev (
stdev,ta.stdevin v5)source, 20dev · line 46 - Stdev (
stdev,ta.stdevin v5)source, 20dev2 · line 47 - EMA (
ema,ta.emain v5)source, 20ema9 · line 50 - SMA (
sma,ta.smain v5)source, 5ma5 · line 51
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 Long long | (isinsession and source[2]>preHigh and (barssince(sell)>5 or (close>basis and close<dev2)) and ((crossover(source, upper) or (close[3]>upper and close>ema9 and (vfi >0 or vfima>0 ) and (vfi<14 or vfima<14)) ) and close <close[4]*1.16 and close <close[3]*1.14 )) | On | 58 |
| Close Long | ( sell ) | On | 60 |
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 | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
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 |
|---|---|---|---|---|---|
| Super Breakout day trading this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| Volume Weighted Bollinger Bands Strategy by Ankit_1618 | ema sma stdev | v4 strategy | +10.0% | 15 | 27.5% |
| BB21_MA200_Strategy by mohanee | ema sma stdev | v4 strategy | No trades on this market | ||
| Super Auto Breakout Day Trade Volatile stocks by beststockalert | stdev sma ema | v4 strategy | −6.1% | 51 | 29.1% |
| VFI strategy [based on VFI indicator published by UTS] by mohanee | sma stdev ema | v4 strategy | +181.4% | 8 | 154.2% |
| McClellan Oscillator Strategy by sparrow_hawk_737 | ema sma stdev | v3 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | With a workaround 1,000 bars in 49 ms | Not measured |
| PineTS | No 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="Super Breakout VFI", shorttitle = "Super 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-0935")trade_session = input( type=input.session, defval="0945-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)dev2 = 2 * stdev(source, 20)upper = basis + devlower = basis - devema9 = ema(source, 20)ma5 = sma(source,5)/// bar colorbarColour = (open>=upper) ? color.green : (close>=upper) ? color.green : (close>basis) ? color.green : (open<lower) ? color.purple : color.bluebarcolor(color=barColour)sell = crossunder(source, lower) or vfi>19 or vfima>19 or (low< sar(0.025,0.02,0.2) and close<ma5)///if (isinsession and source[2]>preHigh and (barssince(sell)>5 or (close>basis and close<dev2)) and ((crossover(source, upper) or (close[3]>upper and close>ema9 and (vfi >0 or vfima>0 ) and (vfi<14 or vfima<14)) ) and close <close[4]*1.16 and close <close[3]*1.14 )) strategy.entry("Long", strategy.long)if ( sell ) strategy.close("Long")