Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

ROoT

A Pine Script v5 strategy built on Crossover or SMA or VWAP (close, 5, hlc3), Crossunder or SMA or VWAP (close, 5, hlc3) and EMA (close, 9). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. It has no settings.

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 ROoT repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 76 of 76 trades.
How did ROoT do on BTCUSDT 1D with default settings?
−4.68%
From 26 Jan 2024 to 21 Oct 2026, over 225 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does ROoT 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: 225 before, 225 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 ROoT use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does ROoT run in Zeal Terminal?
Yes
It compiles in 7 ms and runs 1,000 bars in 22 ms, in the browser.

BTCUSDT · 1D · default settings

  • Crossover
  • Crossunder
  • EMA
  • 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 (0)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$950,461$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Net profit
−4.68%
−$46,765.60
Buy and hold
+102.5%
same period
Closed trades
225
142 won · 83 lost
Profitable
63.1%
of closed trades
Profit factor
0.85
gross profit ÷ gross loss
Max drawdown
9.41%
−$94,263.30

One run with the author's default settings, $1,000,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.

  • 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.

  • 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.

The script declares no settings.

What it calculates

  • Crossover / SMA / VWAPta.sma(close, 5), ta.vwap(hlc3)longCondition · line 5
  • Crossunder / SMA / VWAPta.sma(close, 5), ta.vwap(hlc3)shortCondition · line 8
  • EMAclose, 9stoploss · line 12

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.

hlc3hlc3price dataclosecloseprice datalongConditionCrossover / SMA / VWAP→ longConditionshortConditionCrossunder / SMA / VWAP→ shortConditionstoplossEMA→ stoplossentry:BUYOpen BUYstrategy.entryentry:SELLOpen SELLstrategy.entry

Order rules

OrderFires whenBy defaultLine
Open BUY long(longCondition)On7
Open SELL short(shortCondition)On10

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.

76/76trades 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−4.7%+102.5%22563%0.859.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.5%+5.5%31955%0.962.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.0%+9.8%23964%0.980.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%31159%0.980.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%22962%0.740.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%31152%0.770.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%23965%1.120.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%29157%1.040.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 market7658%−$46,420.10
Sideways market9866%$20,304.40
Falling market5165%−$20,649.90

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

How bad could the drawdown be?

11.2%

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

