Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

BTC 15 min

A Pine Script v4 strategy built on SMA (close, 30), EMA (source, 3) and RSI or CUM or Change (leng). It has 4 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 20% of equity and pays 0.075% commission. 23 settings; defaults include Strategy Direction all, length of channel 30 and upper percent 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 BTC 15 min repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 35 of 35 trades.
How did BTC 15 min do on BTCUSDT 1D with default settings?
−25.72%
From 26 Jan 2024 to 21 Oct 2026, over 119 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can BTC 15 min be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does BTC 15 min use a stop loss?
Yes
strategy.exit sets a stop on line 213, 214.
Does BTC 15 min run in Zeal Terminal?
Yes
It compiles in 47 ms and runs 1,000 bars in 113 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$7,276$20,253Equity from $10,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. The live re-run is not offered here: the script requests BINANCE:BTCUSDT 1, which this page cannot load in your browser.

Needs BINANCE:BTCUSDT 1 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Values that depend on it are empty on this chart.

Net profit
−25.72%
−$2,571.92
Buy and hold
+102.5%
same period
Closed trades
119
82 won · 37 lost
Profitable
68.9%
of closed trades
Profit factor
0.73
gross profit ÷ gross loss
Max drawdown
38.87%
−$4,615.37

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

  • Note

    6 settings have no label

    In the settings dialog HTF (line 29), len (line 54), Min (line 61), filter (line 191), risk (line 193), leverage (line 194) show an empty name. The labels on this page come from the variable names.

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 sma → ta.sma, ema → ta.ema, change → ta.change, rsi → ta.rsi, cum → ta.cum, wma → ta.wma, round → math.round, sqrt → math.sqrt, security → request.security, linreg → ta.linreg, crossover → ta.crossover, crossunder → ta.crossunder, stdev → ta.stdev, highest → ta.highest, lowest → ta.lowest, pow → math.pow.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 10: input(type = input.float) → input.float()
  • Line 11: input(type = input.float) → input.float()
  • Line 12: sma → ta.sma
  • Line 22: ema → ta.ema
  • Line 23: ema → ta.ema
41 more edits
  • Line 29: input(type = input.resolution) → input.timeframe()
  • Line 30: change → ta.change
  • Line 32: rsi → ta.rsi
  • Line 32: cum → ta.cum
  • Line 32: change → ta.change
  • Line 33: wma → ta.wma
  • Line 36: ema → ta.ema
  • Line 41: input(type = input.resolution) → input.timeframe()
  • Line 42: input(type = input.integer) → input.int()
  • Line 43: input(type = input.integer) → input.int()
  • Line 45: wma → ta.wma
  • Line 45: wma → ta.wma
  • Line 45: wma → ta.wma
  • Line 45: round → math.round
  • Line 45: sqrt → math.sqrt
  • Line 49: wma → ta.wma
  • Line 49: wma → ta.wma
  • Line 49: wma → ta.wma
  • Line 49: wma → ta.wma
  • Line 50: security → request.security
  • Line 55: linreg → ta.linreg
  • Line 56: crossover → ta.crossover
  • Line 57: crossunder → ta.crossunder
  • Line 57: crossunder → ta.crossunder
  • Line 66: wma → ta.wma
  • Line 67: wma → ta.wma
  • Line 75: ema → ta.ema
  • Line 76: stdev → ta.stdev
  • Line 81: crossover → ta.crossover
  • Line 82: crossunder → ta.crossunder
  • Line 91: highest → ta.highest
  • Line 92: lowest → ta.lowest
  • Line 108: crossover → ta.crossover
  • Line 143: input(type = input.float) → input.float()
  • Line 144: crossover → ta.crossover
  • Line 151: input(type = input.float) → input.float()
  • Line 152: crossunder → ta.crossunder
  • Line 192: round → math.round
  • Line 192: pow → math.pow
  • Line 192: pow → math.pow
  • Line 206: round → math.round
