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
- 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, 9
stoploss · 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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open BUY long | (longCondition) | On | 7 |
| Open SELL short | (shortCondition) | On | 10 |
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.
- 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 | −4.7% | +102.5% | 225 | 63% | 0.85 | 9.4% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.5% | +5.5% | 319 | 55% | 0.96 | 2.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.0% | +9.8% | 239 | 64% | 0.98 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.0% | +8.4% | 311 | 59% | 0.98 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 229 | 62% | 0.74 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 311 | 52% | 0.77 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.0% | +148.3% | 239 | 65% | 1.12 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 291 | 57% | 1.04 | 0.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 76 | 58% | −$46,420.10 |
| Sideways market | 98 | 66% | $20,304.40 |
| Falling market | 51 | 65% | −$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.
The first 150 of 225 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 2 Feb 2024 43,082.90 | 3 Feb 2024 43,200.00 | 1 | $117.04 |
| short | 3 Feb 2024 43,200.00 | 5 Feb 2024 42,582.90 | 2 | $617.11 |
| long | 5 Feb 2024 42,582.90 | 7 Feb 2024 43,099.00 | 2 | $516.08 |
| short | 7 Feb 2024 43,099.00 | 19 Feb 2024 52,137.70 | 12 | −$9,038.72 |
| long | 19 Feb 2024 52,137.70 | 20 Feb 2024 51,774.70 | 1 | −$362.94 |
| short | 20 Feb 2024 51,774.70 | 22 Feb 2024 51,849.40 | 2 | −$74.64 |
| long | 22 Feb 2024 51,849.40 | 26 Feb 2024 51,728.80 | 4 | −$120.53 |
| short | 26 Feb 2024 51,728.80 | 15 Mar 2024 71,388.90 | 18 | −$19,660.10 |
| long | 15 Mar 2024 71,388.90 | 25 Mar 2024 67,210.00 | 10 | −$4,178.94 |
| short | 25 Mar 2024 67,210.00 | 30 Mar 2024 69,850.50 | 5 | −$2,640.53 |
| long | 30 Mar 2024 69,850.50 | 1 Apr 2024 71,280.00 | 2 | $1,429.47 |
| short | 1 Apr 2024 71,280.00 | 2 Apr 2024 69,649.80 | 1 | $1,630.19 |
| long | 2 Apr 2024 69,649.80 | 6 Apr 2024 67,820.60 | 4 | −$1,829.18 |
| short | 6 Apr 2024 67,820.60 | 11 Apr 2024 70,631.10 | 5 | −$2,810.45 |
| long | 11 Apr 2024 70,631.10 | 12 Apr 2024 70,006.20 | 1 | −$624.86 |
| short | 12 Apr 2024 70,006.20 | 13 Apr 2024 67,116.50 | 1 | $2,889.70 |
| long | 13 Apr 2024 67,116.50 | 21 Apr 2024 64,940.60 | 8 | −$2,175.94 |
| short | 21 Apr 2024 64,940.60 | 25 Apr 2024 64,289.60 | 4 | $651.00 |
| long | 25 Apr 2024 64,289.60 | 4 May 2024 62,882.00 | 9 | −$1,407.57 |
| short | 4 May 2024 62,882.00 | 8 May 2024 62,312.10 | 4 | $569.94 |
| long | 8 May 2024 62,312.10 | 14 May 2024 62,940.10 | 6 | $628.02 |
| short | 14 May 2024 62,940.10 | 24 May 2024 67,969.70 | 10 | −$5,029.57 |
| long | 24 May 2024 67,969.70 | 26 May 2024 69,290.60 | 2 | $1,320.90 |
| short | 26 May 2024 69,290.60 | 29 May 2024 68,398.40 | 3 | $892.16 |
| long | 29 May 2024 68,398.40 | 3 Jun 2024 67,765.60 | 5 | −$632.78 |
| short | 3 Jun 2024 67,765.60 | 8 Jun 2024 69,355.60 | 5 | −$1,589.98 |
| long | 8 Jun 2024 69,355.60 | 1 Jul 2024 62,772.00 | 23 | −$6,583.59 |
| short | 1 Jul 2024 62,772.00 | 4 Jul 2024 60,208.60 | 3 | $2,563.44 |
| long | 4 Jul 2024 60,208.60 | 10 Jul 2024 58,050.00 | 6 | −$2,158.57 |
| short | 10 Jul 2024 58,050.00 | 24 Jul 2024 65,936.00 | 14 | −$7,886.00 |
| long | 24 Jul 2024 65,936.00 | 27 Jul 2024 67,908.00 | 3 | $1,972.00 |
| short | 27 Jul 2024 67,908.00 | 31 Jul 2024 66,188.00 | 4 | $1,720.00 |
| long | 31 Jul 2024 66,188.00 | 9 Aug 2024 61,686.00 | 9 | −$4,502.00 |
| short | 9 Aug 2024 61,686.00 | 13 Aug 2024 59,346.60 | 4 | $2,339.36 |
| long | 13 Aug 2024 59,346.60 | 14 Aug 2024 60,587.20 | 1 | $1,240.52 |
| short | 14 Aug 2024 60,587.20 | 15 Aug 2024 58,683.40 | 1 | $1,903.77 |
| long | 15 Aug 2024 58,683.40 | 18 Aug 2024 59,492.00 | 3 | $808.60 |
| short | 18 Aug 2024 59,492.00 | 28 Aug 2024 59,415.00 | 10 | $76.99 |
| long | 28 Aug 2024 59,415.00 | 10 Sep 2024 57,042.00 | 13 | −$2,372.99 |
| short | 10 Sep 2024 57,042.00 | 17 Sep 2024 58,214.00 | 7 | −$1,171.98 |
| long | 17 Sep 2024 58,214.00 | 18 Sep 2024 60,314.00 | 1 | $2,100.00 |
| short | 18 Sep 2024 60,314.00 | 1 Oct 2024 63,327.60 | 13 | −$3,013.61 |
| long | 1 Oct 2024 63,327.60 | 5 Oct 2024 62,086.00 | 4 | −$1,241.60 |
| short | 5 Oct 2024 62,086.00 | 10 Oct 2024 60,636.00 | 5 | $1,449.99 |
| long | 10 Oct 2024 60,636.00 | 12 Oct 2024 62,540.00 | 2 | $1,903.98 |
| short | 12 Oct 2024 62,540.00 | 22 Oct 2024 67,377.50 | 10 | −$4,837.51 |
| long | 22 Oct 2024 67,377.50 | 25 Oct 2024 68,198.30 | 3 | $820.77 |
| short | 25 Oct 2024 68,198.30 | 26 Oct 2024 66,698.30 | 1 | $1,499.95 |
| long | 26 Oct 2024 66,698.30 | 28 Oct 2024 68,021.70 | 2 | $1,323.37 |
| short | 28 Oct 2024 68,021.70 | 2 Nov 2024 69,496.00 | 5 | −$1,474.31 |
| long | 2 Nov 2024 69,496.00 | 6 Nov 2024 69,372.00 | 4 | −$123.99 |
| short | 6 Nov 2024 69,372.00 | 25 Nov 2024 97,900.10 | 19 | −$28,528.00 |
| long | 25 Nov 2024 97,900.10 | 29 Nov 2024 95,644.00 | 4 | −$2,256.06 |
| short | 29 Nov 2024 95,644.00 | 3 Dec 2024 95,840.60 | 4 | −$196.62 |
| long | 3 Dec 2024 95,840.60 | 5 Dec 2024 98,587.30 | 2 | $2,746.71 |
| short | 5 Dec 2024 98,587.30 | 10 Dec 2024 97,276.50 | 5 | $1,310.84 |
| long | 10 Dec 2024 97,276.50 | 12 Dec 2024 101,125.00 | 2 | $3,848.52 |
| short | 12 Dec 2024 101,125.00 | 19 Dec 2024 100,204.00 | 7 | $920.99 |
| long | 19 Dec 2024 100,204.00 | 25 Dec 2024 98,663.60 | 6 | −$1,540.43 |
| short | 25 Dec 2024 98,663.60 | 28 Dec 2024 94,299.00 | 3 | $4,364.55 |
| long | 28 Dec 2024 94,299.00 | 1 Jan 2025 93,576.00 | 4 | −$723.03 |
| short | 1 Jan 2025 93,576.00 | 8 Jan 2025 96,954.60 | 7 | −$3,378.60 |
| long | 8 Jan 2025 96,954.60 | 13 Jan 2025 94,545.10 | 5 | −$2,409.53 |
| short | 13 Jan 2025 94,545.10 | 14 Jan 2025 94,536.10 | 1 | $8.96 |
| long | 14 Jan 2025 94,536.10 | 15 Jan 2025 96,560.90 | 1 | $2,024.74 |
| short | 15 Jan 2025 96,560.90 | 27 Jan 2025 102,620.00 | 12 | −$6,059.16 |
| long | 27 Jan 2025 102,620.00 | 30 Jan 2025 103,733.00 | 3 | $1,113.24 |
| short | 30 Jan 2025 103,733.00 | 2 Feb 2025 100,636.00 | 3 | $3,097.59 |
| long | 2 Feb 2025 100,636.00 | 11 Feb 2025 97,430.80 | 9 | −$3,204.84 |
| short | 11 Feb 2025 97,430.80 | 12 Feb 2025 95,778.20 | 1 | $1,652.61 |
| long | 12 Feb 2025 95,778.20 | 15 Feb 2025 97,500.50 | 3 | $1,722.26 |
| short | 15 Feb 2025 97,500.50 | 17 Feb 2025 96,118.10 | 2 | $1,382.35 |
| long | 17 Feb 2025 96,118.10 | 21 Feb 2025 98,305.00 | 4 | $2,186.89 |
| short | 21 Feb 2025 98,305.00 | 23 Feb 2025 96,551.00 | 2 | $1,754.00 |
| long | 23 Feb 2025 96,551.00 | 3 Mar 2025 94,270.00 | 8 | −$2,281.02 |
| short | 3 Mar 2025 94,270.00 | 5 Mar 2025 87,282.00 | 2 | $6,988.01 |
| long | 5 Mar 2025 87,282.00 | 6 Mar 2025 90,606.00 | 1 | $3,324.02 |
| short | 6 Mar 2025 90,606.00 | 8 Mar 2025 86,801.70 | 2 | $3,804.26 |
| long | 8 Mar 2025 86,801.70 | 13 Mar 2025 83,680.10 | 5 | −$3,121.62 |
| short | 13 Mar 2025 83,680.10 | 19 Mar 2025 82,715.00 | 6 | $965.09 |
| long | 19 Mar 2025 82,715.00 | 20 Mar 2025 86,845.90 | 1 | $4,130.90 |
| short | 20 Mar 2025 86,845.90 | 22 Mar 2025 84,088.80 | 2 | $2,757.14 |
| long | 22 Mar 2025 84,088.80 | 24 Mar 2025 86,082.50 | 2 | $1,993.71 |
| short | 24 Mar 2025 86,082.50 | 28 Mar 2025 87,232.00 | 4 | −$1,149.51 |
| long | 28 Mar 2025 87,232.00 | 2 Apr 2025 85,158.40 | 5 | −$2,073.66 |
| short | 2 Apr 2025 85,158.40 | 4 Apr 2025 83,213.10 | 2 | $1,945.26 |
| long | 4 Apr 2025 83,213.10 | 10 Apr 2025 82,615.20 | 6 | −$597.87 |
| short | 10 Apr 2025 82,615.20 | 17 Apr 2025 84,030.40 | 7 | −$1,415.16 |
| long | 17 Apr 2025 84,030.40 | 18 Apr 2025 84,947.90 | 1 | $917.54 |
| short | 18 Apr 2025 84,947.90 | 1 May 2025 94,172.00 | 13 | −$9,224.08 |
| long | 1 May 2025 94,172.00 | 2 May 2025 96,489.90 | 1 | $2,317.90 |
| short | 2 May 2025 96,489.90 | 5 May 2025 94,277.60 | 3 | $2,212.29 |
| long | 5 May 2025 94,277.60 | 8 May 2025 97,030.50 | 3 | $2,752.89 |
| short | 8 May 2025 97,030.50 | 13 May 2025 102,791.00 | 5 | −$5,760.82 |
| long | 13 May 2025 102,791.00 | 17 May 2025 103,464.00 | 4 | $672.58 |
| short | 17 May 2025 103,464.00 | 18 May 2025 103,127.00 | 1 | $337.25 |
| long | 18 May 2025 103,127.00 | 19 May 2025 106,454.00 | 1 | $3,327.62 |
| short | 19 May 2025 106,454.00 | 25 May 2025 107,762.00 | 6 | −$1,307.63 |
| long | 25 May 2025 107,762.00 | 27 May 2025 109,435.00 | 2 | $1,672.88 |
| short | 27 May 2025 109,435.00 | 29 May 2025 107,782.00 | 2 | $1,653.00 |
| long | 29 May 2025 107,782.00 | 3 Jun 2025 105,858.00 | 5 | −$1,923.78 |
| short | 3 Jun 2025 105,858.00 | 5 Jun 2025 104,697.00 | 2 | $1,161.14 |
| long | 5 Jun 2025 104,697.00 | 8 Jun 2025 105,552.00 | 3 | $855.29 |
| short | 8 Jun 2025 105,552.00 | 13 Jun 2025 105,672.00 | 5 | −$119.59 |
| long | 13 Jun 2025 105,672.00 | 17 Jun 2025 106,795.00 | 4 | $1,122.79 |
| short | 17 Jun 2025 106,795.00 | 18 Jun 2025 104,551.00 | 1 | $2,243.36 |
| long | 18 Jun 2025 104,551.00 | 24 Jun 2025 105,334.00 | 6 | $782.77 |
| short | 24 Jun 2025 105,334.00 | 2 Jul 2025 105,681.00 | 8 | −$347.19 |
| long | 2 Jul 2025 105,681.00 | 3 Jul 2025 108,850.00 | 1 | $3,168.46 |
| short | 3 Jul 2025 108,850.00 | 8 Jul 2025 108,263.00 | 5 | $586.65 |
| long | 8 Jul 2025 108,263.00 | 9 Jul 2025 108,923.00 | 1 | $660.05 |
| short | 9 Jul 2025 108,923.00 | 16 Jul 2025 117,758.00 | 7 | −$8,835.09 |
| long | 16 Jul 2025 117,758.00 | 17 Jul 2025 118,630.00 | 1 | $872.36 |
| short | 17 Jul 2025 118,630.00 | 19 Jul 2025 117,925.00 | 2 | $705.60 |
| long | 19 Jul 2025 117,925.00 | 23 Jul 2025 119,954.00 | 4 | $2,029.59 |
| short | 23 Jul 2025 119,954.00 | 25 Jul 2025 118,341.00 | 2 | $1,613.45 |
| long | 25 Jul 2025 118,341.00 | 28 Jul 2025 119,416.00 | 3 | $1,074.58 |
| short | 28 Jul 2025 119,416.00 | 30 Jul 2025 117,951.00 | 2 | $1,464.81 |
| long | 30 Jul 2025 117,951.00 | 5 Aug 2025 115,055.00 | 6 | −$2,895.72 |
| short | 5 Aug 2025 115,055.00 | 16 Aug 2025 117,342.00 | 11 | −$2,287.01 |
| long | 16 Aug 2025 117,342.00 | 23 Aug 2025 116,936.00 | 7 | −$406.04 |
| short | 23 Aug 2025 116,936.00 | 25 Aug 2025 113,494.00 | 2 | $3,442.41 |
| long | 25 Aug 2025 113,494.00 | 29 Aug 2025 112,567.00 | 4 | −$926.69 |
| short | 29 Aug 2025 112,567.00 | 30 Aug 2025 108,377.00 | 1 | $4,189.50 |
| long | 30 Aug 2025 108,377.00 | 3 Sep 2025 111,240.00 | 4 | $2,862.61 |
| short | 3 Sep 2025 111,240.00 | 7 Sep 2025 110,188.00 | 4 | $1,052.03 |
| long | 7 Sep 2025 110,188.00 | 8 Sep 2025 111,137.00 | 1 | $949.37 |
| short | 8 Sep 2025 111,137.00 | 16 Sep 2025 115,350.00 | 8 | −$4,212.36 |
| long | 16 Sep 2025 115,350.00 | 17 Sep 2025 116,789.00 | 1 | $1,439.25 |
| short | 17 Sep 2025 116,789.00 | 20 Sep 2025 115,632.00 | 3 | $1,156.57 |
| long | 20 Sep 2025 115,632.00 | 29 Sep 2025 112,164.00 | 9 | −$3,468.43 |
| short | 29 Sep 2025 112,164.00 | 8 Oct 2025 121,333.00 | 9 | −$9,169.00 |
| long | 8 Oct 2025 121,333.00 | 21 Oct 2025 110,532.00 | 13 | −$10,800.90 |
| short | 21 Oct 2025 110,532.00 | 23 Oct 2025 107,567.00 | 2 | $2,964.64 |
| long | 23 Oct 2025 107,567.00 | 24 Oct 2025 110,078.00 | 1 | $2,510.74 |
| short | 24 Oct 2025 110,078.00 | 30 Oct 2025 110,021.00 | 6 | $56.89 |
| long | 30 Oct 2025 110,021.00 | 3 Nov 2025 110,541.00 | 4 | $519.39 |
| short | 3 Nov 2025 110,541.00 | 4 Nov 2025 106,583.00 | 1 | $3,957.64 |
| long | 4 Nov 2025 106,583.00 | 10 Nov 2025 104,723.00 | 6 | −$1,860.10 |
| short | 10 Nov 2025 104,723.00 | 13 Nov 2025 101,654.00 | 3 | $3,068.58 |
| long | 13 Nov 2025 101,654.00 | 25 Nov 2025 88,300.00 | 12 | −$13,354.40 |
| short | 25 Nov 2025 88,300.00 | 2 Dec 2025 86,286.00 | 7 | $2,014.00 |
| long | 2 Dec 2025 86,286.00 | 4 Dec 2025 93,429.90 | 2 | $7,143.94 |
| short | 4 Dec 2025 93,429.90 | 6 Dec 2025 89,330.00 | 2 | $4,099.91 |
| long | 6 Dec 2025 89,330.00 | 9 Dec 2025 90,634.40 | 3 | $1,304.31 |
| short | 9 Dec 2025 90,634.40 | 13 Dec 2025 90,268.40 | 4 | $365.92 |
| long | 13 Dec 2025 90,268.40 | 20 Dec 2025 88,136.90 | 7 | −$2,131.48 |
| short | 20 Dec 2025 88,136.90 | 24 Dec 2025 87,486.00 | 4 | $650.95 |
| long | 24 Dec 2025 87,486.00 | 27 Dec 2025 87,369.60 | 3 | −$116.44 |
| short | 27 Dec 2025 87,369.60 | 8 Jan 2026 91,364.20 | 12 | −$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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| ROoT this page | — | v5 strategy | −4.7% | 225 | 9.4% |
| ZVWAP strategy by mohanee | sma ema vwap | v4 strategy | +614.4% | 13 | 748.5% |
| Ultimate Oscillator [Long] Strategy by mohanee | sma vwap ema | v4 strategy | No trades on this market | ||
| JBravo Swing with GoGo Juice by bradvaughn | sma ema vwap | v4 strategy | +68.7% | 93 | 22.3% |
| VWAP and BB strategy [EEMANI] by mohanee | ema vwap sma | v4 strategy | No trades on this market | ||
| Buying Selling Volume Strategy by exlux99 | vwap ema sma | v5 strategy | No 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
VerifiedNothing 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
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 7 ms | Yes 1,000 bars in 22 ms | Not measured |
| PineTS | Not tested | Not tested | Not 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)