Pine Script v5 · Strategy
[Strategy Alert Webhook Demo] Buy One Sell One
A Pine Script v5 strategy with no technical-analysis calculation. 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 commits 10% of equity 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 [Strategy Alert Webhook Demo] Buy One Sell One repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 299 of 299 trades.
- How did [Strategy Alert Webhook Demo] Buy One Sell One do on BTCUSDT 1D with default settings?
- −8.36%
- From 26 Jan 2024 to 21 Oct 2026, over 998 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- What alerts does [Strategy Alert Webhook Demo] Buy One Sell One have?
- 1
- {"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"}.
- Does [Strategy Alert Webhook Demo] Buy One Sell One 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: 998 before, 998 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 [Strategy Alert Webhook Demo] Buy One Sell One use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −8.36%
- −$83,578.10
- Buy and hold
- +102.5%
- same period
- Closed trades
- 998
- 479 won · 519 lost
- Profitable
- 48.0%
- of closed trades
- Profit factor
- 0.91
- gross profit ÷ gross loss
- Max drawdown
- 12.79%
- −$132,792.00
One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A long 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
No technical-analysis calculation: the script works on prices and settings directly.
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 Enter Long long | (bar_index % 2 == 0) | On | 18 |
| Open Enter Short short | (bar_index % 2 == 0) | On | 21 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| (no title) | alert | {"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"} | 24 |
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 | −8.4% | +102.5% | 998 | 48% | 0.91 | 12.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +0.8% | +5.5% | 998 | 51% | 1.03 | 1.6% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −12.7% | +9.8% | 998 | 47% | 0.90 | 17.8% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +1.0% | +8.4% | 998 | 50% | 1.03 | 2.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −16.4% | +16.7% | 998 | 48% | 0.89 | 23.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +1.9% | +21.5% | 998 | 50% | 1.05 | 2.8% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −7.3% | +148.3% | 998 | 47% | 0.92 | 15.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −2.5% | +17.1% | 998 | 51% | 0.92 | 3.5% | 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 | 344 | 51% | −$7,103.25 |
| Sideways market | 430 | 49% | −$18,688.00 |
| Falling market | 224 | 43% | −$57,786.80 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
15.9%
The 95th percentile of the worst drawdown when the same 998 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 9.5% to 15.9%; the tick is what actually happened, 12.7%. Order luck alone moves it this much.
The first 150 of 998 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 27 Jan 2024 41,823.50 | 28 Jan 2024 42,120.60 | 1 | $710.41 |
| short | 28 Jan 2024 42,120.60 | 29 Jan 2024 42,031.10 | 1 | $212.83 |
| long | 29 Jan 2024 42,031.10 | 30 Jan 2024 43,302.70 | 1 | $3,028.32 |
| short | 30 Jan 2024 43,302.70 | 31 Jan 2024 42,941.10 | 1 | $838.38 |
| long | 31 Jan 2024 42,941.10 | 1 Feb 2024 42,580.00 | 1 | −$844.95 |
| short | 1 Feb 2024 42,580.00 | 2 Feb 2024 43,082.90 | 1 | −$1,185.85 |
| long | 2 Feb 2024 43,082.90 | 3 Feb 2024 43,200.00 | 1 | $272.41 |
| short | 3 Feb 2024 43,200.00 | 4 Feb 2024 43,011.10 | 1 | $438.57 |
| long | 4 Feb 2024 43,011.10 | 5 Feb 2024 42,582.90 | 1 | −$999.06 |
| short | 5 Feb 2024 42,582.90 | 6 Feb 2024 42,708.70 | 1 | −$296.20 |
| long | 6 Feb 2024 42,708.70 | 7 Feb 2024 43,099.00 | 1 | $915.76 |
| short | 7 Feb 2024 43,099.00 | 8 Feb 2024 44,349.60 | 1 | −$2,910.76 |
| long | 8 Feb 2024 44,349.60 | 9 Feb 2024 45,288.70 | 1 | $2,117.78 |
| short | 9 Feb 2024 45,288.70 | 10 Feb 2024 47,132.80 | 1 | −$4,081.28 |
| long | 10 Feb 2024 47,132.80 | 11 Feb 2024 47,751.10 | 1 | $1,309.49 |
| short | 11 Feb 2024 47,751.10 | 12 Feb 2024 48,300.00 | 1 | −$1,149.00 |
| long | 12 Feb 2024 48,300.00 | 13 Feb 2024 49,917.30 | 1 | $3,342.97 |
| short | 13 Feb 2024 49,917.30 | 14 Feb 2024 49,699.60 | 1 | $436.83 |
| long | 14 Feb 2024 49,699.60 | 15 Feb 2024 51,795.20 | 1 | $4,225.57 |
| short | 15 Feb 2024 51,795.20 | 16 Feb 2024 51,880.00 | 1 | −$164.84 |
| long | 16 Feb 2024 51,880.00 | 17 Feb 2024 52,124.10 | 1 | $473.42 |
| short | 17 Feb 2024 52,124.10 | 18 Feb 2024 51,642.60 | 1 | $929.86 |
| long | 18 Feb 2024 51,642.60 | 19 Feb 2024 52,137.70 | 1 | $965.89 |
| short | 19 Feb 2024 52,137.70 | 20 Feb 2024 51,774.70 | 1 | $702.10 |
| long | 20 Feb 2024 51,774.70 | 21 Feb 2024 52,258.80 | 1 | $943.66 |
| short | 21 Feb 2024 52,258.80 | 22 Feb 2024 51,849.40 | 1 | $791.50 |
| long | 22 Feb 2024 51,849.40 | 23 Feb 2024 51,288.40 | 1 | −$1,093.83 |
| short | 23 Feb 2024 51,288.40 | 24 Feb 2024 50,744.20 | 1 | $1,071.73 |
| long | 24 Feb 2024 50,744.20 | 25 Feb 2024 51,568.20 | 1 | $1,641.82 |
| short | 25 Feb 2024 51,568.20 | 26 Feb 2024 51,728.80 | 1 | −$315.45 |
| long | 26 Feb 2024 51,728.80 | 27 Feb 2024 54,476.50 | 1 | $5,377.08 |
| short | 27 Feb 2024 54,476.50 | 28 Feb 2024 57,037.30 | 1 | −$4,784.10 |
| long | 28 Feb 2024 57,037.30 | 29 Feb 2024 62,432.10 | 1 | $9,580.51 |
| short | 29 Feb 2024 62,432.10 | 1 Mar 2024 61,131.00 | 1 | $2,130.95 |
| long | 1 Mar 2024 61,131.00 | 2 Mar 2024 62,387.90 | 1 | $2,106.74 |
| short | 2 Mar 2024 62,387.90 | 3 Mar 2024 61,987.30 | 1 | $659.31 |
| long | 3 Mar 2024 61,987.30 | 4 Mar 2024 63,114.00 | 1 | $1,867.41 |
| short | 4 Mar 2024 63,114.00 | 5 Mar 2024 68,245.70 | 1 | −$8,368.87 |
| long | 5 Mar 2024 68,245.70 | 6 Mar 2024 63,724.00 | 1 | −$6,764.07 |
| short | 6 Mar 2024 63,724.00 | 7 Mar 2024 66,074.00 | 1 | −$3,739.95 |
| long | 7 Mar 2024 66,074.00 | 8 Mar 2024 66,823.20 | 1 | $1,145.57 |
| short | 8 Mar 2024 66,823.20 | 9 Mar 2024 68,124.20 | 1 | −$1,969.42 |
| long | 9 Mar 2024 68,124.20 | 10 Mar 2024 68,313.30 | 1 | $280.21 |
| short | 10 Mar 2024 68,313.30 | 11 Mar 2024 68,955.90 | 1 | −$949.93 |
| long | 11 Mar 2024 68,955.90 | 12 Mar 2024 72,078.10 | 1 | $4,568.15 |
| short | 12 Mar 2024 72,078.10 | 13 Mar 2024 71,452.00 | 1 | $880.34 |
| long | 13 Mar 2024 71,452.00 | 14 Mar 2024 73,072.40 | 1 | $2,300.35 |
| short | 14 Mar 2024 73,072.40 | 15 Mar 2024 71,388.90 | 1 | $2,342.18 |
| long | 15 Mar 2024 71,388.90 | 16 Mar 2024 69,499.80 | 1 | −$2,696.46 |
| short | 16 Mar 2024 69,499.80 | 17 Mar 2024 65,300.60 | 1 | $6,140.48 |
| long | 17 Mar 2024 65,300.60 | 18 Mar 2024 68,393.50 | 1 | $4,842.55 |
| short | 18 Mar 2024 68,393.50 | 19 Mar 2024 67,610.00 | 1 | $1,176.78 |
| long | 19 Mar 2024 67,610.00 | 20 Mar 2024 61,937.40 | 1 | −$8,628.90 |
| short | 20 Mar 2024 61,937.40 | 21 Mar 2024 67,840.50 | 1 | −$9,719.70 |
| long | 21 Mar 2024 67,840.50 | 22 Mar 2024 65,501.30 | 1 | −$3,482.98 |
| short | 22 Mar 2024 65,501.30 | 23 Mar 2024 63,796.60 | 1 | $2,619.69 |
| long | 23 Mar 2024 63,796.60 | 24 Mar 2024 63,990.00 | 1 | $305.92 |
| short | 24 Mar 2024 63,990.00 | 25 Mar 2024 67,210.00 | 1 | −$5,080.05 |
| long | 25 Mar 2024 67,210.00 | 26 Mar 2024 69,880.00 | 1 | $3,990.37 |
| short | 26 Mar 2024 69,880.00 | 27 Mar 2024 69,988.00 | 1 | −$155.84 |
| long | 27 Mar 2024 69,988.00 | 28 Mar 2024 69,470.00 | 1 | −$746.27 |
| short | 28 Mar 2024 69,470.00 | 29 Mar 2024 70,780.60 | 1 | −$1,900.84 |
| long | 29 Mar 2024 70,780.60 | 30 Mar 2024 69,850.50 | 1 | −$1,321.45 |
| short | 30 Mar 2024 69,850.50 | 31 Mar 2024 69,582.20 | 1 | $385.86 |
| long | 31 Mar 2024 69,582.20 | 1 Apr 2024 71,280.00 | 1 | $2,451.55 |
| short | 1 Apr 2024 71,280.00 | 2 Apr 2024 69,649.80 | 1 | $2,303.42 |
| long | 2 Apr 2024 69,649.80 | 3 Apr 2024 65,464.00 | 1 | −$6,066.75 |
| short | 3 Apr 2024 65,464.00 | 4 Apr 2024 65,963.30 | 1 | −$765.28 |
| long | 4 Apr 2024 65,963.30 | 5 Apr 2024 68,487.80 | 1 | $3,837.29 |
| short | 5 Apr 2024 68,487.80 | 6 Apr 2024 67,820.60 | 1 | $980.46 |
| long | 6 Apr 2024 67,820.60 | 7 Apr 2024 68,896.00 | 1 | $1,597.44 |
| short | 7 Apr 2024 68,896.00 | 8 Apr 2024 69,360.40 | 1 | −$680.14 |
| long | 8 Apr 2024 69,360.40 | 9 Apr 2024 71,620.00 | 1 | $3,285.09 |
| short | 9 Apr 2024 71,620.00 | 10 Apr 2024 69,146.00 | 1 | $3,494.63 |
| long | 10 Apr 2024 69,146.00 | 11 Apr 2024 70,631.10 | 1 | $2,180.30 |
| short | 11 Apr 2024 70,631.10 | 12 Apr 2024 70,006.20 | 1 | $900.02 |
| long | 12 Apr 2024 70,006.20 | 13 Apr 2024 67,116.50 | 1 | −$4,203.06 |
| short | 13 Apr 2024 67,116.50 | 14 Apr 2024 63,924.50 | 1 | $4,822.66 |
| long | 14 Apr 2024 63,924.50 | 15 Apr 2024 65,661.90 | 1 | $2,769.03 |
| short | 15 Apr 2024 65,661.90 | 16 Apr 2024 63,420.00 | 1 | $3,488.09 |
| long | 16 Apr 2024 63,420.00 | 17 Apr 2024 63,793.40 | 1 | $603.58 |
| short | 17 Apr 2024 63,793.40 | 18 Apr 2024 61,277.40 | 1 | $4,045.45 |
| long | 18 Apr 2024 61,277.40 | 19 Apr 2024 63,470.10 | 1 | $3,684.84 |
| short | 19 Apr 2024 63,470.10 | 20 Apr 2024 63,818.00 | 1 | −$566.50 |
| long | 20 Apr 2024 63,818.00 | 21 Apr 2024 64,940.60 | 1 | $1,816.86 |
| short | 21 Apr 2024 64,940.60 | 22 Apr 2024 64,941.20 | 1 | −$0.91 |
| long | 22 Apr 2024 64,941.20 | 23 Apr 2024 66,819.30 | 1 | $2,992.46 |
| short | 23 Apr 2024 66,819.30 | 24 Apr 2024 66,414.00 | 1 | $629.45 |
| long | 24 Apr 2024 66,414.00 | 25 Apr 2024 64,289.60 | 1 | −$3,321.33 |
| short | 25 Apr 2024 64,289.60 | 26 Apr 2024 64,498.30 | 1 | −$336.07 |
| long | 26 Apr 2024 64,498.30 | 27 Apr 2024 63,770.00 | 1 | −$1,168.36 |
| short | 27 Apr 2024 63,770.00 | 28 Apr 2024 63,462.00 | 1 | $499.19 |
| long | 28 Apr 2024 63,462.00 | 29 Apr 2024 63,118.60 | 1 | −$559.44 |
| short | 29 Apr 2024 63,118.60 | 30 Apr 2024 63,866.00 | 1 | −$1,223.68 |
| long | 30 Apr 2024 63,866.00 | 1 May 2024 60,672.00 | 1 | −$5,162.17 |
| short | 1 May 2024 60,672.00 | 2 May 2024 58,365.00 | 1 | $3,905.33 |
| long | 2 May 2024 58,365.00 | 3 May 2024 59,060.60 | 1 | $1,228.75 |
| short | 3 May 2024 59,060.60 | 4 May 2024 62,882.00 | 1 | −$6,678.55 |
| long | 4 May 2024 62,882.00 | 5 May 2024 63,892.00 | 1 | $1,647.18 |
| short | 5 May 2024 63,892.00 | 6 May 2024 64,012.00 | 1 | −$192.87 |
| long | 6 May 2024 64,012.00 | 7 May 2024 63,165.20 | 1 | −$1,358.57 |
| short | 7 May 2024 63,165.20 | 8 May 2024 62,312.10 | 1 | $1,385.18 |
| long | 8 May 2024 62,312.10 | 9 May 2024 61,193.00 | 1 | −$1,844.32 |
| short | 9 May 2024 61,193.00 | 10 May 2024 63,074.00 | 1 | −$3,151.11 |
| long | 10 May 2024 63,074.00 | 11 May 2024 60,800.00 | 1 | −$3,684.58 |
| short | 11 May 2024 60,800.00 | 12 May 2024 60,826.00 | 1 | −$43.55 |
| long | 12 May 2024 60,826.00 | 13 May 2024 61,484.00 | 1 | $1,101.55 |
| short | 13 May 2024 61,484.00 | 14 May 2024 62,940.10 | 1 | −$2,414.10 |
| long | 14 May 2024 62,940.10 | 15 May 2024 61,577.50 | 1 | −$2,201.61 |
| short | 15 May 2024 61,577.50 | 16 May 2024 66,206.50 | 1 | −$7,628.25 |
| long | 16 May 2024 66,206.50 | 17 May 2024 65,235.20 | 1 | −$1,477.52 |
| short | 17 May 2024 65,235.20 | 18 May 2024 67,024.00 | 1 | −$2,757.53 |
| long | 18 May 2024 67,024.00 | 19 May 2024 66,915.20 | 1 | −$162.80 |
| short | 19 May 2024 66,915.20 | 20 May 2024 66,274.00 | 1 | $960.84 |
| long | 20 May 2024 66,274.00 | 21 May 2024 71,446.60 | 1 | $7,833.63 |
| short | 21 May 2024 71,446.60 | 22 May 2024 70,148.30 | 1 | $1,838.06 |
| long | 22 May 2024 70,148.30 | 23 May 2024 69,166.60 | 1 | −$1,418.18 |
| short | 23 May 2024 69,166.60 | 24 May 2024 67,969.70 | 1 | $1,751.20 |
| long | 24 May 2024 67,969.70 | 25 May 2024 68,550.00 | 1 | $865.49 |
| short | 25 May 2024 68,550.00 | 26 May 2024 69,290.60 | 1 | −$1,096.06 |
| long | 26 May 2024 69,290.60 | 27 May 2024 68,507.70 | 1 | −$1,145.07 |
| short | 27 May 2024 68,507.70 | 28 May 2024 69,436.40 | 1 | −$1,372.39 |
| long | 28 May 2024 69,436.40 | 29 May 2024 68,398.40 | 1 | −$1,511.29 |
| short | 29 May 2024 68,398.40 | 30 May 2024 67,652.40 | 1 | $1,100.94 |
| long | 30 May 2024 67,652.40 | 31 May 2024 68,352.20 | 1 | $1,045.24 |
| short | 31 May 2024 68,352.20 | 1 Jun 2024 67,540.00 | 1 | $1,201.95 |
| long | 1 Jun 2024 67,540.00 | 2 Jun 2024 67,766.80 | 1 | $340.14 |
| short | 2 Jun 2024 67,766.80 | 3 Jun 2024 67,765.60 | 1 | $1.82 |
| long | 3 Jun 2024 67,765.60 | 4 Jun 2024 68,809.90 | 1 | $1,561.22 |
| short | 4 Jun 2024 68,809.90 | 5 Jun 2024 70,537.80 | 1 | −$2,548.04 |
| long | 5 Jun 2024 70,537.80 | 6 Jun 2024 71,108.00 | 1 | $818.12 |
| short | 6 Jun 2024 71,108.00 | 7 Jun 2024 70,799.10 | 1 | $440.09 |
| long | 7 Jun 2024 70,799.10 | 8 Jun 2024 69,355.60 | 1 | −$2,066.11 |
| short | 8 Jun 2024 69,355.60 | 9 Jun 2024 69,310.50 | 1 | $65.82 |
| long | 9 Jun 2024 69,310.50 | 10 Jun 2024 69,648.10 | 1 | $492.76 |
| short | 10 Jun 2024 69,648.10 | 11 Jun 2024 69,540.00 | 1 | $157.13 |
| long | 11 Jun 2024 69,540.00 | 12 Jun 2024 67,314.20 | 1 | −$3,239.23 |
| short | 12 Jun 2024 67,314.20 | 13 Jun 2024 68,264.00 | 1 | −$1,423.33 |
| long | 13 Jun 2024 68,264.00 | 14 Jun 2024 66,773.00 | 1 | −$2,200.23 |
| short | 14 Jun 2024 66,773.00 | 15 Jun 2024 66,044.00 | 1 | $1,097.44 |
| long | 15 Jun 2024 66,044.00 | 16 Jun 2024 66,228.30 | 1 | $280.75 |
| short | 16 Jun 2024 66,228.30 | 17 Jun 2024 66,676.90 | 1 | −$681.81 |
| long | 17 Jun 2024 66,676.90 | 18 Jun 2024 66,504.30 | 1 | −$260.27 |
| short | 18 Jun 2024 66,504.30 | 19 Jun 2024 65,175.30 | 1 | $2,009.59 |
| long | 19 Jun 2024 65,175.30 | 20 Jun 2024 64,974.40 | 1 | −$310.67 |
| short | 20 Jun 2024 64,974.40 | 21 Jun 2024 64,870.00 | 1 | $161.82 |
| long | 21 Jun 2024 64,870.00 | 22 Jun 2024 64,143.60 | 1 | −$1,128.19 |
| short | 22 Jun 2024 64,143.60 | 23 Jun 2024 64,262.00 | 1 | −$185.84 |
| long | 23 Jun 2024 64,262.00 | 24 Jun 2024 63,210.00 | 1 | −$1,647.13 |
| short | 24 Jun 2024 63,210.00 | 25 Jun 2024 60,293.30 | 1 | $4,635.13 |
Similar scripts
No other indicator or strategy here shares enough of its calculations.
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: 998 before, 998 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.
⋯// © Crypto-Arsenal-//@version=5+//@version=6strategy("Buy One Sell One", overlay = false, default_qty_type=strategy.percent_of_equity, default_qty_value=10)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 39 ms | Yes 1,000 bars in 21 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/// © Crypto-Arsenal//@version=5strategy("Buy One Sell One", overlay = false, default_qty_type=strategy.percent_of_equity, default_qty_value=10)CONNECTOR_NAME = 'YOUR_CONNECTOR_NAME'CONNECTOR_TOKEN = 'YOUR_CONNECTOR_TOKEN'percent = str.tostring(10)cls = str.tostring(close)tp = str.tostring(strategy.position_avg_price * (1 + 0.1))sl = str.tostring(strategy.position_avg_price * (1 - 0.1)) if(bar_index % 2 == 0) // DEMO FOR SENDING MESSAGE WITH alert_message() // NEED TO ADD {{{strategy.order.alert_message}} to Message field at Create Alert box // Add "limit" to open a LIMIT order instead of default MARKET alert_message = '{"action":"openLong","percent":"' + percent + '","profit":"' + tp + '","loss":"' + sl + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Open Long at price:' + cls + '"}' strategy.entry('Enter Long', strategy.long, alert_message = alert_message)else // DEMO FOR SENDING MESSAGE WITH alert() strategy.entry('Enter Short', strategy.short) // Add "limit" to open a LIMIT order instead of default MARKET alert_message = '{"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"}' alert(alert_message, alert.freq_once_per_bar)