⋯// © RafaelZioni-//@version=4+//@version=5strategy(title = " BTC 15 min", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 20, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.075)⋯length8 = input(30,title = 'length of channel')-upmult = input(title = 'upper percent',type=input.float, step=0.1, defval=5)+upmult = input.float(title = 'upper percent', step=0.1, defval=5)-lowmult = input(title = 'lower percent',type=input.float, step=0.1, defval=5)+lowmult = input.float(title = 'lower percent', step=0.1, defval=5)-basis = sma(close, length8)+basis = ta.sma(close, length8)vup = upmult * price / 100⋯source=close-v1=ema(source,fastLength)+v1=ta.ema(source,fastLength)-v2=ema(source,slowLength)+v2=ta.ema(source,slowLength)//⋯//taken from https://www.tradingview.com/script/Ql1FjjfX-security-free-MTF-example-JD/-HTF = input("1D", type=input.resolution)+HTF = input.timeframe("1D")-ti = change( time(HTF) ) != 0+ti = ta.change( time(HTF) ) != 0T_c = fixnan( ti ? close : na )-vrsi = rsi(cum(change(T_c) * volume), leng)+vrsi = ta.rsi(ta.cum(ta.change(T_c) * volume), leng)-pp=wma(vrsi,len55)+pp=ta.wma(vrsi,len55)d=(vrsi[1]-pp[1])len100 = 10-x=ema(d,len100)+x=ta.ema(d,len100)//⋯//-tf10 = input("1", title = "Timeframe", type = input.resolution, options = ["1", "5", "15", "30", "60","120", "240","360","720", "D", "W"])+tf10 = input.timeframe("1", title = "Timeframe", options = ["1", "5", "15", "30", "60","120", "240","360","720", "D", "W"])-length = input(50, title = "Period", type = input.integer)+length = input.int(50, title = "Period")-shift = input(1, title = "Shift", type = input.integer)+shift = input.int(1, title = "Shift")hma(_src, _length)=>-    wma((2 * wma(_src, _length / 2)) - wma(_src, _length), round(sqrt(_length)))+    ta.wma((2 * ta.wma(_src, _length / 2)) - ta.wma(_src, _length), math.round(math.sqrt(_length)))    ⋯    p = length/2-    wma(wma(close,p/3)*3 - wma(close,p/2) - wma(close,p),p)+    ta.wma(ta.wma(close,p/3)*3 - ta.wma(close,p/2) - ta.wma(close,p),p)-b =security(syminfo.tickerid, tf10, hma3(close[1], length)[shift])+b =request.security(syminfo.tickerid, tf10, hma3(close[1], length)[shift])//plot(a,color=color.gray)⋯len = input(25)-linear_reg = linreg(close_price, len, 0)+linear_reg = ta.linreg(close_price, len, 0)-buy=crossover(linear_reg, b) +buy=ta.crossover(linear_reg, b) -sell=crossunder(linear_reg, b) or crossunder(close[1],upper)+sell=ta.crossunder(linear_reg, b) or ta.crossunder(close[1],upper)//⋯   60 / timeframe.multiplier * 24 * 7 : 7-l1 = wma(src2,leni)+l1 = ta.wma(src2,leni)-h1 = wma(src3,leni)+h1 = ta.wma(src3,leni)//⋯multi = 2-mean = ema(src5, len5)  +mean = ta.ema(src5, len5)  -stddev = multi * stdev(src5, len5)  +stddev = multi * ta.stdev(src5, len5)  b5 = mean + stddev⋯var bool short = na-long :=crossover(src5, s5) +long :=ta.crossover(src5, s5) -short :=  crossunder(src5, b5)+short :=  ta.crossunder(src5, b5)var float last_open_long = na⋯//-highb = highest(entry_value1, r)  +highb = ta.highest(entry_value1, r)  -lowb = lowest(entry_value, r)  +lowb = ta.lowest(entry_value, r)  d5 = highb - lowb  ⋯shortCond = bool(na)-longCond := crossover(zx,0) or buy +longCond := ta.crossover(zx,0) or buy shortCond := sell⋯//isTPs = input(false, "Take Profit Short")-tp = input(2, "Exit Profit %", type=input.float)+tp = input.float(2, "Exit Profit %")-long_tp = isTPl and crossover(high, (1 + tp / 100) * last_open_longCondition) and longCondition == 0 and in_longCondition == 1+long_tp = isTPl and ta.crossover(high, (1 + tp / 100) * last_open_longCondition) and longCondition == 0 and in_longCondition == 1//short_tp = isTPs and crossunder(low, (1 - tp / 100) * last_open_shortCondition) and ⋯sl = 0.0-sl := input(5, " rebuy %", type=input.float)+sl := input.float(5, " rebuy %")-long_sl = isSLl and crossunder(low, (1 - sl / 100) * last_open_longCondition) and +long_sl = isSLl and ta.crossunder(low, (1 - sl / 100) * last_open_longCondition) and    longCondition == 0 and in_longCondition == 1⋯filter=input(true)-g(v, p) => round(v * (pow(10, p))) / pow(10, p)+g(v, p) => math.round(v * (math.pow(10, p))) / math.pow(10, p)risk     = input(100)⋯per(pcnt) =>-    strategy.position_size != 0 ? round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)+    strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)stoploss=input(title=" stop loss", defval=5, minval=0.01)⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 5: input() → input.string()
  • Line 9: input() → input.int()
  • Line 19: input() → input.int()
  • Line 20: input() → input.int()
  • Line 54: input() → input.int()
  • Line 61: input() → input.int()