0%13%
The first 150 of 225 trades
SideEntryExitBarsP&L
long2 Feb 2024 43,082.903 Feb 2024 43,200.001$117.04
short3 Feb 2024 43,200.005 Feb 2024 42,582.902$617.11
long5 Feb 2024 42,582.907 Feb 2024 43,099.002$516.08
short7 Feb 2024 43,099.0019 Feb 2024 52,137.7012−$9,038.72
long19 Feb 2024 52,137.7020 Feb 2024 51,774.701−$362.94
short20 Feb 2024 51,774.7022 Feb 2024 51,849.402−$74.64
long22 Feb 2024 51,849.4026 Feb 2024 51,728.804−$120.53
short26 Feb 2024 51,728.8015 Mar 2024 71,388.9018−$19,660.10
long15 Mar 2024 71,388.9025 Mar 2024 67,210.0010−$4,178.94
short25 Mar 2024 67,210.0030 Mar 2024 69,850.505−$2,640.53
long30 Mar 2024 69,850.501 Apr 2024 71,280.002$1,429.47
short1 Apr 2024 71,280.002 Apr 2024 69,649.801$1,630.19
long2 Apr 2024 69,649.806 Apr 2024 67,820.604−$1,829.18
short6 Apr 2024 67,820.6011 Apr 2024 70,631.105−$2,810.45
long11 Apr 2024 70,631.1012 Apr 2024 70,006.201−$624.86
short12 Apr 2024 70,006.2013 Apr 2024 67,116.501$2,889.70
long13 Apr 2024 67,116.5021 Apr 2024 64,940.608−$2,175.94
short21 Apr 2024 64,940.6025 Apr 2024 64,289.604$651.00
long25 Apr 2024 64,289.604 May 2024 62,882.009−$1,407.57
short4 May 2024 62,882.008 May 2024 62,312.104$569.94
long8 May 2024 62,312.1014 May 2024 62,940.106$628.02
short14 May 2024 62,940.1024 May 2024 67,969.7010−$5,029.57
long24 May 2024 67,969.7026 May 2024 69,290.602$1,320.90
short26 May 2024 69,290.6029 May 2024 68,398.403$892.16
long29 May 2024 68,398.403 Jun 2024 67,765.605−$632.78
short3 Jun 2024 67,765.608 Jun 2024 69,355.605−$1,589.98
long8 Jun 2024 69,355.601 Jul 2024 62,772.0023−$6,583.59
short1 Jul 2024 62,772.004 Jul 2024 60,208.603$2,563.44
long4 Jul 2024 60,208.6010 Jul 2024 58,050.006−$2,158.57
short10 Jul 2024 58,050.0024 Jul 2024 65,936.0014−$7,886.00
long24 Jul 2024 65,936.0027 Jul 2024 67,908.003$1,972.00
short27 Jul 2024 67,908.0031 Jul 2024 66,188.004$1,720.00
long31 Jul 2024 66,188.009 Aug 2024 61,686.009−$4,502.00
short9 Aug 2024 61,686.0013 Aug 2024 59,346.604$2,339.36
long13 Aug 2024 59,346.6014 Aug 2024 60,587.201$1,240.52
short14 Aug 2024 60,587.2015 Aug 2024 58,683.401$1,903.77
long15 Aug 2024 58,683.4018 Aug 2024 59,492.003$808.60
short18 Aug 2024 59,492.0028 Aug 2024 59,415.0010$76.99
long28 Aug 2024 59,415.0010 Sep 2024 57,042.0013−$2,372.99
short10 Sep 2024 57,042.0017 Sep 2024 58,214.007−$1,171.98
long17 Sep 2024 58,214.0018 Sep 2024 60,314.001$2,100.00
short18 Sep 2024 60,314.001 Oct 2024 63,327.6013−$3,013.61
long1 Oct 2024 63,327.605 Oct 2024 62,086.004−$1,241.60
short5 Oct 2024 62,086.0010 Oct 2024 60,636.005$1,449.99
long10 Oct 2024 60,636.0012 Oct 2024 62,540.002$1,903.98
short12 Oct 2024 62,540.0022 Oct 2024 67,377.5010−$4,837.51
long22 Oct 2024 67,377.5025 Oct 2024 68,198.303$820.77
short25 Oct 2024 68,198.3026 Oct 2024 66,698.301$1,499.95
long26 Oct 2024 66,698.3028 Oct 2024 68,021.702$1,323.37
short28 Oct 2024 68,021.702 Nov 2024 69,496.005−$1,474.31
long2 Nov 2024 69,496.006 Nov 2024 69,372.004−$123.99
short6 Nov 2024 69,372.0025 Nov 2024 97,900.1019−$28,528.00
long25 Nov 2024 97,900.1029 Nov 2024 95,644.004−$2,256.06
short29 Nov 2024 95,644.003 Dec 2024 95,840.604−$196.62
long3 Dec 2024 95,840.605 Dec 2024 98,587.302$2,746.71
short5 Dec 2024 98,587.3010 Dec 2024 97,276.505$1,310.84
long10 Dec 2024 97,276.5012 Dec 2024 101,125.002$3,848.52
short12 Dec 2024 101,125.0019 Dec 2024 100,204.007$920.99
long19 Dec 2024 100,204.0025 Dec 2024 98,663.606−$1,540.43
short25 Dec 2024 98,663.6028 Dec 2024 94,299.003$4,364.55
long28 Dec 2024 94,299.001 Jan 2025 93,576.004−$723.03
short1 Jan 2025 93,576.008 Jan 2025 96,954.607−$3,378.60
long8 Jan 2025 96,954.6013 Jan 2025 94,545.105−$2,409.53
short13 Jan 2025 94,545.1014 Jan 2025 94,536.101$8.96
long14 Jan 2025 94,536.1015 Jan 2025 96,560.901$2,024.74
short15 Jan 2025 96,560.9027 Jan 2025 102,620.0012−$6,059.16
long27 Jan 2025 102,620.0030 Jan 2025 103,733.003$1,113.24
short30 Jan 2025 103,733.002 Feb 2025 100,636.003$3,097.59
long2 Feb 2025 100,636.0011 Feb 2025 97,430.809−$3,204.84
short11 Feb 2025 97,430.8012 Feb 2025 95,778.201$1,652.61
long12 Feb 2025 95,778.2015 Feb 2025 97,500.503$1,722.26
short15 Feb 2025 97,500.5017 Feb 2025 96,118.102$1,382.35
long17 Feb 2025 96,118.1021 Feb 2025 98,305.004$2,186.89
short21 Feb 2025 98,305.0023 Feb 2025 96,551.002$1,754.00
long23 Feb 2025 96,551.003 Mar 2025 94,270.008−$2,281.02
short3 Mar 2025 94,270.005 Mar 2025 87,282.002$6,988.01
long5 Mar 2025 87,282.006 Mar 2025 90,606.001$3,324.02
short6 Mar 2025 90,606.008 Mar 2025 86,801.702$3,804.26
long8 Mar 2025 86,801.7013 Mar 2025 83,680.105−$3,121.62
short13 Mar 2025 83,680.1019 Mar 2025 82,715.006$965.09
long19 Mar 2025 82,715.0020 Mar 2025 86,845.901$4,130.90
short20 Mar 2025 86,845.9022 Mar 2025 84,088.802$2,757.14
long22 Mar 2025 84,088.8024 Mar 2025 86,082.502$1,993.71
short24 Mar 2025 86,082.5028 Mar 2025 87,232.004−$1,149.51
long28 Mar 2025 87,232.002 Apr 2025 85,158.405−$2,073.66
short2 Apr 2025 85,158.404 Apr 2025 83,213.102$1,945.26
long4 Apr 2025 83,213.1010 Apr 2025 82,615.206−$597.87
short10 Apr 2025 82,615.2017 Apr 2025 84,030.407−$1,415.16
long17 Apr 2025 84,030.4018 Apr 2025 84,947.901$917.54
short18 Apr 2025 84,947.901 May 2025 94,172.0013−$9,224.08
long1 May 2025 94,172.002 May 2025 96,489.901$2,317.90
short2 May 2025 96,489.905 May 2025 94,277.603$2,212.29
long5 May 2025 94,277.608 May 2025 97,030.503$2,752.89
short8 May 2025 97,030.5013 May 2025 102,791.005−$5,760.82
long13 May 2025 102,791.0017 May 2025 103,464.004$672.58
short17 May 2025 103,464.0018 May 2025 103,127.001$337.25
long18 May 2025 103,127.0019 May 2025 106,454.001$3,327.62
short19 May 2025 106,454.0025 May 2025 107,762.006−$1,307.63
long25 May 2025 107,762.0027 May 2025 109,435.002$1,672.88
short27 May 2025 109,435.0029 May 2025 107,782.002$1,653.00
long29 May 2025 107,782.003 Jun 2025 105,858.005−$1,923.78
short3 Jun 2025 105,858.005 Jun 2025 104,697.002$1,161.14
long5 Jun 2025 104,697.008 Jun 2025 105,552.003$855.29
short8 Jun 2025 105,552.0013 Jun 2025 105,672.005−$119.59
long13 Jun 2025 105,672.0017 Jun 2025 106,795.004$1,122.79
short17 Jun 2025 106,795.0018 Jun 2025 104,551.001$2,243.36
long18 Jun 2025 104,551.0024 Jun 2025 105,334.006$782.77
short24 Jun 2025 105,334.002 Jul 2025 105,681.008−$347.19
long2 Jul 2025 105,681.003 Jul 2025 108,850.001$3,168.46
short3 Jul 2025 108,850.008 Jul 2025 108,263.005$586.65
long8 Jul 2025 108,263.009 Jul 2025 108,923.001$660.05
short9 Jul 2025 108,923.0016 Jul 2025 117,758.007−$8,835.09
long16 Jul 2025 117,758.0017 Jul 2025 118,630.001$872.36
short17 Jul 2025 118,630.0019 Jul 2025 117,925.002$705.60
long19 Jul 2025 117,925.0023 Jul 2025 119,954.004$2,029.59
short23 Jul 2025 119,954.0025 Jul 2025 118,341.002$1,613.45
long25 Jul 2025 118,341.0028 Jul 2025 119,416.003$1,074.58
short28 Jul 2025 119,416.0030 Jul 2025 117,951.002$1,464.81
long30 Jul 2025 117,951.005 Aug 2025 115,055.006−$2,895.72
short5 Aug 2025 115,055.0016 Aug 2025 117,342.0011−$2,287.01
long16 Aug 2025 117,342.0023 Aug 2025 116,936.007−$406.04
short23 Aug 2025 116,936.0025 Aug 2025 113,494.002$3,442.41
long25 Aug 2025 113,494.0029 Aug 2025 112,567.004−$926.69
short29 Aug 2025 112,567.0030 Aug 2025 108,377.001$4,189.50
long30 Aug 2025 108,377.003 Sep 2025 111,240.004$2,862.61
short3 Sep 2025 111,240.007 Sep 2025 110,188.004$1,052.03
long7 Sep 2025 110,188.008 Sep 2025 111,137.001$949.37
short8 Sep 2025 111,137.0016 Sep 2025 115,350.008−$4,212.36
long16 Sep 2025 115,350.0017 Sep 2025 116,789.001$1,439.25
short17 Sep 2025 116,789.0020 Sep 2025 115,632.003$1,156.57
long20 Sep 2025 115,632.0029 Sep 2025 112,164.009−$3,468.43
short29 Sep 2025 112,164.008 Oct 2025 121,333.009−$9,169.00
long8 Oct 2025 121,333.0021 Oct 2025 110,532.0013−$10,800.90
short21 Oct 2025 110,532.0023 Oct 2025 107,567.002$2,964.64
long23 Oct 2025 107,567.0024 Oct 2025 110,078.001$2,510.74
short24 Oct 2025 110,078.0030 Oct 2025 110,021.006$56.89
long30 Oct 2025 110,021.003 Nov 2025 110,541.004$519.39
short3 Nov 2025 110,541.004 Nov 2025 106,583.001$3,957.64
long4 Nov 2025 106,583.0010 Nov 2025 104,723.006−$1,860.10
short10 Nov 2025 104,723.0013 Nov 2025 101,654.003$3,068.58
long13 Nov 2025 101,654.0025 Nov 2025 88,300.0012−$13,354.40
short25 Nov 2025 88,300.002 Dec 2025 86,286.007$2,014.00
long2 Dec 2025 86,286.004 Dec 2025 93,429.902$7,143.94
short4 Dec 2025 93,429.906 Dec 2025 89,330.002$4,099.91
long6 Dec 2025 89,330.009 Dec 2025 90,634.403$1,304.31
short9 Dec 2025 90,634.4013 Dec 2025 90,268.404$365.92
long13 Dec 2025 90,268.4020 Dec 2025 88,136.907−$2,131.48
short20 Dec 2025 88,136.9024 Dec 2025 87,486.004$650.95
long24 Dec 2025 87,486.0027 Dec 2025 87,369.603−$116.44
short27 Dec 2025 87,369.608 Jan 2026 91,364.2012−$3,994.60

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
ROoT this page—v5 strategy−4.7%2259.4%
ZVWAP strategy by mohaneesma ema vwapv4 strategy+614.4%13748.5%
Ultimate Oscillator [Long] Strategy by mohaneesma vwap emav4 strategyNo trades on this market
JBravo Swing with GoGo Juice by bradvaughnsma ema vwapv4 strategy+68.7%9322.3%
VWAP and BB strategy [EEMANI] by mohaneeema vwap smav4 strategyNo trades on this market
Buying Selling Volume Strategy by exlux99vwap ema smav5 strategyNo trades on this market

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: 225 before, 225 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.

⋯// © realisticDove62527-//@version=5+//@version=6strategy("ROoT", overlay=true, margin_long=1, margin_short=1)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 7 msYes 1,000 bars in 22 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/// © realisticDove62527//@version=5strategy("ROoT", overlay=true, margin_long=1, margin_short=1)longCondition = ta.crossover(ta.sma(close, 5), ta.vwap(hlc3))if (longCondition)    strategy.entry("BUY", strategy.long)shortCondition = ta.crossunder(ta.sma(close, 5), ta.vwap(hlc3))if (shortCondition)    strategy.entry("SELL", strategy.short)    stoploss = ta.ema(close, 9)