Pine Script v4 · Strategy
[VJ] Hulk Smash Intra
A Pine Script v4 strategy built on Supertrend (2, 10) and SMA (DX, 14). It has 5 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays no commission. 10 settings; defaults include Market session 0915-1455, Long Take Profit (%) 1 and Short Take Profit (%) 1.
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 [VJ] Hulk Smash Intra repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did [VJ] Hulk Smash Intra 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. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Can [VJ] Hulk Smash Intra 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 [VJ] Hulk Smash Intra use a stop loss?
- Yes
- strategy.exit sets a stop on line 85, 92.
- Does [VJ] Hulk Smash Intra run in Zeal Terminal?
- Yes
- It compiles in 32 ms and runs 1,000 bars in 52 ms, in the browser.
BTCUSDT · 1D · default settings
- Supertrend up
- Supertrend down
- Supertrend up
- Supertrend down
- 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, $2,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.
-
Check
1 setting does nothing
“ADX Threshold” is declared but never read.
-
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.
-
Note
Uses an argument v6 removed
when = on line 98. The upgraded version below moves each call inside an if block.
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 supertrend → ta.supertrend, max → math.max, abs → math.abs, sma → ta.sma.
- 1 strategy call uses the when = argument (line 98). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
DiffersTrades differ: 15 before, 24 after on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.
- Line 4: //@version=4 → //@version=5
- Line 12: input(type = input.session) → input.session()
- Line 15: input(type = input.float) → input.float()
- Line 17: input(type = input.float) → input.float()
- Line 21: input(type = input.float) → input.float()
- Line 23: input(type = input.float) → input.float()
14 more edits
- Line 26: input(type = input.float) → input.float()
- Line 28: input(type = input.integer) → input.int()
- Line 31: input(type = input.integer) → input.int()
- Line 32: input(type = input.integer) → input.int()
- Line 33: input(type = input.integer) → input.int()
- Line 40: supertrend → ta.supertrend
- Line 60: max → math.max
- Line 60: max → math.max
- Line 60: abs → math.abs
- Line 60: abs → math.abs
- Line 61: max → math.max
- Line 62: max → math.max
- Line 73: abs → math.abs
- Line 74: sma → ta.sma
⋯// © vikris-//@version=4+//@version=5strategy("[VJ]Hulk Smash Intra", overlay=true, calc_on_every_tick = false, pyramiding=0,default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=2000)⋯// square-off time set by your broker-var i_marketSession = input(title="Market session", type=input.session, +var i_marketSession = input.session(title="Market session", defval="0915-1455", confirm=true)// Make inputs that set the take profit % (optional)-longProfitPerc = input(title="Long Take Profit (%)",- type=input.float, minval=0.0, step=0.1, defval=1) * 0.01+longProfitPerc = input.float(title="Long Take Profit (%)", minval=0.0, step=0.1, defval=1) * 0.01-shortProfitPerc = input(title="Short Take Profit (%)",- type=input.float, minval=0.0, step=0.1, defval=1) * 0.01+shortProfitPerc = input.float(title="Short Take Profit (%)", minval=0.0, step=0.1, defval=1) * 0.01 // Set stop loss level with input options (optional)-longLossPerc = input(title="Long Stop Loss (%)",- type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01+longLossPerc = input.float(title="Long Stop Loss (%)", minval=0.0, step=0.1, defval=0.5) * 0.01-shortLossPerc = input(title="Short Stop Loss (%)",- type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01 +shortLossPerc = input.float(title="Short Stop Loss (%)", minval=0.0, step=0.1, defval=0.5) * 0.01 -var float i_multiplier = input(title = "ST Multiplier", type = input.float, +var float i_multiplier = input.float(title = "ST Multiplier", defval = 2, step = 0.1, confirm=true)-var int i_atrPeriod = input(title = "ST ATR Period", type = input.integer, +var int i_atrPeriod = input.int(title = "ST ATR Period", defval = 10, confirm=true) -len = input(title="ADX Length", type=input.integer, defval=14)+len = input.int(title="ADX Length", defval=14)-th = input(title="ADX Threshold", type=input.integer, defval=20)+th = input.int(title="ADX Threshold", defval=20)-adxval = input(title="ADX Momemtum Value", type=input.integer, defval=25) +adxval = input.int(title="ADX Momemtum Value", defval=25) // ********** Strategy inputs - End **********⋯// ********** Strategy - Start **********-[superTrend, dir] = supertrend(i_multiplier, i_atrPeriod)+[superTrend, dir] = ta.supertrend(i_multiplier, i_atrPeriod)colResistance = dir == 1 and dir == dir[1] ? color.new(color.red, 0) : color.new(color.red, 100)⋯// Trade only if intraday session is active-TrueRange = max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1])))+TrueRange = math.max(math.max(high - low, math.abs(high - nz(close[1]))), math.abs(low - nz(close[1])))-DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0+DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? math.max(high - nz(high[1]), 0) : 0-DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0) : 0+DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? math.max(nz(low[1]) - low, 0) : 0SmoothedTrueRange = 0.0⋯DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100-DX = abs(DIPlus - DIMinus) / (DIPlus + DIMinus) * 100+DX = math.abs(DIPlus - DIMinus) / (DIPlus + DIMinus) * 100-ADX = sma(DX, len)+ADX = ta.sma(DX, len)// a = plot(DIPlus, color=color.green, title="DI+", transp=100)⋯Clean v5
VerifiedSame 24 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.
- Line 94: when = squareOff → if block
⋯squareOff = (not intradaySession) and (strategy.position_size != 0)-strategy.close_all(when = squareOff, comment = "Square-off")+if squareOff+ strategy.close_all(comment = "Square-off")// ********** Strategy - End **********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: 24 before, 20 after on BTCUSDT 4h, 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.
⋯// © vikris-//@version=5+//@version=6strategy("[VJ]Hulk Smash Intra", overlay=true, calc_on_every_tick = false, pyramiding=0,default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=2000)⋯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 |
|---|---|---|---|
| Market session | 0915-1455 | session | intradaySession |
| Long Take Profit (%) | 1 | float · min 0.0 · step 0.1 | longExitPrice |
| Short Take Profit (%) | 1 | float · min 0.0 · step 0.1 | shortExitPrice |
| Long Stop Loss (%) | 0.5 | float · min 0.0 · step 0.1 | longStopPrice |
| Short Stop Loss (%) | 0.5 | float · min 0.0 · step 0.1 | shortStopPrice |
| ST Multiplier | 2 | float · step 0.1 | superTrend dir |
| ST ATR Period | 10 | int (written input.integer) | superTrend dir |
| ADX Length | 14 | int (written input.integer) | SmoothedTrueRange SmoothedDirectionalMovementPlus SmoothedDirectionalMovementMinus ADX |
| ADX Threshold | 20 | int (written input.integer) | unused |
| ADX Momemtum Value | 25 | int (written input.integer) | longCondition shortCondition |
What it calculates
- Supertrend (
supertrend,ta.supertrendin v5)ST Multiplier (2), ST ATR Period (10)superTrend · line 40 - Supertrend (
supertrend,ta.supertrendin v5)ST Multiplier (2), ST ATR Period (10)dir · line 40 - SMA (
sma,ta.smain v5)DX, ADX Length (14)ADX · line 74
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 My Long Entry Id long | (longCondition and intradaySession) | On | 84 |
| Exit TP/SL stop and limit | (longCondition and intradaySession) | On | 85 |
| Open My Short Entry Id short | (shortCondition and intradaySession) | On | 91 |
| Exit TP/SL stop and limit | (shortCondition and intradaySession) | On | 92 |
| Close | squareOff(not intradaySession) and (strategy.position_size != 0) | On | 98 |
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 | +3.6% | +5.5% | 15 | 67% | 2.39 | 1.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −2.9% | +8.4% | 22 | 50% | 0.71 | 6.2% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +1.0% | +21.5% | 17 | 53% | 1.16 | 4.5% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +2.0% | +17.1% | 19 | 58% | 1.50 | 2.8% | 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 |
|---|---|---|---|---|---|
| [VJ] Hulk Smash Intra this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| Strategy Template by Trendoscope | sma supertrend | v4 strategy | −21.8% | 11 | 40.5% |
| Dual-Supertrend with MACD - Strategy [presentTrading] by PresentTrading | sma supertrend | v5 strategy | −0.9% | 36 | 5.3% |
| Higher TF - Repainting + Limiting backtest results by Trendoscope | sma supertrend | v4 strategy | No trades on this market | ||
| [VJ] Mega Supertrend for Intraday by vikris | sma supertrend | v4 strategy | No trades on this market | ||
| Kitchen [ilovealgotrading] by lovealgotrading | supertrend sma | v5 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 32 ms | With a workaround 1,000 bars in 52 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.
//Intraday Strategy Template// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © vikris//@version=4strategy("[VJ]Hulk Smash Intra", overlay=true, calc_on_every_tick = false, pyramiding=0,default_qty_type=strategy.percent_of_equity, default_qty_value=100,initial_capital=2000)// ********** Strategy inputs - Start **********// Used for intraday handling// Session value should be from market start to the time you want to square-off // your intraday strategy// Important: The end time should be at least 2 minutes before the intraday// square-off time set by your brokervar i_marketSession = input(title="Market session", type=input.session, defval="0915-1455", confirm=true)// Make inputs that set the take profit % (optional)longProfitPerc = input(title="Long Take Profit (%)", type=input.float, minval=0.0, step=0.1, defval=1) * 0.01shortProfitPerc = input(title="Short Take Profit (%)", type=input.float, minval=0.0, step=0.1, defval=1) * 0.01 // Set stop loss level with input options (optional)longLossPerc = input(title="Long Stop Loss (%)", type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01shortLossPerc = input(title="Short Stop Loss (%)", type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01 var float i_multiplier = input(title = "ST Multiplier", type = input.float, defval = 2, step = 0.1, confirm=true)var int i_atrPeriod = input(title = "ST ATR Period", type = input.integer, defval = 10, confirm=true) len = input(title="ADX Length", type=input.integer, defval=14)th = input(title="ADX Threshold", type=input.integer, defval=20)adxval = input(title="ADX Momemtum Value", type=input.integer, defval=25) // ********** Strategy inputs - End **********// ********** Supporting functions - Start **********// A function to check whether the bar or period is in intraday sessionbarInSession(sess) => time(timeframe.period, sess) != 0// ********** Supporting functions - End **********// ********** Strategy - Start **********[superTrend, dir] = supertrend(i_multiplier, i_atrPeriod)colResistance = dir == 1 and dir == dir[1] ? color.new(color.red, 0) : color.new(color.red, 100)colSupport = dir == -1 and dir == dir[1] ? color.new(color.green, 0) : color.new(color.green, 100)// Super Trend Long/short conditionstlong = close > superTrendstshort = close < superTrend// Figure out take profit pricelongExitPrice = strategy.position_avg_price * (1 + longProfitPerc)shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)// Determine stop loss pricelongStopPrice = strategy.position_avg_price * (1 - longLossPerc)shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)//Vol Confirmationvol = volume > volume[1]//Candles colorsgreenCandle = (close > open)redCandle = (close < open)// See if intraday session is activebool intradaySession = barInSession(i_marketSession)// Trade only if intraday session is activeTrueRange = max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1])))DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0) : 0SmoothedTrueRange = 0.0SmoothedTrueRange := nz(SmoothedTrueRange[1]) - nz(SmoothedTrueRange[1]) / len + TrueRangeSmoothedDirectionalMovementPlus = 0.0SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) - nz(SmoothedDirectionalMovementPlus[1]) / len + DirectionalMovementPlusSmoothedDirectionalMovementMinus = 0.0SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) - nz(SmoothedDirectionalMovementMinus[1]) / len + DirectionalMovementMinusDIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100DX = abs(DIPlus - DIMinus) / (DIPlus + DIMinus) * 100ADX = sma(DX, len)// a = plot(DIPlus, color=color.green, title="DI+", transp=100)// b = plot(DIMinus, color=color.red, title="DI-", transp=100)//Final Long/Short ConditionlongCondition = stlong and redCandle and vol and ADX>adxvalshortCondition = stshort and greenCandle and vol and ADX >adxval//Long Strategy - buy condition and exits with Take profit and SLif (longCondition and intradaySession) stop_level = longStopPrice profit_level = longExitPrice strategy.entry("My Long Entry Id", strategy.long) strategy.exit("TP/SL", "My Long Entry Id",stop=stop_level, limit=profit_level) //Short Strategy - sell condition and exits with Take profit and SLif (shortCondition and intradaySession) stop_level = shortStopPrice profit_level = shortExitPrice strategy.entry("My Short Entry Id", strategy.short) strategy.exit("TP/SL", "My Short Entry Id", stop=stop_level, limit=profit_level) // Square-off position (when session is over and position is open)squareOff = (not intradaySession) and (strategy.position_size != 0)strategy.close_all(when = squareOff, comment = "Square-off")// ********** Strategy - End **********