9 more edits
  • Line 148: input() → input.bool()
  • Line 191: input() → input.bool()
  • Line 193: input() → input.int()
  • Line 194: input() → input.int()
  • Line 207: input() → input.int()
  • Line 209: input() → input.int()
  • Line 210: input() → input.int()
  • Line 211: input() → input.int()
  • Line 212: input() → input.int()
⋯strategy(title = " BTC 15 min", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 20, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.075)-strat_dir_input = input(title="Strategy Direction", defval="all", options=["long", "short", "all"])+strat_dir_input = input.string(title="Strategy Direction", defval="all", options=["long", "short", "all"])strat_dir_value = strat_dir_input == "long" ? strategy.direction.long : strat_dir_input == "short" ? strategy.direction.short : strategy.direction.all⋯price = close-length8 = input(30,title = 'length of channel')+length8 = input.int(30,title = 'length of channel')upmult = input.float(title = 'upper percent', step=0.1, defval=5)⋯//-fastLength = input(3, title="Fast filter length ", minval=1)+fastLength = input.int(3, title="Fast filter length ", minval=1)-slowLength = input(21,title="Slow filter length",  minval=1)+slowLength = input.int(21,title="Slow filter length",  minval=1)source=close⋯close_price = close[0]-len = input(25)+len = input.int(25)linear_reg = ta.linreg(close_price, len, 0)⋯src3=high-Min =input(15)+Min =input.int(15)leni = timeframe.isintraday and timeframe.multiplier >= 1 ? ⋯// Stop Loss-isSLl = input(true,"buy Loss Long")+isSLl = input.bool(true,"buy Loss Long")//isSLs = input(false, "buy Loss Short")⋯//-filter=input(true)+filter=input.bool(true)g(v, p) => math.round(v * (math.pow(10, p))) / math.pow(10, p)-risk     = input(100)+risk     = input.int(100)-leverage = input(1)+leverage = input.int(1)c = g((strategy.equity * leverage / open) * (risk / 100), 4)⋯    strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)-stoploss=input(title=" stop loss", defval=5, minval=0.01)+stoploss=input.int(title=" stop loss", defval=5, minval=0.01)los = per(stoploss)-q1=input(title=" qty_percent1", defval=50, minval=1)+q1=input.int(title=" qty_percent1", defval=50, minval=1)-q2=input(title=" qty_percent2", defval=50, minval=1)+q2=input.int(title=" qty_percent2", defval=50, minval=1)-tp10=input(title=" Take profit1", defval=1, minval=0.01)+tp10=input.int(title=" Take profit1", defval=1, minval=0.01)-tp20=input(title=" Take profit2", defval=2, minval=0.01)+tp20=input.int(title=" Take profit2", defval=2, minval=0.01)strategy.exit("x1", qty_percent = q1, profit = per(tp10), loss = los)⋯

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L79:C0: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © RafaelZioni-//@version=5+//@version=6strategy(title = " BTC 15 min", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 20, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.075)⋯

Settings

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

SettingDefaultType and rangeFeeds
Strategy Directionallstring · options ["long", "short", "all"]strat_dir_value
length of channel30intbasis
upper percent5float · step 0.1vup
lower percent5float · step 0.1vlow
Fast filter length 3int · min 1v1
Slow filter length21int · min 1v2
HTF (no label in the script)1Dtimeframe (written input.resolution)ti
Timeframe1timeframe (written input.resolution) · options ["1", "5", "15", "30", "60","120", "240","360","720", "D", "W"]b
Period50int (written input.integer)p b
Shift1int (written input.integer)b
Len (no label in the script)25intlinear_reg
Min (no label in the script)15intleni
Exit Profit %2floatlong_tp
buy Loss Longtrueboollong_sl
rebuy %5floatlong_sl
Filter (no label in the script)truebooll
Risk (no label in the script)100intc
Leverage (no label in the script)1intc
stop loss5int · min 0.01los
qty_percent150int · min 1exit x1
qty_percent250int · min 1exit x2
Take profit11int · min 0.01exit x1
Take profit22int · min 0.01exit x2

What it calculates

  • SMA (sma, ta.sma in v5)close, length of channel (30)basis · line 12
  • EMA (ema, ta.ema in v5)source, Fast filter length (3)v1 · line 22
  • EMA (ema, ta.ema in v5)source, Slow filter length (21)v2 · line 23
  • RSI / CUM / Change (rsi, ta.rsi in v5)cum(change(T_c) * volume), lengvrsi · line 32
  • WMA (wma, ta.wma in v5)vrsi, len55pp · line 33
  • EMA (ema, ta.ema in v5)d, len100x · line 36
  • Linreg (linreg, ta.linreg in v5)close_price, Len (25), 0linear_reg · line 55
  • Crossover (crossover, ta.crossover in v5)linear_reg, bbuy · line 56
  • WMA (wma, ta.wma in v5)src2, lenil1 · line 66
  • WMA (wma, ta.wma in v5)src3, lenih1 · line 67
  • EMA (ema, ta.ema in v5)src5, len5mean · line 75
  • Stdev (stdev, ta.stdev in v5)src5, len5stddev · line 76
  • Crossover (crossover, ta.crossover in v5)src5, s5long · line 81
  • Crossunder (crossunder, ta.crossunder in v5)src5, b5short · line 82
  • Highest (highest, ta.highest in v5)entry_value1, rhighb · line 91
  • Lowest (lowest, ta.lowest in v5)entry_value, rlowb · line 92

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.

The script has 101 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open buy longlOn202
Open sell shortsOn204
Exit x1 stop and limitevery barOn213
Exit x2 stop and limitevery barOn214

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.

35/35trades 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 data1 security call(s), none with lookahead on.
  • 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

Not run on other markets: the script requests BINANCE:BTCUSDT 1, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market4971%−$291.38
Sideways market5673%−$410.38
Falling market1443%−$1,864.51

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

How bad could the drawdown be?

35.4%

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

0%42%
All 119 trades
SideEntryExitBarsP&L
long19 Feb 2024 52,137.7020 Feb 2024 52,659.101$42.86
long19 Feb 2024 52,137.7021 Feb 2024 52,258.802$4.15
short21 Feb 2024 52,258.8022 Feb 2024 51,736.201$43.15
short21 Feb 2024 52,258.8022 Feb 2024 51,213.601$93.90
long31 Mar 2024 69,582.201 Apr 2024 71,280.001$116.07
long31 Mar 2024 69,582.201 Apr 2024 71,280.001$116.07
long7 Apr 2024 68,896.008 Apr 2024 69,585.001$44.94
long7 Apr 2024 68,896.008 Apr 2024 70,273.901$97.81
long14 Apr 2024 63,924.5015 Apr 2024 65,661.901$129.00
long14 Apr 2024 63,924.5015 Apr 2024 65,661.901$129.00
long25 Apr 2024 64,289.6030 Apr 2024 61,075.105−$269.48
long25 Apr 2024 64,289.6030 Apr 2024 61,075.105−$269.48
long30 May 2024 67,652.4031 May 2024 68,352.201$44.92
long30 May 2024 67,652.4031 May 2024 69,005.501$93.98
long2 Jun 2024 67,766.803 Jun 2024 68,444.501$44.37
long2 Jun 2024 67,766.803 Jun 2024 69,122.201$96.58
short4 Jun 2024 68,809.909 Jun 2024 69,310.505−$94.13
long9 Jun 2024 69,310.5010 Jun 2024 70,003.601$44.44
long9 Jun 2024 69,310.5014 Jun 2024 65,844.905−$269.30
long22 Jun 2024 64,143.6024 Jun 2024 60,936.402−$260.45
long22 Jun 2024 64,143.6024 Jun 2024 60,936.402−$260.45
long20 Jul 2024 66,660.0021 Jul 2024 67,326.601$43.00
long20 Jul 2024 66,660.0021 Jul 2024 67,993.201$93.59
long28 Aug 2024 59,415.0029 Aug 2024 60,009.201$39.56
long28 Aug 2024 59,415.0029 Aug 2024 60,603.301$86.11
short10 Sep 2024 57,042.0011 Sep 2024 56,471.601$44.14
short10 Sep 2024 57,042.0011 Sep 2024 55,901.201$96.06
long7 Oct 2024 62,819.908 Oct 2024 62,224.001−$112.49
short8 Oct 2024 62,224.009 Oct 2024 61,601.801$42.19
short8 Oct 2024 62,224.009 Oct 2024 60,979.501$91.82
long11 Oct 2024 60,326.4012 Oct 2024 62,540.001$177.46
long11 Oct 2024 60,326.4012 Oct 2024 62,540.001$177.46
long23 Oct 2024 67,426.0024 Oct 2024 68,100.301$44.61
long23 Oct 2024 67,426.0024 Oct 2024 68,774.501$97.09
long25 Oct 2024 68,198.3028 Oct 2024 68,880.303$46.22
long25 Oct 2024 68,198.3028 Oct 2024 69,562.203$100.60
long1 Nov 2024 70,292.006 Nov 2024 70,994.905$44.50
long1 Nov 2024 70,292.006 Nov 2024 71,697.905$96.87
long16 Nov 2024 91,032.1018 Nov 2024 91,942.402$48.36
long16 Nov 2024 91,032.1019 Nov 2024 92,852.703$105.25
long7 Dec 2024 99,740.808 Dec 2024 100,738.001$48.41
long7 Dec 2024 99,740.809 Dec 2024 94,753.802−$293.35
long11 Dec 2024 96,593.0012 Dec 2024 101,125.001$244.17
long11 Dec 2024 96,593.0012 Dec 2024 101,125.001$244.17
long20 Dec 2024 97,461.9021 Dec 2024 98,436.501$46.76
long20 Dec 2024 97,461.9021 Dec 2024 99,411.101$101.79
short3 Jan 2025 96,984.806 Jan 2025 101,834.003−$303.15
short3 Jan 2025 96,984.806 Jan 2025 101,834.003−$303.15
long14 Jan 2025 94,536.1015 Jan 2025 96,560.901$108.09
long14 Jan 2025 94,536.1015 Jan 2025 96,560.901$108.09
long24 Jan 2025 103,910.0025 Jan 2025 104,949.001$47.17
long24 Jan 2025 103,910.0027 Jan 2025 98,714.803−$285.82
long2 Feb 2025 100,636.003 Feb 2025 101,642.001$45.25
long2 Feb 2025 100,636.003 Feb 2025 95,603.901−$274.23
short11 May 2025 104,810.0012 May 2025 103,761.001$45.97
short11 May 2025 104,810.0012 May 2025 102,713.001$100.03
short10 Jun 2025 110,263.0011 Jun 2025 109,160.001$47.75
short10 Jun 2025 110,263.0012 Jun 2025 108,058.002$103.91
long23 Jun 2025 100,964.0024 Jun 2025 105,334.001$225.31
long23 Jun 2025 100,964.0024 Jun 2025 105,334.001$225.31
long25 Jul 2025 118,341.0027 Jul 2025 119,524.002$48.09
long25 Jul 2025 118,341.002 Aug 2025 112,424.008−$291.41
long3 Aug 2025 112,546.004 Aug 2025 114,209.001$73.20
long3 Aug 2025 112,546.004 Aug 2025 114,797.001$102.05
short12 Aug 2025 118,686.0014 Aug 2025 117,499.002$47.81
short12 Aug 2025 118,686.0018 Aug 2025 116,312.006$104.05
long22 Aug 2025 112,500.0023 Aug 2025 116,936.001$213.62
long22 Aug 2025 112,500.0023 Aug 2025 116,936.001$213.62
long25 Aug 2025 113,494.0029 Aug 2025 107,819.004−$300.50
long25 Aug 2025 113,494.0029 Aug 2025 107,819.004−$300.50
long23 Sep 2025 112,651.0024 Sep 2025 113,778.001$46.78
long23 Sep 2025 112,651.001 Oct 2025 114,904.008$101.83
long9 Oct 2025 123,306.0010 Oct 2025 117,141.001−$298.56
long9 Oct 2025 123,306.0010 Oct 2025 117,141.001−$298.56
long18 Oct 2025 106,432.0019 Oct 2025 107,496.001$45.19
long18 Oct 2025 106,432.0019 Oct 2025 108,560.001$98.37
long23 Oct 2025 107,567.0024 Oct 2025 110,078.001$118.90
long23 Oct 2025 107,567.0024 Oct 2025 110,078.001$118.90
short27 Oct 2025 114,559.0028 Oct 2025 113,414.001$48.93
short27 Oct 2025 114,559.0028 Oct 2025 112,268.001$106.48
long31 Oct 2025 108,323.001 Nov 2025 109,608.001$57.94
long31 Oct 2025 108,323.001 Nov 2025 110,489.001$103.42
long4 Nov 2025 106,583.005 Nov 2025 101,254.001−$285.77
long4 Nov 2025 106,583.005 Nov 2025 101,254.001−$285.77
long18 Jan 2026 95,147.8020 Jan 2026 90,390.402−$280.57
long18 Jan 2026 95,147.8020 Jan 2026 90,390.402−$280.57
long31 Jan 2026 84,260.501 Feb 2026 78,741.101−$346.12
long31 Jan 2026 84,260.501 Feb 2026 78,741.101−$346.12
short10 Mar 2026 68,432.2013 Mar 2026 71,853.803−$259.22
short10 Mar 2026 68,432.2013 Mar 2026 71,853.803−$259.22
long30 Mar 2026 66,010.9031 Mar 2026 66,797.401$47.50
long30 Mar 2026 66,010.9031 Mar 2026 67,331.101$84.38
short7 Apr 2026 68,853.708 Apr 2026 72,296.301−$239.35
short7 Apr 2026 68,853.708 Apr 2026 72,296.301−$239.35
long26 Apr 2026 77,625.0027 Apr 2026 78,657.601$52.22
long26 Apr 2026 77,625.0027 Apr 2026 79,177.501$81.86
short28 Apr 2026 77,371.3029 Apr 2026 76,342.801$52.06
short28 Apr 2026 77,371.3029 Apr 2026 75,823.901$81.65
long5 May 2026 79,861.006 May 2026 80,905.501$53.50
long5 May 2026 79,861.006 May 2026 81,458.201$85.47
long9 May 2026 80,193.2010 May 2026 80,995.101$39.33
long9 May 2026 80,193.2010 May 2026 81,797.001$85.61
long13 May 2026 80,504.5014 May 2026 81,309.501$39.17
long13 May 2026 80,504.5018 May 2026 76,479.305−$237.39
long2 Jun 2026 71,408.903 Jun 2026 66,760.801−$295.56
long2 Jun 2026 71,408.903 Jun 2026 66,760.801−$295.56
long25 Jul 2026 64,140.0026 Jul 2026 64,781.401$35.87
long25 Jul 2026 64,140.0026 Jul 2026 65,422.801$78.07
short20 Aug 2026 69,334.8021 Aug 2026 73,027.001−$254.91
short20 Aug 2026 69,334.8021 Aug 2026 73,027.001−$254.91
long15 Sep 2026 78,189.2018 Sep 2026 78,971.103$35.33
long15 Sep 2026 78,189.2018 Sep 2026 79,753.003$76.89
short19 Sep 2026 80,883.9021 Sep 2026 84,928.102−$226.14
short19 Sep 2026 80,883.9021 Sep 2026 84,928.102−$226.14
long30 Sep 2026 83,663.701 Oct 2026 84,500.301$33.36
long30 Sep 2026 83,663.702 Oct 2026 85,336.902$72.61
short3 Oct 2026 84,518.007 Oct 2026 85,549.904−$108.53
long7 Oct 2026 85,549.908 Oct 2026 81,272.401−$201.20
long7 Oct 2026 85,549.908 Oct 2026 81,272.401−$201.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
BTC 15 min this page—v4 strategy−25.7%11938.9%
MZ SRSI Strategy V1.0 by MightyZingerema sma highest lowest stdev rsiv4 strategyNo trades on this market
BBPBΔ(OBV-PVT)BB - Time Series Decomposition & Volume Weighted by tathalcum ema stdev sma highest lowestv4 strategyNo trades on this market
RSI Overbought Oversold Divergence Strategy w- Buy-Sell Signals by imal_maxema sma lowest highest rsi cumv5 strategydoes not run in Zeal Terminal
VixFixLinReg-Strategy by Trendoscopehighest stdev sma lowest linregv4 strategy−49.3%1251.1%
Crunchster's Turtle and Trend System by Crunchster1lowest highest ema stdev smav5 strategy+18.0%3116.7%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 47 msWith a workaround 1,000 bars in 113 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/// © RafaelZioni//@version=4strategy(title = " BTC 15 min", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 20, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.075)strat_dir_input = input(title="Strategy Direction", defval="all", options=["long", "short", "all"])strat_dir_value = strat_dir_input == "long" ? strategy.direction.long : strat_dir_input == "short" ? strategy.direction.short : strategy.direction.allstrategy.risk.allow_entry_in(strat_dir_value)price = closelength8 = input(30,title = 'length of channel')upmult = input(title = 'upper percent',type=input.float, step=0.1, defval=5)lowmult = input(title = 'lower percent',type=input.float, step=0.1, defval=5)basis = sma(close, length8)vup = upmult * price / 100vlow = lowmult * price / 100upper = basis + vuplower = basis - vlowplot(basis, color=color.red)//fastLength = input(3, title="Fast filter length ", minval=1)slowLength = input(21,title="Slow filter length",  minval=1)source=closev1=ema(source,fastLength)v2=ema(source,slowLength)//leng=1p1=close[1]len55 = 10//taken from https://www.tradingview.com/script/Ql1FjjfX-security-free-MTF-example-JD/HTF = input("1D", type=input.resolution)ti = change( time(HTF) ) != 0T_c = fixnan( ti ? close : na )vrsi = rsi(cum(change(T_c) * volume), leng)pp=wma(vrsi,len55)d=(vrsi[1]-pp[1])len100 = 10x=ema(d,len100)//zx=x/-1col=zx > 0? color.lime : color.orange//tf10 = input("1", title = "Timeframe", type = input.resolution, options = ["1", "5", "15", "30", "60","120", "240","360","720", "D", "W"])length = input(50, title = "Period", type = input.integer)shift = input(1, title = "Shift", type = input.integer)hma(_src, _length)=>    wma((2 * wma(_src, _length / 2)) - wma(_src, _length), round(sqrt(_length)))    hma3(_src, _length)=>    p = length/2    wma(wma(close,p/3)*3 - wma(close,p/2) - wma(close,p),p)b =security(syminfo.tickerid, tf10, hma3(close[1], length)[shift])//plot(a,color=color.gray)//plot(b,color=color.yellow)close_price = close[0]len = input(25)linear_reg = linreg(close_price, len, 0)buy=crossover(linear_reg, b) sell=crossunder(linear_reg, b) or crossunder(close[1],upper)//src2=lowsrc3=highMin =input(15)leni = timeframe.isintraday and timeframe.multiplier >= 1 ?    Min / timeframe.multiplier * 7 :    timeframe.isintraday and timeframe.multiplier < 60 ?    60 / timeframe.multiplier * 24 * 7 : 7l1 = wma(src2,leni)h1 = wma(src3,leni)//m=(h1+l1)/2//len5 = 100src5=m//multi = 2mean = ema(src5, len5)  stddev = multi * stdev(src5, len5)  b5 = mean + stddevs5 = mean - stddevvar bool long = navar bool short = nalong :=crossover(src5, s5) short :=  crossunder(src5, b5)var float last_open_long = navar float last_open_short = nalast_open_long := long ? close : nz(last_open_long[1])last_open_short := short ? close : nz(last_open_short[1])entry_value =last_open_longentry_value1=last_open_shortr=100//highb = highest(entry_value1, r)  lowb = lowest(entry_value, r)  d5 = highb - lowb  me = (highb + lowb) / 2  h4 = highb - d5 * 0.236  c3 = highb - d5 * 0.382  c4 = highb - d5 * 0.618  l4 = highb - d5 * 0.764  //col2 = close >= me ? color.lime : color.red       p5 = plot(upper, color=col2)p2 = plot(lower, color=col2)fill(p5, p2,color=col2)// ConditionslongCond = bool(na)shortCond = bool(na)longCond := crossover(zx,0) or buy shortCond := sell// Count your long short conditions for more control with PyramidingsectionLongs = 0sectionLongs := nz(sectionLongs[1])sectionShorts = 0sectionShorts := nz(sectionShorts[1])if longCond    sectionLongs := sectionLongs + 1    sectionShorts := 0    sectionShortsif shortCond    sectionLongs := 0    sectionShorts := sectionShorts + 1    sectionShorts// Pyramidingpyrl = 1// These check to see your signal and cross references it against the pyramiding settings abovelongCondition = longCond and sectionLongs <= pyrlshortCondition = shortCond and sectionShorts <= pyrl// Get the price of the last opened long or shortlast_open_longCondition = float(na)last_open_shortCondition = float(na)last_open_longCondition := longCondition ? open : nz(last_open_longCondition[1])last_open_shortCondition := shortCondition ? open : nz(last_open_shortCondition[1])// Check if your last postion was a long or a shortlast_longCondition = float(na)last_shortCondition = float(na)last_longCondition := longCondition ? time : nz(last_longCondition[1])last_shortCondition := shortCondition ? time : nz(last_shortCondition[1])in_longCondition = last_longCondition > last_shortConditionin_shortCondition = last_shortCondition > last_longCondition// Take profitisTPl = true//isTPs = input(false, "Take Profit Short")tp = input(2, "Exit Profit %", type=input.float)long_tp = isTPl and crossover(high, (1 + tp / 100) * last_open_longCondition) and longCondition == 0 and in_longCondition == 1//short_tp = isTPs and crossunder(low, (1 - tp / 100) * last_open_shortCondition) and    //shortCondition == 0 and in_shortCondition == 1// Stop LossisSLl = input(true,"buy Loss Long")//isSLs = input(false, "buy Loss Short")sl = 0.0sl := input(5, " rebuy %", type=input.float)long_sl = isSLl and crossunder(low, (1 - sl / 100) * last_open_longCondition) and    longCondition == 0 and in_longCondition == 1//short_sl = isSLs and crossover(high, (1 + sl / 100) * last_open_shortCondition) and    //shortCondition == 0 and in_shortCondition == 1//// ConditionslongCond5 = bool(na)shortCond5 = bool(na)longCond5 := longConditionshortCond5 := long_tp// sectionLongs5 = 0sectionLongs5 := nz(sectionLongs5[1])sectionShorts5 = 0sectionShorts5 := nz(sectionShorts5[1])if longCond5    sectionLongs5 := sectionLongs5 + 1    sectionShorts5 := 0    sectionShorts5if shortCond5    sectionLongs5 := 0    sectionShorts5 := sectionShorts5 + 1    sectionShorts5// pyr5 = 1longCondition5 = longCond5 and sectionLongs5 <= pyr5shortCondition5 = shortCond5 and sectionShorts5 <= pyr5// Get the price of the last opened long or shortlast_open_longCondition5 = float(na)last_open_shortCondition5 = float(na)last_open_longCondition5 := longCondition5 ? open : nz(last_open_longCondition5[1])last_open_shortCondition5 := shortCondition5 ? open : nz(last_open_shortCondition5[1])last_longCondition5 = float(na)last_shortCondition5 = float(na)last_longCondition5 := longCondition5 ? time : nz(last_longCondition5[1])last_shortCondition5 := shortCondition5 ? time : nz(last_shortCondition5[1])in_longCondition5 = last_longCondition5 > last_shortCondition5in_shortCondition5 = last_shortCondition5 > last_longCondition5//filter=input(true)g(v, p) => round(v * (pow(10, p))) / pow(10, p)risk     = input(100)leverage = input(1)c = g((strategy.equity * leverage / open) * (risk / 100), 4)//l =(v1 > v2 or filter == false ) and longCondition or long_sl////l = longCondition or long_sls=shortCondition5  if l     strategy.entry("buy", strategy.long,c)if s     strategy.entry("sell", strategy.short,c)per(pcnt) =>    strategy.position_size != 0 ? round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)stoploss=input(title=" stop loss", defval=5, minval=0.01)los = per(stoploss)q1=input(title=" qty_percent1", defval=50, minval=1)q2=input(title=" qty_percent2", defval=50, minval=1)tp10=input(title=" Take profit1", defval=1, minval=0.01)tp20=input(title=" Take profit2", defval=2, minval=0.01)strategy.exit("x1", qty_percent = q1, profit = per(tp10), loss = los)strategy.exit("x2", qty_percent = q2, profit = per(tp20), loss = los)